@ansible-flow/core 0.87.0 → 0.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ai/describe.js +5 -5
- package/dist/ai/handlers.js +21 -20
- package/dist/ai/handlers.js.map +1 -1
- package/dist/ai/ops.js +4 -4
- package/dist/ai/reference.js +2 -2
- package/dist/ai/scenarios.js +8 -6
- package/dist/awx/import.js +3 -3
- package/dist/chunks/{chunk-IZJPLWDY.js → chunk-2KB3J3R5.js} +2 -2
- package/dist/chunks/{chunk-EAJFZKPB.js → chunk-37FKZNRN.js} +3 -3
- package/dist/chunks/{chunk-BNMW6KWK.js → chunk-57KJYXWA.js} +3 -3
- package/dist/chunks/{chunk-2P3JEHLH.js → chunk-7ALTNZCI.js} +3 -3
- package/dist/chunks/{chunk-WSARMPYU.js → chunk-APBEHKCF.js} +2 -2
- package/dist/chunks/{chunk-W2CSOAIB.js → chunk-BSX6G7QY.js} +5 -5
- package/dist/chunks/{chunk-3Z4WABFK.js → chunk-CATQHJS6.js} +4 -4
- package/dist/chunks/{chunk-HPRG2672.js → chunk-CCWUUVSG.js} +2 -2
- package/dist/chunks/{chunk-C6SQEXL5.js → chunk-CNQ7M7HA.js} +2 -2
- package/dist/chunks/{chunk-IXW7A4M7.js → chunk-CNYGDBID.js} +2 -2
- package/dist/chunks/{chunk-DL4LYODQ.js → chunk-J5LYSQ3L.js} +2 -2
- package/dist/chunks/{chunk-72LO6GQE.js → chunk-KXD6FX2Z.js} +2 -2
- package/dist/chunks/{chunk-4RMWFRWG.js → chunk-LELKMVJG.js} +45 -7
- package/dist/chunks/chunk-LELKMVJG.js.map +7 -0
- package/dist/chunks/{chunk-QMIXDOU6.js → chunk-OGNFHW5O.js} +4 -10
- package/dist/chunks/chunk-OGNFHW5O.js.map +7 -0
- package/dist/chunks/chunk-OJZSZBHW.js +45 -0
- package/dist/chunks/chunk-OJZSZBHW.js.map +7 -0
- package/dist/chunks/{chunk-R4MW3DRT.js → chunk-OW32YCZ6.js} +2 -2
- package/dist/chunks/{chunk-76T45V37.js → chunk-TBFB7A2Z.js} +5 -1
- package/dist/chunks/{chunk-76T45V37.js.map → chunk-TBFB7A2Z.js.map} +2 -2
- package/dist/chunks/{chunk-BXJOUAXV.js → chunk-TEJARYAE.js} +3 -3
- package/dist/chunks/{chunk-KZALUEFT.js → chunk-TPMACJFA.js} +3 -3
- package/dist/chunks/{chunk-2MJKBPGG.js → chunk-WTVGCMGV.js} +7 -3
- package/dist/chunks/chunk-WTVGCMGV.js.map +7 -0
- package/dist/chunks/{chunk-6MLYGFT6.js → chunk-XJAMBKE3.js} +6 -2
- package/dist/chunks/chunk-XJAMBKE3.js.map +7 -0
- package/dist/chunks/{chunk-FMCBTYUM.js → chunk-ZXUXX3YY.js} +2 -2
- package/dist/engine/binding.js +3 -1
- package/dist/engine/engines.js +5 -3
- package/dist/engine/files.js +5 -3
- package/dist/engine/optionA.js +4 -2
- package/dist/engine/preview.js +5 -3
- package/dist/engine/preview.js.map +1 -1
- package/dist/engine/writePlan.js +7 -5
- package/dist/export/drawio.js +3 -3
- package/dist/export/layoutCheck.js +3 -3
- package/dist/export/scene.js +2 -2
- package/dist/export/svg.js +4 -4
- package/dist/flow/findingCodes.js +1 -1
- package/dist/flow/localFiles.d.ts +17 -0
- package/dist/flow/localFiles.js +14 -0
- package/dist/flow/localFiles.js.map +7 -0
- package/dist/import/outline.js +5 -4
- package/dist/import/playbook.js +2 -2
- package/dist/import/source.js +2 -1
- package/dist/protocol.d.ts +12 -0
- package/dist/run/command.d.ts +13 -4
- package/dist/run/command.js +19 -0
- package/dist/run/command.js.map +3 -3
- package/dist/scenario/live.js +7 -5
- package/dist/scenario/simulate.js +6 -4
- package/dist/view/flowFacts.js +7 -5
- package/dist/view/flowFacts.js.map +1 -1
- package/dist/view/jinjaComplete.js +3 -3
- package/dist/view/route.d.ts +3 -1
- package/dist/view/route.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-2MJKBPGG.js.map +0 -7
- package/dist/chunks/chunk-4RMWFRWG.js.map +0 -7
- package/dist/chunks/chunk-6MLYGFT6.js.map +0 -7
- package/dist/chunks/chunk-QMIXDOU6.js.map +0 -7
- /package/dist/chunks/{chunk-IZJPLWDY.js.map → chunk-2KB3J3R5.js.map} +0 -0
- /package/dist/chunks/{chunk-EAJFZKPB.js.map → chunk-37FKZNRN.js.map} +0 -0
- /package/dist/chunks/{chunk-BNMW6KWK.js.map → chunk-57KJYXWA.js.map} +0 -0
- /package/dist/chunks/{chunk-2P3JEHLH.js.map → chunk-7ALTNZCI.js.map} +0 -0
- /package/dist/chunks/{chunk-WSARMPYU.js.map → chunk-APBEHKCF.js.map} +0 -0
- /package/dist/chunks/{chunk-W2CSOAIB.js.map → chunk-BSX6G7QY.js.map} +0 -0
- /package/dist/chunks/{chunk-3Z4WABFK.js.map → chunk-CATQHJS6.js.map} +0 -0
- /package/dist/chunks/{chunk-HPRG2672.js.map → chunk-CCWUUVSG.js.map} +0 -0
- /package/dist/chunks/{chunk-C6SQEXL5.js.map → chunk-CNQ7M7HA.js.map} +0 -0
- /package/dist/chunks/{chunk-IXW7A4M7.js.map → chunk-CNYGDBID.js.map} +0 -0
- /package/dist/chunks/{chunk-DL4LYODQ.js.map → chunk-J5LYSQ3L.js.map} +0 -0
- /package/dist/chunks/{chunk-72LO6GQE.js.map → chunk-KXD6FX2Z.js.map} +0 -0
- /package/dist/chunks/{chunk-R4MW3DRT.js.map → chunk-OW32YCZ6.js.map} +0 -0
- /package/dist/chunks/{chunk-BXJOUAXV.js.map → chunk-TEJARYAE.js.map} +0 -0
- /package/dist/chunks/{chunk-KZALUEFT.js.map → chunk-TPMACJFA.js.map} +0 -0
- /package/dist/chunks/{chunk-FMCBTYUM.js.map → chunk-ZXUXX3YY.js.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-SD6TCN3P.js";
|
|
5
5
|
import {
|
|
6
6
|
scenesOf
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KXD6FX2Z.js";
|
|
8
8
|
import {
|
|
9
9
|
INSET,
|
|
10
10
|
inset,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
overlaps,
|
|
13
13
|
pointsOf,
|
|
14
14
|
segmentHits
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LELKMVJG.js";
|
|
16
16
|
import {
|
|
17
17
|
openFailPorts
|
|
18
18
|
} from "./chunk-KSM4O2XL.js";
|
|
@@ -164,4 +164,4 @@ export {
|
|
|
164
164
|
LAYOUT_FIX,
|
|
165
165
|
flowLayoutProblems
|
|
166
166
|
};
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
167
|
+
//# sourceMappingURL=chunk-TEJARYAE.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-X3DEH47B.js";
|
|
8
8
|
import {
|
|
9
9
|
LAYOUT_FIX
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TEJARYAE.js";
|
|
11
11
|
import {
|
|
12
12
|
acceptKey
|
|
13
13
|
} from "./chunk-PNLY5IWM.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./chunk-BUPWGYNF.js";
|
|
26
26
|
import {
|
|
27
27
|
FINDING_CODES
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-TBFB7A2Z.js";
|
|
29
29
|
import {
|
|
30
30
|
LAYOUT_RULES
|
|
31
31
|
} from "./chunk-SELZNC6A.js";
|
|
@@ -265,4 +265,4 @@ export {
|
|
|
265
265
|
countFindings,
|
|
266
266
|
describeFlow
|
|
267
267
|
};
|
|
268
|
-
//# sourceMappingURL=chunk-
|
|
268
|
+
//# sourceMappingURL=chunk-TPMACJFA.js.map
|
|
@@ -9,7 +9,10 @@ import {
|
|
|
9
9
|
inputVars,
|
|
10
10
|
isIncludeTasks,
|
|
11
11
|
stubFacts
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XJAMBKE3.js";
|
|
13
|
+
import {
|
|
14
|
+
localFileOf
|
|
15
|
+
} from "./chunk-OJZSZBHW.js";
|
|
13
16
|
import {
|
|
14
17
|
withoutDisabled
|
|
15
18
|
} from "./chunk-ARA3VJR2.js";
|
|
@@ -909,7 +912,8 @@ var Generator = class {
|
|
|
909
912
|
repoRoot(node) {
|
|
910
913
|
const impl = node.impl;
|
|
911
914
|
if (!impl?.ref || impl.kind === "playbook") return {};
|
|
912
|
-
const reads = impl.kind === "role" || isIncludeTasks(impl.ref) ||
|
|
915
|
+
const reads = impl.kind === "role" || isIncludeTasks(impl.ref) || // AFD-291: a relative file the step reads is written from the root.
|
|
916
|
+
impl.kind === "module" && !!localFileOf(impl.ref, impl.params) || JSON.stringify([impl.params ?? null, impl.keywords ?? null]).includes("afd_repo_root");
|
|
913
917
|
if (!reads) return {};
|
|
914
918
|
const root = (this.opts.root ?? "../../..").replace(/\/+$/, "");
|
|
915
919
|
return { afd_repo_root: `{{ (playbook_dir ~ '/${root}') | ansible.builtin.realpath }}` };
|
|
@@ -1332,4 +1336,4 @@ export {
|
|
|
1332
1336
|
CHECKSUM_PREFIX,
|
|
1333
1337
|
optionA
|
|
1334
1338
|
};
|
|
1335
|
-
//# sourceMappingURL=chunk-
|
|
1339
|
+
//# sourceMappingURL=chunk-WTVGCMGV.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/core/engine/optionA.ts"],
|
|
4
|
+
"sourcesContent": ["// Option A code generation (handoff 05, ADR-0003, ADR-0009): one playbook per flow level, one play\n// per node, host sets routed between plays with group_by, and a final outcome play that fails the\n// hosts left on open ports or failed end nodes (no host ever fails inside a node play).\n\nimport {\n bubbles,\n type LevelTaken,\n levelTaken,\n portKey,\n unreachableBubbles,\n} from '../flow/bubbling';\nimport {\n capturedOutputs,\n captureTaskName,\n groupPart,\n outputVar,\n registerName,\n} from '../flow/dataNames';\nimport { portAccepted } from '../flow/decisions';\nimport { privilegeOf } from '../flow/inherit';\nimport { conditionExpr } from '../flow/jinja';\nimport { localFileOf } from '../flow/localFiles';\nimport { buildModel, type FlowModel, type Level, ROOT } from '../flow/model';\nimport { isFailPort, legalPorts, portsFor } from '../flow/ports';\nimport { rollingObstacles } from '../flow/rolling';\nimport { planSegments, type Segment } from '../flow/segments';\nimport type { Edge, FlowDocument, FlowNode, Ulid } from '../flow/types';\nimport type { Finding } from '../flow/validate';\nimport { plainText } from '../view/markdown';\nimport { bindingTask, inputVars, isIncludeTasks, stubFacts } from './binding';\nimport { withoutDisabled } from './bypass';\nimport { effectiveTargets } from './targets';\nimport type {\n Engine,\n GeneratedFile,\n GenerateOptions,\n GenerateResult,\n HostTerm,\n PlanStep,\n PlayRange,\n Route,\n RunPlan,\n SegmentFile,\n} from './types';\nimport { checksum, jinjaLiteral, timeoutValue } from './util';\nimport {\n Comment,\n comment,\n commentLine,\n flow,\n type Out,\n type OutMap,\n oneLine,\n writeBlock,\n} from './yamlWriter';\n\nexport const CHECKSUM_PREFIX = '# Checksum: ';\n\ninterface LevelCtx {\n level: Level;\n /** Keys of the enclosing subflow nodes, outermost first. */\n path: string[];\n file: string;\n /** Host pattern of a start node (root) or of the subflow's entry (inner levels). */\n entry: string;\n parent?: { node: FlowNode; ctx: LevelCtx };\n}\n\n/** Every line break YAML (1.1 and 1.2) knows: a Note's text is split on all of them (AFD-66). */\nconst LINE_BREAK = /\\r\\n|[\\r\\n\\u0085\\u2028\\u2029]/;\n\ninterface Chunk {\n node?: Ulid;\n lines: string[];\n}\n\ninterface OutcomeEntry {\n order: number;\n groups: string[];\n name: string;\n msg: string;\n}\n\n/** A segment build: the segment and the whole flow's outcome (failed only in leaf segments). */\ninterface SegmentRun {\n seg: Segment;\n outcome: OutcomeEntry[];\n}\n\nclass Generator {\n private readonly model: FlowModel;\n private readonly findings: Finding[] = [];\n private readonly routes: Record<string, Route> = {};\n private readonly outcome: OutcomeEntry[] = [];\n private readonly targets = new Map<string, string>();\n private readonly takenOf = new Map<Level, LevelTaken>();\n private readonly files: { ctx: LevelCtx; chunks: Chunk[] }[] = [];\n private order = 0;\n private todo = false;\n /** Approvals a local run passes unless afd_approvals says otherwise (AFD-21). */\n private approvals: string[] = [];\n /** Work nodes that run on an inventory_target (AFD-14). */\n private readonly overrides: Map<Ulid, string>;\n /** AFD-114: the plays of a scenario build, as the simulator runs them. */\n private readonly steps: PlanStep[] = [];\n private startInput?: string;\n /** The rolling subflow whose play the steps are blocks of (AFD-55): events land on it. */\n private rollingSub?: Ulid;\n\n constructor(\n private readonly doc: FlowDocument,\n private readonly opts: GenerateOptions,\n private readonly segment?: SegmentRun,\n ) {\n this.model = buildModel(doc);\n this.overrides = effectiveTargets(this.model);\n }\n\n /** become and become_user for a node's play (AFD-52: inherited from subflows in format 2). */\n private privilege(node: FlowNode): { become?: true; become_user?: string } {\n const p = privilegeOf(this.model, node);\n return {\n ...(p.become ? { become: true as const } : {}),\n ...(p.become_user ? { become_user: p.become_user } : {}),\n };\n }\n\n run(): GenerateResult {\n const root = this.model.levels.get(ROOT);\n const start = this.startPattern();\n if (!root || !start) return this.result(false);\n const ctx: LevelCtx = { level: root, path: [], file: `${this.doc.flow.key}.yml`, entry: start };\n if (!this.level(ctx)) return this.result(false);\n const outcome = this.outcomePlay();\n if (outcome) this.files[0]?.chunks.push({ lines: outcome });\n return this.result(true);\n }\n\n /** What the outcome play of the whole flow fails (segment builds reuse it). */\n outcomeEntries(): OutcomeEntry[] {\n return [...this.outcome];\n }\n\n // ---- AWX segments (AFD-11, ADR-0016) ---------------------------------------------------------\n\n /**\n * One segment's root playbook: restore the carried host sets (continuations), the segment's top-\n * level plays (subflow levels are the shared level files), then either carry the hosts waiting\n * at the gate and those bound for the outcome to the next segment, or, in a leaf, the outcome.\n */\n segmentRun(): GenerateResult {\n const { seg, outcome } = this.segment as SegmentRun;\n const root = this.model.levels.get(ROOT);\n const start = this.startPattern();\n if (!root || !start) return this.result(false);\n const ctx: LevelCtx = {\n level: root,\n path: [],\n file: `${this.doc.flow.key}.seg_${seg.name}.yml`,\n entry: start,\n };\n if (seg.finish) this.files.push({ ctx, chunks: [] });\n else if (!this.level(ctx)) return this.result(false);\n const chunks = this.files[0]?.chunks ?? [];\n chunks.unshift(...this.prelude(ctx, seg));\n // Segments never fail hosts themselves: the whole flow's outcome runs in the leaves.\n this.outcome.length = 0;\n this.outcome.push(...outcome);\n if (seg.gate) chunks.push({ lines: writeBlock([this.carry(seg.gate)], 0) });\n else {\n const play = this.outcomePlay();\n if (play) chunks.push({ lines: play });\n }\n return this.result(true);\n }\n\n private prelude(ctx: LevelCtx, seg: Segment): Chunk[] {\n if (!seg.entry && !seg.finish) return [];\n const tag = flow([`flow_${this.doc.flow.id}`]);\n const out: Chunk[] = [\n {\n lines: writeBlock(\n [\n {\n name: `[${this.doc.flow.key}] Segment ${seg.name}: restore host sets`,\n hosts: 'localhost',\n gather_facts: false,\n tags: tag,\n tasks: [\n {\n name: 'restore the host sets the previous segment carried',\n 'ansible.builtin.add_host': { name: '{{ item.1 }}', groups: '{{ item.0.key }}' },\n loop: \"{{ (afd_hostsets | default({})) | dict2items | subelements('value') }}\",\n loop_control: { label: '{{ item.0.key }}: {{ item.1 }}' },\n },\n ...(seg.finish\n ? [\n {\n name: 'only after an approval no host reached',\n 'ansible.builtin.fail': {\n msg: 'A segment before this one did not finish: see its AWX job',\n },\n when: 'not (afd_gate_empty | default(false) | bool)',\n },\n ]\n : []),\n ],\n },\n ],\n 0,\n ),\n },\n ];\n const gate = seg.entry ? this.model.nodes.get(seg.entry.approval)?.node : undefined;\n if (gate && seg.entry) {\n const port = seg.entry.outcome;\n const waiting = this.group([], gate.key, 'waiting');\n // AFD-272: AWX cannot tell a timeout from a rejection, so its rejected segment takes both;\n // a runner that can (runSegments) says which with afd_gate_outcome, and the hosts take the\n // timeout port when the approval has one.\n const timeout =\n port === 'rejected' && portsFor(gate).some((p) => p.name === 'timeout')\n ? [\n {\n test: \"(afd_gate_outcome | default('rejected')) == 'timeout'\",\n group: this.target(ctx, gate, 'timeout'),\n port: 'timeout',\n },\n ]\n : [];\n out.push({\n node: gate.id,\n lines: writeBlock(\n [\n {\n // The route suffix maps AWX events back to the approval node.\n name: `[${gate.key}] ${jinjaLiteral(oneLine(gate.title))}: route`,\n hosts: `{{ groups['${waiting}'] | default([]) | join(',') or 'afd_no_hosts' }}`,\n gather_facts: false,\n tags: flow([`node_${gate.id}`]),\n vars: { flow_node_id: gate.id },\n tasks: [choose(gate, timeout, { group: this.target(ctx, gate, port), port })],\n },\n ],\n 0,\n ),\n });\n }\n return out;\n }\n\n /** set_stats for the next segment, then stop this job when nobody waits at the gate. */\n private carry(gateId: Ulid): OutMap {\n const gate = this.model.nodes.get(gateId)?.node as FlowNode;\n const waiting = this.group([], gate.key, 'waiting');\n const groups = [...new Set([...this.outcome.flatMap((e) => e.groups), waiting])];\n const empty = `groups['${waiting}'] | default([]) | length == 0`;\n return {\n name: `[${this.doc.flow.key}] Segment ${this.segment?.seg.name}: carry host sets`,\n hosts: 'localhost',\n gather_facts: false,\n tags: flow([`flow_${this.doc.flow.id}`]),\n tasks: [\n {\n name: 'carry the hosts waiting for approval and those bound for the outcome',\n 'ansible.builtin.set_stats': {\n data: {\n afd_hostsets: Object.fromEntries(\n groups.map((g) => [g, `{{ groups['${g}'] | default([]) }}`]),\n ),\n afd_gate_empty: `{{ ${empty} }}`,\n },\n per_host: false,\n aggregate: false,\n },\n },\n {\n name: `[${gate.key}] no host reached ${jinjaLiteral(oneLine(gate.title))}`,\n 'ansible.builtin.fail': {\n msg: `No host reached [${gate.key}] ${jinjaLiteral(oneLine(gate.title))}: the approval is skipped and the flow finishes`,\n },\n when: empty,\n },\n ],\n };\n }\n\n // ---- inputs and routing -------------------------------------------------------------------\n\n /** The flow input that seeds start (decision 23): `targets: true`, else the first host_list. */\n private startPattern(): string | undefined {\n const inputs = Object.entries(this.doc.flow?.inputs ?? {});\n const hostLists = inputs.filter(([, f]) => f?.type === 'host_list');\n const chosen = hostLists.find(([, f]) => f.targets) ?? hostLists[0];\n if (!chosen) {\n this.finding('codegen-no-targets', 'error', 'The flow needs a host_list input to target', [\n 'flow',\n 'inputs',\n ]);\n return undefined;\n }\n // A list from the run inputs, or the comma-separated text an AWX survey answers (AFD-59).\n const name = chosen[0];\n this.startInput = name;\n return `{{ ${name} if ${name} is string else ${name} | join(',') }}`;\n }\n\n /** What takes the ports of the level's steps, once per level. */\n private taken(ctx: LevelCtx): LevelTaken {\n let taken = this.takenOf.get(ctx.level);\n if (!taken) {\n taken = levelTaken(ctx.level.edges, ctx.parent?.node);\n this.takenOf.set(ctx.level, taken);\n }\n return taken;\n }\n\n private group(path: string[], key: string, port: string): string {\n return `flow_${[...path, key].map(groupPart).join('__')}_${groupPart(port)}`;\n }\n\n /**\n * Group a node's output port routes into: its own group when wired (or open), the parent's port\n * group when the port leaves a subflow level through its boundary or bubbles up (ADR-0004).\n * An open fail port is recorded for the outcome play.\n */\n private target(ctx: LevelCtx, node: FlowNode, port: string): string {\n const memo = `${node.id}|${port}`;\n const known = this.targets.get(memo);\n if (known) return known;\n const own = this.group(ctx.path, node.key, port);\n let target = own;\n const taken = this.taken(ctx);\n const wired = taken.wired.has(portKey(node.id, port));\n const parent = ctx.parent;\n if (!wired && parent) {\n const exported = Object.entries(parent.node.subflow?.boundary?.outputs ?? {}).find(\n ([, refs]) => (refs ?? []).some((r) => r?.node === node.id && r.port === port),\n );\n if (exported) target = this.target(parent.ctx, parent.node, exported[0]);\n else if (bubbles(parent.node, node.id, port, taken))\n target = this.target(parent.ctx, parent.node, port);\n }\n if (target === own) {\n this.routes[own] = { node: node.id, port };\n if (!wired && isFailPort(port)) this.openPort(node, port, own);\n }\n this.targets.set(memo, target);\n return target;\n }\n\n private openPort(node: FlowNode, port: string, group: string): void {\n const decision = portAccepted(this.doc, node.id, port);\n const where = `[${node.key}] ${jinjaLiteral(oneLine(node.title))}`;\n this.outcome.push({\n order: this.order,\n groups: [group],\n name: decision ? `[${node.key}] ${port} open on purpose` : `[${node.key}] ${port} is open`,\n msg: decision\n ? `Stopped at ${where}: ${port} open on purpose (${jinjaLiteral(oneLine(decision.reason ?? 'no reason'))})`\n : `Stopped at ${where}: ${port} is not wired`,\n });\n }\n\n private sources(ctx: LevelCtx, node: FlowNode, edges: Edge[]): string[] {\n const out: string[] = [];\n for (const e of edges) {\n if (e.to.node !== node.id || e.to.port !== 'in') continue;\n const from = this.model.nodes.get(e.from.node)?.node;\n if (!from) continue;\n // A continuation segment starts at its approval, not at the flow targets.\n if (from.type === 'start' && this.segment?.seg.entry && !ctx.parent) continue;\n out.push(from.type === 'start' ? ctx.entry : this.target(ctx, from, e.from.port));\n }\n if (ctx.parent && ctx.parent.node.subflow?.boundary?.in === node.id) out.push(ctx.entry);\n return [...new Set(out)];\n }\n\n // ---- levels ----------------------------------------------------------------------------------\n\n private level(ctx: LevelCtx): boolean {\n const nodes = ctx.level.nodes.filter((n): n is FlowNode => !!n && typeof n === 'object');\n const ids = new Set(nodes.map((n) => n.id));\n const edges = ctx.level.edges.filter(\n (e): e is Edge => !!e?.from && !!e.to && ids.has(e.from.node) && ids.has(e.to.node),\n );\n const order = topoOrder(nodes, edges);\n if (!order) {\n const where = ctx.parent ? `level [${ctx.parent.node.key}]` : 'top level';\n this.finding('codegen-cycle', 'error', `The ${where} has a cycle; plays need an order`, []);\n return false;\n }\n const file = { ctx, chunks: [] as Chunk[] };\n this.files.push(file);\n for (const node of order) {\n this.order++;\n if (this.segment && !ctx.parent && !this.segment.seg.nodes.has(node.id)) continue;\n if (node.type === 'start') continue;\n if (node.type === 'end') {\n this.endNode(ctx, node, edges);\n continue;\n }\n const hosts = this.sources(ctx, node, edges);\n if (hosts.length === 0) {\n this.finding(\n 'codegen-no-input',\n 'warning',\n `Nothing leads to \"${node.title}\": no play is generated for it`,\n this.model.nodes.get(node.id)?.path ?? [],\n node.id,\n );\n continue;\n }\n if (node.type === 'subflow' && (node.subflow?.nodes?.length ?? 0) > 0) {\n if (!this.subflowLevel(ctx, node, hosts, file.chunks)) return false;\n continue;\n }\n // Its own target or an enclosing subflow's; decisions, approvals, parallels and joins\n // always run on the arriving hosts.\n const over = this.overrides.get(node.id);\n if (over) {\n // A blank line between the node's plays; a comment stays with the play it describes.\n const plays = this.overridePlays(ctx, node, hosts, over);\n file.chunks.push({\n node: node.id,\n lines: plays.flatMap((p, i) => [\n ...(i > 0 && !(plays[i - 1] instanceof Comment) ? [''] : []),\n ...writeBlock([p], 0),\n ]),\n });\n continue;\n }\n if (node.impl?.kind === 'playbook' && node.impl.ref && !this.opts.stubAll) {\n file.chunks.push({ node: node.id, lines: this.playbookNode(ctx, node, hosts) });\n continue;\n }\n const play = this.play(ctx, node, hosts, edges);\n file.chunks.push({ node: node.id, lines: writeBlock([play], 0) });\n }\n return true;\n }\n\n private subflowLevel(ctx: LevelCtx, node: FlowNode, hosts: string[], chunks: Chunk[]): boolean {\n const level = this.model.levels.get(node.id);\n if (!level) return true;\n const path = [...ctx.path, node.key];\n const file = `${this.doc.flow.key}.${path.join('.')}.yml`;\n chunks.push({\n node: node.id,\n lines: [\n commentLine(`[${node.key}] ${oneLine(node.title)}: subflow level, see ${file}`),\n ...writeBlock([{ import_playbook: file, tags: flow([`node_${node.id}`]) }], 0),\n ],\n });\n // Ports of the subflow node itself: wired ones feed this level, open ones reach the outcome.\n for (const p of portsFor(node)) if (p.direction === 'out') this.target(ctx, node, p.name);\n // A segment imports the level file the whole-flow build writes.\n if (this.segment) return true;\n const inner: LevelCtx = { level, path, file, entry: hosts.join(':'), parent: { node, ctx } };\n const rolling = node.settings?.rolling;\n if (rolling === undefined) return this.level(inner);\n const obstacles = rollingObstacles(this.model, node).map((o) => `${o.node.title}: ${o.why}`);\n for (const n of level.nodes)\n if (n && this.overrides.has(n.id) && !obstacles.some((o) => o.startsWith(`${n.title}:`)))\n obstacles.push(`${n.title}: it runs on an inventory_target, in plays of its own`);\n if (obstacles.length === 0) return this.rollingLevel(inner, rolling);\n this.finding(\n 'rolling-unsupported',\n 'error',\n `\"${node.title}\" cannot roll (${obstacles.join('; ')}): its steps run play by play`,\n this.model.nodes.get(node.id)?.path ?? [],\n node.id,\n );\n return this.level(inner);\n }\n\n /**\n * A rolling subflow's level (AFD-55): one play with `serial`, so each batch of hosts goes through\n * every step before the next batch starts. Each step is a block for the hosts that arrived at it\n * (its routing groups, as the play-per-step level uses), with the vars, tags and privilege its\n * own play would have; its routing, rescue and captures are the same tasks.\n */\n private rollingLevel(ctx: LevelCtx, batch: string | number): boolean {\n const sub = ctx.parent?.node as FlowNode;\n const nodes = ctx.level.nodes.filter((n): n is FlowNode => !!n && typeof n === 'object');\n const ids = new Set(nodes.map((n) => n.id));\n const edges = ctx.level.edges.filter(\n (e): e is Edge => !!e?.from && !!e.to && ids.has(e.from.node) && ids.has(e.to.node),\n );\n const order = topoOrder(nodes, edges);\n if (!order) {\n this.finding(\n 'codegen-cycle',\n 'error',\n `The level [${sub.key}] has a cycle; plays need an order`,\n [],\n );\n return false;\n }\n const blocks: Out[] = [];\n this.rollingSub = sub.id;\n for (const node of order) {\n this.order++;\n if (node.type === 'start') continue;\n if (node.type === 'end') {\n this.endNode(ctx, node, edges);\n continue;\n }\n const hosts = this.sources(ctx, node, edges);\n if (hosts.length === 0) {\n this.finding(\n 'codegen-no-input',\n 'warning',\n `Nothing leads to \"${node.title}\": no play is generated for it`,\n this.model.nodes.get(node.id)?.path ?? [],\n node.id,\n );\n continue;\n }\n const play = this.play(ctx, node, hosts, edges);\n for (const t of this.noteLines(node.id)) blocks.push(comment(t));\n // Every host of the play enters at the entry; the others arrive through their groups.\n const groups = hosts.filter((h) => h !== ctx.entry);\n blocks.push({\n name: play.name,\n block: play.tasks,\n vars: play.vars,\n become: play.become,\n become_user: play.become_user,\n tags: play.tags,\n when: hosts.includes(ctx.entry)\n ? undefined\n : `inventory_hostname in (${groups.map((g) => `groups['${g}'] | default([])`).join(' + ')})`,\n });\n }\n this.rollingSub = undefined;\n this.files.push({\n ctx,\n chunks: [\n {\n node: sub.id,\n lines: writeBlock(\n [\n {\n name: `[${sub.key}] ${jinjaLiteral(oneLine(sub.title))}: rolling, ${batch} at a time`,\n hosts: ctx.entry,\n gather_facts: false,\n serial: batch,\n tags: flow([`node_${sub.id}`]),\n vars: { flow_node_id: sub.id },\n tasks: blocks,\n },\n ],\n 0,\n ),\n },\n ],\n });\n return true;\n }\n\n private endNode(ctx: LevelCtx, node: FlowNode, edges: Edge[]): void {\n const groups = edges\n .filter((e) => e.to.node === node.id)\n .map((e) => {\n const from = this.model.nodes.get(e.from.node)?.node;\n return from && from.type !== 'start' ? this.target(ctx, from, e.from.port) : undefined;\n })\n .filter((g): g is string => !!g);\n if (node.outcome !== 'failed' || groups.length === 0) return;\n this.outcome.push({\n order: this.order,\n groups: [...new Set(groups)],\n name: `[${node.key}] ${jinjaLiteral(oneLine(node.title))}`,\n msg: `Ended at [${node.key}] ${jinjaLiteral(oneLine(node.title))} (outcome: failed)`,\n });\n }\n\n // ---- inventory_target (AFD-14) -------------------------------------------------------------\n\n /**\n * A node that runs on its inventory_target (AFD-14): the arriving hosts are marked, the binding\n * runs once on the target, and the arriving hosts leave together. They take ok_hosts when every\n * target host finished (or the failed share stays within max_fail_percentage), else failed_hosts\n * (timeout when a target host timed out and the port is enabled). A target that matches no host\n * fails them too: the work never ran.\n */\n private overridePlays(ctx: LevelCtx, node: FlowNode, hosts: string[], target: string): Out[] {\n const tag = `node_${node.id}`;\n // AFD-145: a play name is rendered too; Ansible stops the whole run on an undefined name.\n const title = `[${node.key}] ${jinjaLiteral(oneLine(node.title))}`;\n const settings = node.settings ?? {};\n const own = (part: string) => this.group(ctx.path, node.key, part);\n const arrived = own('arriving');\n const done = own('target_done');\n const timedOut = own('target_timeout');\n const failedOnTarget = own('target_failed');\n const enabled = new Set(portsFor(node).map((p) => p.name));\n const path = this.model.nodes.get(node.id)?.path ?? [];\n const impl = node.impl?.ref ? node.impl : undefined;\n const kind = this.opts.stubAll ? 'todo' : (impl?.kind ?? 'todo');\n const sim = this.opts.simulate && kind === 'todo';\n for (const p of portsFor(node)) if (p.direction === 'out') this.target(ctx, node, p.name);\n const never = ['unreachable', 'unchanged'].filter((p) => enabled.has(p));\n if (kind === 'playbook' && enabled.has('timeout')) never.push('timeout');\n if (never.length > 0)\n this.finding(\n 'codegen-target-ports',\n 'warning',\n `\"${node.title}\" runs on its inventory_target (${target}): arriving hosts never take ${never.join(', ')}`,\n path,\n node.id,\n );\n const timeoutPort = enabled.has('timeout') && kind !== 'playbook';\n const arriving = `{{ groups['${arrived}'] | default([]) }}`;\n const guard: OutMap = {\n name: `[${node.key}] no host arrived`,\n 'ansible.builtin.meta': 'end_play',\n when: 'afd_arriving | length == 0',\n };\n const plays: Out[] = [\n {\n name: `${title}: arriving hosts`,\n hosts: hosts.join(':'),\n gather_facts: false,\n tags: flow([tag]),\n vars: { flow_node_id: node.id },\n tasks: [{ name: `[${node.key}] arriving`, 'ansible.builtin.group_by': { key: arrived } }],\n },\n ];\n const inputs = inputVars(this.model, ctx.level.id, node, 'hostvars[afd_arriving | first]');\n\n if (kind === 'playbook') {\n const root = (this.opts.root ?? '../../..').replace(/\\/+$/, '');\n const ref = (impl?.ref ?? '').replace(/^\\.?\\//, '');\n plays.push(\n comment(\n `${title}: playbook ${ref} on ${target}; its plays should target \"{{ afd_hosts }}\"`,\n ),\n {\n import_playbook: `${root}/${ref}`,\n vars: {\n afd_target_pattern: target,\n afd_arriving: arriving,\n afd_hosts: `{{ (afd_arriving | length > 0) | ternary(afd_target_pattern, 'afd_no_hosts') }}`,\n ...((impl?.params ?? {}) as OutMap),\n ...inputs,\n },\n tags: flow([tag]),\n },\n {\n // Hosts that failed inside the playbook left the run; the rest finished.\n name: `${title}: target done`,\n hosts: target,\n gather_facts: false,\n tags: flow([tag]),\n vars: { flow_node_id: node.id, afd_arriving: arriving },\n tasks: [\n guard,\n ...this.captures(node),\n { name: `[${node.key}] target done`, 'ansible.builtin.group_by': { key: done } },\n ],\n },\n );\n } else {\n const vars: OutMap = {\n flow_node_id: node.id,\n afd_arriving: arriving,\n ...this.repoRoot(node),\n ...inputs,\n };\n if (this.opts.simulate) {\n const key = [...ctx.path, node.key].join('/');\n vars.afd_sim = `{{ (afd_simulate | default({}))['${key}'] | default({}) }}`;\n }\n const timeout = timeoutValue(settings.timeout);\n const reg = registerName(node, impl);\n const extra: Out[] = [];\n let body: OutMap;\n if (impl && kind !== 'todo') body = bindingTask(node, impl, timeout);\n else {\n const facts = stubFacts(node);\n if (facts) extra.push(facts);\n this.todo = true;\n const failing = ['failed', ...(enabled.has('timeout') ? ['timeout'] : [])];\n body = {\n name: `[${node.key}] TODO`,\n 'ansible.builtin.debug': {\n msg: `TODO: ${jinjaLiteral(oneLine(node.intent || node.title))}`,\n },\n failed_when: sim\n ? `inventory_hostname in ${failing.map((p) => `afd_sim.${p} | default([])`).join(' + ')}`\n : undefined,\n };\n }\n const finished: OutMap = {\n name: `[${node.key}] target done`,\n 'ansible.builtin.group_by': {\n key:\n kind === 'module'\n ? `{{ '${failedOnTarget}' if (${reg}.unreachable | default(false)) else '${done}' }}`\n : done,\n },\n };\n const timedTest = sim\n ? simIn('timeout')\n : '(ansible_failed_result.timedout | default(false))';\n plays.push({\n name: title,\n hosts: target,\n gather_facts: false,\n serial: settings.serial,\n ...this.privilege(node),\n tags: flow([tag, ...(settings.tags ?? [])]),\n vars,\n tasks: [\n guard,\n {\n block: [body, ...extra, ...this.captures(node), finished],\n rescue: [\n {\n name: `[${node.key}] target failed`,\n 'ansible.builtin.group_by': {\n key: timeoutPort\n ? `{{ '${timedOut}' if ${timedTest} else '${failedOnTarget}' }}`\n : failedOnTarget,\n },\n },\n failureRecord(node, [...ctx.path, node.key].join('/')),\n ],\n },\n ],\n });\n }\n\n // Route the arriving hosts on the target's result; outputs come from the first finished host.\n const limit = settings.max_fail_percentage;\n const failed =\n typeof limit === 'number'\n ? `afd_target | length == 0 or (afd_target_failed | length) * 100 > ${limit} * (afd_target | length)`\n : 'afd_target | length == 0 or afd_target_failed | length > 0';\n const failedGroup = this.target(ctx, node, 'failed_hosts');\n const failGroup = timeoutPort\n ? `('${this.target(ctx, node, 'timeout')}' if (groups['${timedOut}'] | default([]) | length > 0) else '${failedGroup}')`\n : `'${failedGroup}'`;\n const outputs = [\n ...new Set(\n Object.keys(node.outputs ?? {})\n .map((o) => outputVar(this.model, node, o).split(/[.[]/)[0] as string)\n .filter(Boolean),\n ),\n ];\n const failPorts = ['failed_hosts', ...(timeoutPort ? ['timeout'] : [])];\n const tasks: Out[] = [\n {\n name: `[${node.key}] target matched no host`,\n 'ansible.builtin.debug': {\n msg: 'inventory_target {{ afd_target_pattern }} matched no host: every arriving host takes failed_hosts',\n },\n when: 'afd_target | length == 0',\n run_once: true,\n },\n {\n name: `[${node.key}] target hosts that did not finish`,\n 'ansible.builtin.debug': { msg: \"{{ afd_target_failed | join(', ') }}\" },\n when: 'afd_target_failed | length > 0',\n run_once: true,\n },\n ];\n // One per variable, only when the target host set it, as a step's captures (AFD-53): a stub\n // registers nothing, and an unguarded read failed every arriving host (found by AFD-114).\n for (const o of outputs)\n tasks.push({\n name: `[${node.key}] outputs from the target (${o})`,\n 'ansible.builtin.set_fact': { [o]: `{{ hostvars[afd_target_done | first].${o} }}` },\n when: `afd_target_done | length > 0 and hostvars[afd_target_done | first].${o} is defined`,\n });\n // AFD-186: the arriving hosts take the target's failure, so the step on failed_hosts reads it.\n tasks.push({\n name: `[${node.key}] failure from the target`,\n 'ansible.builtin.set_fact': Object.fromEntries(\n FAILURE_FACTS.map((f) => [\n f,\n `{{ hostvars[afd_target_failed | first].${f} | default(none) }}`,\n ]),\n ),\n when: 'afd_target_failed | length > 0',\n });\n tasks.push(...failPorts.flatMap((p) => this.portComment(ctx, node, p)), {\n name: `[${node.key}] route ${['ok_hosts', ...failPorts].join(', ')}`,\n 'ansible.builtin.group_by': {\n key: `{{ ${failGroup} if (${failed}) else '${this.target(ctx, node, 'ok_hosts')}' }}`,\n },\n });\n if (enabled.has('always')) tasks.push(route(node, 'always', this.target(ctx, node, 'always')));\n plays.push({\n name: `${title}: route`,\n hosts: arrived,\n gather_facts: false,\n tags: flow([tag]),\n vars: {\n flow_node_id: node.id,\n afd_target_pattern: target,\n afd_target: \"{{ query('ansible.builtin.inventory_hostnames', afd_target_pattern) }}\",\n afd_target_done: `{{ groups['${done}'] | default([]) }}`,\n afd_target_failed: '{{ afd_target | difference(afd_target_done) }}',\n },\n tasks,\n });\n if (this.planning)\n this.steps.push({\n ...this.stepBase(ctx, node, hosts),\n kind: 'target',\n pattern: target,\n todo: `TODO: ${oneLine(node.intent || node.title)}`,\n ...(typeof limit === 'number' ? { maxFail: limit } : {}),\n });\n return plays;\n }\n\n // ---- the plan of a scenario build (AFD-114) ------------------------------------------------\n\n /** A scenario build (simulate, every step a stub) of the whole flow records its plan. */\n private get planning(): boolean {\n return !!this.opts.simulate && !!this.opts.stubAll && !this.segment;\n }\n\n /** The output ports of a node the generator routed, with their (resolved) groups. */\n private routedPorts(node: FlowNode): Record<string, string> {\n const out: Record<string, string> = {};\n const prefix = `${node.id}|`;\n for (const [memo, group] of this.targets)\n if (memo.startsWith(prefix)) out[memo.slice(prefix.length)] = group;\n return out;\n }\n\n private stepBase(ctx: LevelCtx, node: FlowNode, hosts: string[]) {\n const terms: HostTerm[] = hosts\n .flatMap((h) => h.split(':'))\n .filter(Boolean)\n .map((h) => (h.startsWith('{{') ? { start: true as const } : { group: h }));\n return {\n node: node.id,\n attribute: this.rollingSub ?? node.id,\n key: [...ctx.path, node.key].join('/'),\n label: `[${node.key}] ${oneLine(node.title)}`,\n hosts: terms,\n ports: this.routedPorts(node),\n serial: node.settings?.serial !== undefined,\n };\n }\n\n private record(ctx: LevelCtx, node: FlowNode, hosts: string[], edges: Edge[]): void {\n if (!this.planning) return;\n const base = this.stepBase(ctx, node, hosts);\n switch (node.type) {\n case 'decision':\n case 'approval':\n case 'parallel':\n this.steps.push({ ...base, kind: node.type });\n return;\n case 'join': {\n const members: string[] = [];\n for (const e of edges) {\n const from = e.to.node === node.id ? this.model.nodes.get(e.from.node)?.node : undefined;\n const group =\n from && from.type !== 'start' && this.targets.get(`${from.id}|${e.from.port}`);\n if (group) members.push(group);\n }\n this.steps.push({\n ...base,\n kind: 'join',\n mode: node.join_mode === 'any' ? 'any' : 'all',\n members,\n });\n return;\n }\n default: {\n const limit = node.settings?.max_fail_percentage;\n this.steps.push({\n ...base,\n kind: 'task',\n todo: `TODO: ${oneLine(node.intent || node.title)}`,\n // AFD-144: the hosts this step fails, as the generated code counts them.\n ...(typeof limit === 'number' ? { maxFail: { limit } } : {}),\n });\n }\n }\n }\n\n // ---- plays -----------------------------------------------------------------------------------\n\n /**\n * A playbook binding: `import_playbook` cannot sit inside a play, so the node is the import (its\n * plays target `afd_hosts`, the hosts arriving here) and a play that routes the hosts still\n * active to ok_hosts. Hosts that fail inside the playbook stop there (ADR-0011).\n */\n private playbookNode(ctx: LevelCtx, node: FlowNode, hosts: string[]): string[] {\n const tag = `node_${node.id}`;\n const root = (this.opts.root ?? '../../..').replace(/\\/+$/, '');\n const ref = (node.impl?.ref ?? '').replace(/^\\.?\\//, '');\n const pattern = hosts.join(':');\n if (\n portsFor(node).some(\n (p) => p.name !== 'failed_hosts' && p.direction === 'out' && p.name !== 'ok_hosts',\n )\n )\n this.finding(\n 'codegen-playbook-ports',\n 'warning',\n `\"${node.title}\" runs a playbook: only ok_hosts can be routed, other ports stay empty`,\n this.model.nodes.get(node.id)?.path ?? [],\n node.id,\n );\n for (const p of portsFor(node)) if (p.direction === 'out') this.target(ctx, node, p.name);\n return [\n commentLine(\n `[${node.key}] ${oneLine(node.title)}: playbook ${oneLine(ref)}; its plays should target \"{{ afd_hosts }}\"`,\n ),\n ...writeBlock(\n [\n {\n import_playbook: `${root}/${ref}`,\n vars: {\n afd_hosts: pattern,\n ...((node.impl?.params ?? {}) as OutMap),\n ...inputVars(this.model, ctx.level.id, node),\n },\n tags: flow([tag]),\n },\n {\n name: `[${node.key}] ${jinjaLiteral(oneLine(node.title))}: route`,\n hosts: pattern,\n gather_facts: false,\n tags: flow([tag]),\n tasks: [\n ...this.captures(node),\n route(node, 'ok_hosts', this.target(ctx, node, 'ok_hosts')),\n ],\n },\n ],\n 0,\n ),\n ];\n }\n\n private play(ctx: LevelCtx, node: FlowNode, hosts: string[], edges: Edge[]): OutMap {\n const tag = `node_${node.id}`;\n const vars: OutMap = {\n flow_node_id: node.id,\n ...this.repoRoot(node),\n ...inputVars(this.model, ctx.level.id, node),\n };\n if (this.opts.simulate) {\n const key = [...ctx.path, node.key].join('/');\n vars.afd_sim = `{{ (afd_simulate | default({}))['${key}'] | default({}) }}`;\n }\n const settings = node.settings ?? {};\n let tasks: Out[];\n switch (node.type) {\n case 'decision':\n tasks = this.decisionTasks(ctx, node);\n break;\n case 'approval':\n tasks =\n this.segment?.seg.gate === node.id && !ctx.parent\n ? [\n {\n name: `[${node.key}] wait for approval in AWX`,\n 'ansible.builtin.group_by': { key: this.group([], node.key, 'waiting') },\n },\n ]\n : this.approvalTasks(ctx, node, vars);\n break;\n case 'parallel':\n tasks = legalPorts(node)\n .filter((p) => p.enabled && p.name.startsWith('branch_'))\n .map((p) => route(node, p.name, this.target(ctx, node, p.name)));\n break;\n case 'join':\n tasks = this.joinTasks(ctx, node, edges);\n break;\n default:\n tasks = this.taskTasks(ctx, node);\n }\n this.record(ctx, node, hosts, edges);\n return {\n name: `[${node.key}] ${jinjaLiteral(oneLine(node.title))}`,\n hosts: hosts.join(':'),\n gather_facts: false,\n serial: settings.serial,\n ...this.privilege(node),\n tags: flow([tag, ...(settings.tags ?? [])]),\n vars,\n tasks,\n };\n }\n\n /**\n * A step's outputs that are not its register, copied into its own variables for the hosts that\n * finished it (AFD-53), so another step setting the same fact cannot change what readers get. An\n * output the code did not set stays unset, and its reader fails as it would have.\n */\n private captures(node: FlowNode): Out[] {\n return capturedOutputs(this.model, node).map(([out, name]) => ({\n name: captureTaskName(node.key, out),\n 'ansible.builtin.set_fact': { [name]: `{{ ${out} }}` },\n when: `${out} is defined`,\n }));\n }\n\n /**\n * AFD-177: `afd_repo_root`, the repository as an absolute path, for a step whose code reads it\n * or runs files the flow cannot see (a task file, a role). playbook_dir is generated/ and Ansible\n * does not let a play change it; shared files use `{{ afd_repo_root | default(playbook_dir) }}`.\n */\n private repoRoot(node: FlowNode): OutMap {\n const impl = node.impl;\n if (!impl?.ref || impl.kind === 'playbook') return {};\n const reads =\n impl.kind === 'role' ||\n isIncludeTasks(impl.ref) ||\n // AFD-291: a relative file the step reads is written from the root.\n (impl.kind === 'module' && !!localFileOf(impl.ref, impl.params)) ||\n JSON.stringify([impl.params ?? null, impl.keywords ?? null]).includes('afd_repo_root');\n if (!reads) return {};\n const root = (this.opts.root ?? '../../..').replace(/\\/+$/, '');\n return { afd_repo_root: `{{ (playbook_dir ~ '/${root}') | ansible.builtin.realpath }}` };\n }\n\n private taskTasks(ctx: LevelCtx, node: FlowNode): Out[] {\n const enabled = new Set(portsFor(node).map((p) => p.name));\n const impl = node.impl?.ref ? node.impl : undefined;\n const kind =\n !this.opts.stubAll && (impl?.kind === 'module' || impl?.kind === 'role') ? impl.kind : 'todo';\n const sim = this.opts.simulate && kind === 'todo';\n const timeout = timeoutValue(node.settings?.timeout);\n const reg = registerName(node, impl);\n const on = (port: string) => this.target(ctx, node, port);\n\n let body: OutMap;\n const extra: Out[] = [];\n if (kind !== 'todo' && impl) {\n body = bindingTask(node, impl, timeout);\n } else {\n const facts = stubFacts(node);\n if (facts) extra.push(facts);\n this.todo = true;\n const failing = ['failed', ...(enabled.has('timeout') ? ['timeout'] : [])];\n body = {\n name: `[${node.key}] TODO`,\n 'ansible.builtin.debug': {\n msg: `TODO: ${jinjaLiteral(oneLine(node.intent || node.title))}`,\n },\n failed_when: sim\n ? `inventory_hostname in ${failing.map((p) => `afd_sim.${p} | default([])`).join(' + ')}`\n : undefined,\n };\n }\n\n // ok_hosts, refined by unchanged (module results or simulation) and unreachable (module\n // results ignore unreachable so the host stays routable, ADR-0009).\n const okChoices: Choice[] = [];\n if (kind === 'module') {\n const group = enabled.has('unreachable')\n ? on('unreachable')\n : this.unreachableNotEnabled(ctx, node);\n okChoices.push({ test: `(${reg}.unreachable | default(false))`, group, port: 'unreachable' });\n if (enabled.has('unchanged'))\n okChoices.push({ test: `not ${reg}.changed`, group: on('unchanged'), port: 'unchanged' });\n } else if (sim) {\n for (const port of ['unreachable', 'unchanged'])\n if (enabled.has(port)) okChoices.push({ test: simIn(port), group: on(port), port });\n }\n const okRoute = choose(node, okChoices, { group: on('ok_hosts'), port: 'ok_hosts' });\n\n const failChoices: Choice[] = [];\n if (enabled.has('timeout')) {\n const test = sim ? simIn('timeout') : '(ansible_failed_result.timedout | default(false))';\n failChoices.push({ test, group: on('timeout'), port: 'timeout' });\n }\n // AFD-144: max_fail_percentage counts the hosts this step failed, in a group of its own. The\n // port groups can be a parent subflow's, which already hold the hosts other steps failed.\n const limit = node.settings?.max_fail_percentage;\n const failedHere =\n typeof limit === 'number' ? this.group(ctx.path, node.key, 'failed_here') : undefined;\n const unreachableHere = okChoices.find((c) => c.port === 'unreachable');\n const counted: Out[] = failedHere\n ? [\n {\n name: `[${node.key}] count the failure`,\n 'ansible.builtin.group_by': { key: failedHere },\n },\n ]\n : [];\n const rescue: Out[] = [\n ...['failed_hosts', ...failChoices.map((c) => c.port)].flatMap((p) =>\n this.portComment(ctx, node, p),\n ),\n ...counted,\n choose(node, failChoices, { group: on('failed_hosts'), port: 'failed_hosts' }),\n failureRecord(node, [...ctx.path, node.key].join('/')),\n ];\n const countUnreachable: Out[] =\n failedHere && unreachableHere\n ? [\n {\n name: `[${node.key}] count the unreachable`,\n 'ansible.builtin.group_by': { key: failedHere },\n when: unreachableHere.test,\n },\n ]\n : [];\n const block: OutMap = {\n block: [body, ...extra, ...this.captures(node), okRoute, ...countUnreachable],\n rescue,\n };\n if (enabled.has('always')) block.always = [route(node, 'always', on('always'))];\n const tasks: Out[] = [block];\n\n if (typeof limit === 'number' && failedHere) {\n const count = `groups['${failedHere}'] | default([]) | length`;\n tasks.push({\n name: `[${node.key}] max_fail_percentage ${limit} exceeded`,\n 'ansible.builtin.fail': {\n msg: `Flow stopped at [${node.key}]: {{ ${count} }} of {{ ansible_play_hosts_all | length }} hosts failed`,\n },\n when: `(${count}) * 100 > ${limit} * (ansible_play_hosts_all | length)`,\n });\n }\n return tasks;\n }\n\n /**\n * Module hosts that turn unreachable on a node without the port: they bubble to an enclosing\n * subflow's `unreachable` when it has one, else they fail in the outcome play.\n */\n private unreachableNotEnabled(ctx: LevelCtx, node: FlowNode): string {\n const parent = ctx.parent;\n if (parent && unreachableBubbles(parent.node))\n return this.target(parent.ctx, parent.node, 'unreachable');\n const group = this.group(ctx.path, node.key, 'unreachable');\n if (!this.routes[group]) {\n this.routes[group] = { node: node.id, port: 'unreachable' };\n this.outcome.push({\n order: this.order,\n groups: [group],\n name: `[${node.key}] unreachable`,\n msg: `Stopped at [${node.key}] ${jinjaLiteral(oneLine(node.title))}: host unreachable (the unreachable port is not enabled)`,\n });\n }\n return group;\n }\n\n /** Comment in the rescue saying where an open, decided or bubbling fail port leads. */\n private portComment(ctx: LevelCtx, node: FlowNode, port: string): Out[] {\n const target = this.target(ctx, node, port);\n const own = this.group(ctx.path, node.key, port);\n if (target !== own) {\n const r = this.routes[target];\n const owner = r ? this.model.nodes.get(r.node)?.node : undefined;\n return owner ? [comment(`${port} leaves this level as [${owner.key}] ${r?.port}`)] : [];\n }\n if (this.taken(ctx).wired.has(portKey(node.id, port))) return [];\n const decided = !!portAccepted(this.doc, node.id, port);\n return [\n comment(\n decided\n ? `${port} is open on purpose: these hosts stop in the outcome play`\n : `${port} is open: these hosts fail in the outcome play`,\n ),\n ];\n }\n\n private decisionTasks(ctx: LevelCtx, node: FlowNode): Out[] {\n const yes = this.target(ctx, node, 'true');\n const no = this.target(ctx, node, 'false');\n const condition = node.condition?.trim();\n if (!condition || this.opts.stubAll) {\n this.todo = true;\n const choices = this.opts.simulate\n ? [{ test: simIn('false'), group: no, port: 'false' }]\n : [];\n const pick = choose(node, choices, { group: yes, port: 'true' });\n return [\n {\n name: `[${node.key}] TODO`,\n 'ansible.builtin.debug': {\n msg: condition\n ? `Scenario: ${jinjaLiteral(oneLine(node.title))} takes true unless afd_simulate sends a host to false`\n : `TODO: ${jinjaLiteral(oneLine(node.title))} has no condition yet, so every host takes true`,\n },\n },\n pick,\n ];\n }\n const error = this.group(ctx.path, node.key, 'condition_error');\n this.routes[error] = { node: node.id, port: 'condition_error' };\n this.outcome.push({\n order: this.order,\n groups: [error],\n name: `[${node.key}] condition error`,\n msg: `Stopped at [${node.key}] ${jinjaLiteral(oneLine(node.title))}: the condition could not be evaluated`,\n });\n return [\n {\n block: [\n choose(node, [{ test: `not (${conditionExpr(condition)})`, group: no, port: 'false' }], {\n group: yes,\n port: 'true',\n }),\n ],\n rescue: [\n {\n name: `[${node.key}] condition could not be evaluated`,\n 'ansible.builtin.group_by': { key: error },\n },\n ],\n },\n ];\n }\n\n private approvalTasks(ctx: LevelCtx, node: FlowNode, vars: OutMap): Out[] {\n const enabled = new Set(portsFor(node).map((p) => p.name));\n const ports = ['approved', ...['rejected', 'timeout'].filter((p) => enabled.has(p))];\n // A local run approves unless the extra var afd_approvals names another outcome for this\n // approval (AFD-21); AWX workflow runs wait in a real approval node (AFD-11).\n const key = [...ctx.path, node.key].join('/');\n this.approvals.push(key);\n vars.afd_approval = `{{ (afd_approvals | default({}))['${key}'] | default('approved') }}`;\n const pick = 'afd_approval';\n const choices: Choice[] = ports\n .slice(1)\n .map((port) => ({ test: `${pick} == '${port}'`, group: this.target(ctx, node, port), port }));\n if (this.opts.simulate) {\n for (const port of ['rejected', 'timeout'])\n if (enabled.has(port))\n choices.push({ test: simIn(port), group: this.target(ctx, node, port), port });\n }\n return [\n {\n name: `[${node.key}] local approval`,\n 'ansible.builtin.debug': {\n msg: `${jinjaLiteral(oneLine(node.title))}: {{ afd_approval }} in this local run (afd_approvals chooses; AWX workflow runs wait in an approval node)`,\n },\n run_once: true,\n },\n {\n name: `[${node.key}] afd_approvals outcome`,\n 'ansible.builtin.fail': {\n msg: `afd_approvals['${key}'] must be one of ${ports.join(', ')}`,\n },\n when: `${pick} not in [${ports.map((p) => `'${p}'`).join(', ')}]`,\n },\n choose(node, choices, { group: this.target(ctx, node, 'approved'), port: 'approved' }),\n ];\n }\n\n private joinTasks(ctx: LevelCtx, node: FlowNode, edges: Edge[]): Out[] {\n const ok = this.target(ctx, node, 'ok_hosts');\n if (node.join_mode === 'any') return [route(node, 'ok_hosts', ok)];\n const member: string[] = [];\n for (const e of edges) {\n const from = e.to.node === node.id ? this.model.nodes.get(e.from.node)?.node : undefined;\n if (from && from.type !== 'start')\n member.push(\n `inventory_hostname in groups['${this.target(ctx, from, e.from.port)}'] | default([])`,\n );\n }\n const all = member.join(' and ') || 'true';\n if (portsFor(node).some((p) => p.name === 'failed_hosts')) {\n const failed = this.target(ctx, node, 'failed_hosts');\n return [\n choose(node, [{ test: `not (${all})`, group: failed, port: 'failed_hosts' }], {\n group: ok,\n port: 'ok_hosts',\n }),\n ];\n }\n return [{ ...route(node, 'ok_hosts', ok), when: all }];\n }\n\n // ---- outcome and files -------------------------------------------------------------------------\n\n private outcomePlay(): string[] | undefined {\n if (this.outcome.length === 0) return undefined;\n const entries = [...this.outcome].sort((a, b) => a.order - b.order);\n const groups = [...new Set(entries.flatMap((e) => e.groups))];\n const play: OutMap = {\n name: `[${this.doc.flow.key}] Outcome`,\n hosts: groups.join(':'),\n gather_facts: false,\n tags: flow([`flow_${this.doc.flow.id}`]),\n tasks: entries.map((e) => ({\n name: e.name,\n 'ansible.builtin.fail': { msg: e.msg },\n when: e.groups\n .map((g) => `inventory_hostname in groups['${g}'] | default([])`)\n .join(' or '),\n })),\n };\n return [\n '# Hosts left on open ports or failed end nodes fail here, after every branch ran (ADR-0009).',\n ...writeBlock([play], 0),\n ];\n }\n\n /**\n * The Notes on a node as comment text (AFD-66): Markdown made plain, one line per line. Every\n * YAML line break is a split, so no text can end the comment and become code.\n */\n private noteLines(id: Ulid): string[] {\n const level = this.model.levels.get(this.model.nodes.get(id)?.level ?? '');\n const out: string[] = [];\n for (const a of level?.annotations ?? []) {\n if (!a || (a.kind ?? 'note') !== 'note' || a.on !== id) continue;\n const lines = plainText(String(a.text ?? ''))\n .split(LINE_BREAK)\n .map((l) => l.trimEnd())\n .filter((l, i, all) => l !== '' || (i > 0 && i < all.length - 1));\n lines.forEach((l, i) => {\n out.push(i === 0 ? `Note: ${l}` : ` ${l}`.trimEnd());\n });\n }\n return out;\n }\n\n private result(ok: boolean): GenerateResult {\n const eol = this.opts.eol ?? '\\n';\n const files: GeneratedFile[] = [];\n const plays: Record<Ulid, PlayRange> = {};\n if (ok) {\n for (const { ctx, chunks } of this.files) {\n const header = this.header(ctx);\n const body: string[] = [];\n for (const chunk of chunks) {\n body.push('');\n // AFD-66: the Notes on the node, above its code (outside its play range).\n if (chunk.node) body.push(...this.noteLines(chunk.node).map(commentLine));\n const start = header.length + 1 + body.length;\n body.push(...chunk.lines);\n if (chunk.node)\n plays[chunk.node] = { file: ctx.file, start, end: start + chunk.lines.length };\n }\n const bodyText = body.map((l) => `${l}\\n`).join('');\n const lines = [...header, `${CHECKSUM_PREFIX}${checksum(bodyText)}`, ...body];\n files.push({ name: ctx.file, text: lines.join(eol) + eol, level: ctx.level.id });\n }\n }\n const plan: RunPlan | undefined =\n ok && this.planning\n ? {\n ...(this.startInput ? { start: this.startInput } : {}),\n steps: this.steps,\n outcome: [...this.outcome]\n .sort((a, b) => a.order - b.order)\n .map(({ groups, name, msg }) => ({ groups, name, msg })),\n }\n : undefined;\n return {\n ok,\n files,\n findings: this.findings,\n routes: this.routes,\n plays,\n ...(plan ? { plan } : {}),\n };\n }\n\n private header(ctx: LevelCtx): string[] {\n const f = this.doc.flow;\n const level = ctx.parent\n ? `, level [${ctx.parent.node.key}] ${oneLine(ctx.parent.node.title)}`\n : '';\n const lines = [\n commentLine(\n `GENERATED by Ansible Flow Designer from ../${oneLine(this.opts.source)} (flow ${oneLine(String(f.key))}, version ${oneLine(String(f.version))}${level}).`,\n ),\n '# Do not edit by hand: change the flow and save it. Option A engine (ADR-0009).',\n ];\n if (this.segment)\n lines.push(\n commentLine(\n `AWX workflow segment \"${oneLine(this.segment.seg.name)}\" (ADR-0016): the workflow runs it, with the host sets of the segment before it.`,\n ),\n );\n else if (!ctx.parent && this.todo)\n lines.push('# Unbound nodes run TODO messages: run with --check until every node is bound.');\n if (!this.segment && !ctx.parent && this.approvals.length > 0)\n lines.push(\n `# Local runs pass approvals ${this.approvals.map((k) => `[${k}]`).join(', ')} automatically; choose another outcome with -e '{\"afd_approvals\": {\"${this.approvals[0]}\": \"rejected\"}}'.`,\n );\n if (this.opts.simulate)\n lines.push('# SIMULATION build: afd_simulate sends chosen hosts down other ports.');\n if (this.opts.stubAll)\n lines.push('# SCENARIO build: every step runs as its stub; no binding runs (AFD-58).');\n return lines;\n }\n\n private finding(\n code: string,\n severity: Finding['severity'],\n message: string,\n path: Finding['path'],\n node?: Ulid,\n ): void {\n this.findings.push({ code, severity, message, path, node });\n }\n}\n\n/** Kahn's algorithm; ties keep document order. Undefined when the level has a cycle. */\nfunction topoOrder(nodes: FlowNode[], edges: Edge[]): FlowNode[] | undefined {\n const index = new Map(nodes.map((n, i) => [n.id, i]));\n const indegree = new Map(nodes.map((n) => [n.id, 0]));\n for (const e of edges) indegree.set(e.to.node, (indegree.get(e.to.node) ?? 0) + 1);\n const ready = nodes.filter((n) => indegree.get(n.id) === 0);\n const out: FlowNode[] = [];\n while (ready.length > 0) {\n ready.sort((a, b) => (index.get(a.id) ?? 0) - (index.get(b.id) ?? 0));\n const n = ready.shift() as FlowNode;\n out.push(n);\n for (const e of edges) {\n if (e.from.node !== n.id) continue;\n const left = (indegree.get(e.to.node) ?? 0) - 1;\n indegree.set(e.to.node, left);\n if (left === 0) ready.push(nodes[index.get(e.to.node) ?? 0] as FlowNode);\n }\n }\n return out.length === nodes.length ? out : undefined;\n}\n\nfunction simIn(port: string): string {\n return `inventory_hostname in afd_sim.${port} | default([])`;\n}\n\ninterface Choice {\n test: string;\n group: string;\n port: string;\n}\n\n/** AFD-186: what a step's rescue keeps of a failure, as host facts later plays can read. */\nconst FAILURE_FACTS = ['afd_failed_result', 'afd_failed_task', 'afd_failed_node'] as const;\n\n/**\n * The failure as host facts (AFD-186): every step is its own play, so the step its failed_hosts\n * lead to cannot see ansible_failed_result. Written after the routing, and never fails the rescue.\n */\nfunction failureRecord(node: FlowNode, keyPath: string): OutMap {\n return {\n name: `[${node.key}] keep the failure`,\n 'ansible.builtin.set_fact': {\n afd_failed_result: '{{ ansible_failed_result | default({}) }}',\n afd_failed_task: \"{{ ansible_failed_task.name | default('') }}\",\n afd_failed_node: keyPath,\n },\n ignore_errors: true,\n };\n}\n\nfunction route(node: FlowNode, port: string, group: string): OutMap {\n return { name: `[${node.key}] route ${port}`, 'ansible.builtin.group_by': { key: group } };\n}\n\n/** A group_by whose key picks the first matching choice, else the fallback port's group. */\nfunction choose(\n node: FlowNode,\n choices: Choice[],\n fallback: { group: string; port: string },\n): OutMap {\n if (choices.length === 0) return route(node, fallback.port, fallback.group);\n const expr = choices.reduceRight(\n (rest, c) => `'${c.group}' if ${c.test} else ${rest}`,\n `'${fallback.group}'`,\n );\n const ports = [fallback.port, ...choices.map((c) => c.port)];\n return {\n name: `[${node.key}] route ${[...new Set(ports)].join(', ')}`,\n 'ansible.builtin.group_by': { key: `{{ ${expr} }}` },\n };\n}\n\nexport const optionA: Engine = {\n id: 'option-a',\n generate: (asWritten, options) => {\n // AFD-242: disabled nodes are not generated; the path closes over them (engine/bypass).\n const doc = withoutDisabled(asWritten);\n const whole = new Generator(doc, options);\n const result = whole.run();\n if (!result.ok) return result;\n const plan = planSegments(buildModel(doc));\n if (!plan) return result;\n if (plan.problems.length > 0 || plan.segments.length === 0)\n return {\n ...result,\n findings: [\n ...result.findings,\n ...plan.problems.map((p) => ({\n code: 'codegen-segments',\n severity: 'warning' as const,\n message: `${p.message}; local and skeleton runs approve automatically`,\n path: [],\n node: p.node,\n })),\n ],\n };\n const outcome = whole.outcomeEntries();\n const files = [...result.files];\n const segments: SegmentFile[] = [];\n for (const seg of plan.segments) {\n const r = new Generator(doc, options, { seg, outcome }).segmentRun();\n const file = r.files[0];\n if (!r.ok || !file) return { ...result, findings: [...result.findings, ...r.findings] };\n files.push(file);\n segments.push({\n name: seg.name,\n file: file.name,\n gate: seg.gate,\n entry: seg.entry,\n parent: seg.parent,\n finish: seg.finish,\n });\n }\n return { ...result, files, segments };\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDO,IAAM,kBAAkB;AAa/B,IAAM,aAAa;AAoBnB,IAAM,YAAN,MAAgB;AAAA,EAoBd,YACmB,KACA,MACA,SACjB;AAHiB;AACA;AACA;AAEjB,SAAK,QAAQ,WAAW,GAAG;AAC3B,SAAK,YAAY,iBAAiB,KAAK,KAAK;AAAA,EAC9C;AAAA,EANmB;AAAA,EACA;AAAA,EACA;AAAA,EAtBF;AAAA,EACA,WAAsB,CAAC;AAAA,EACvB,SAAgC,CAAC;AAAA,EACjC,UAA0B,CAAC;AAAA,EAC3B,UAAU,oBAAI,IAAoB;AAAA,EAClC,UAAU,oBAAI,IAAuB;AAAA,EACrC,QAA8C,CAAC;AAAA,EACxD,QAAQ;AAAA,EACR,OAAO;AAAA;AAAA,EAEP,YAAsB,CAAC;AAAA;AAAA,EAEd;AAAA;AAAA,EAEA,QAAoB,CAAC;AAAA,EAC9B;AAAA;AAAA,EAEA;AAAA;AAAA,EAYA,UAAU,MAAyD;AACzE,UAAM,IAAI,YAAY,KAAK,OAAO,IAAI;AACtC,WAAO;AAAA,MACL,GAAI,EAAE,SAAS,EAAE,QAAQ,KAAc,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AAO;AAAA,YAC3B,MAAM;AAAA,YACN,UAAU;AAAA,YACV,SAAS,GAAG,EAAE,OAAO;AAAA,YACrB,MAAM,CAAC;AAAA,YACP,MAAM,EAAE;AAAA,UACV,EAAE;AAAA,QACJ;AAAA,MACF;AACF,UAAM,UAAU,MAAM,eAAe;AACrC,UAAM,QAAQ,CAAC,GAAG,OAAO,KAAK;AAC9B,UAAM,WAA0B,CAAC;AACjC,eAAW,OAAO,KAAK,UAAU;AAC/B,YAAM,IAAI,IAAI,UAAU,KAAK,SAAS,EAAE,KAAK,QAAQ,CAAC,EAAE,WAAW;AACnE,YAAM,OAAO,EAAE,MAAM,CAAC;AACtB,UAAI,CAAC,EAAE,MAAM,CAAC,KAAM,QAAO,EAAE,GAAG,QAAQ,UAAU,CAAC,GAAG,OAAO,UAAU,GAAG,EAAE,QAAQ,EAAE;AACtF,YAAM,KAAK,IAAI;AACf,eAAS,KAAK;AAAA,QACZ,MAAM,IAAI;AAAA,QACV,MAAM,KAAK;AAAA,QACX,MAAM,IAAI;AAAA,QACV,OAAO,IAAI;AAAA,QACX,QAAQ,IAAI;AAAA,QACZ,QAAQ,IAAI;AAAA,MACd,CAAC;AAAA,IACH;AACA,WAAO,EAAE,GAAG,QAAQ,OAAO,SAAS;AAAA,EACtC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rootedParams
|
|
3
|
+
} from "./chunk-OJZSZBHW.js";
|
|
1
4
|
import {
|
|
2
5
|
flow,
|
|
3
6
|
oneLine,
|
|
@@ -81,7 +84,8 @@ function bindingTask(node, impl, timeout) {
|
|
|
81
84
|
const condition = until?.trim() || (retries ? `${reg} is succeeded` : void 0);
|
|
82
85
|
return {
|
|
83
86
|
name: `[${node.key}] ${jinjaLiteral(oneLine(node.title))}`,
|
|
84
|
-
|
|
87
|
+
// AFD-291: a relative file the step reads is the repository's, not generated/'s.
|
|
88
|
+
[impl.ref]: rootedParams(impl.ref, impl.params ?? {}),
|
|
85
89
|
...Object.fromEntries(keywords),
|
|
86
90
|
register: reg,
|
|
87
91
|
ignore_unreachable: true,
|
|
@@ -184,4 +188,4 @@ export {
|
|
|
184
188
|
jinjaValue,
|
|
185
189
|
stubFacts
|
|
186
190
|
};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
191
|
+
//# sourceMappingURL=chunk-XJAMBKE3.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/core/engine/binding.ts"],
|
|
4
|
+
"sourcesContent": ["// What a bound node runs and how data reaches it (M5, ADR-0011): the module task or include_role\n// Option A emits, the play vars that pass upstream outputs in as node inputs, and set_fact\n// placeholders that let an unbound node's outputs flow through a skeleton run.\n\nimport { outputVar, registerName } from '../flow/dataNames';\nimport { resolveFrom } from '../flow/dataRefs';\nimport { ROLE_TASK_KEYWORDS, WITH } from '../flow/keywords';\nimport { rootedParams } from '../flow/localFiles';\nimport type { FlowModel } from '../flow/model';\nimport type { ContractType, FlowNode, ImplBinding } from '../flow/types';\nimport { jinjaLiteral } from './util';\nimport { flow, type Out, type OutMap, oneLine, writeBlock } from './yamlWriter';\n\n/** include_role options; every other role param becomes a role var. */\nexport const INCLUDE_OPTIONS = new Set([\n 'tasks_from',\n 'vars_from',\n 'defaults_from',\n 'handlers_from',\n 'public',\n 'allow_duplicates',\n 'rolespec_validate',\n]);\n\n/** Keywords ansible-core accepts on include_tasks itself; the others go into its apply. */\nconst INCLUDE_TASK_KEYWORDS: ReadonlySet<string> = new Set([\n 'when',\n 'loop',\n 'loop_control',\n 'vars',\n 'ignore_errors',\n 'no_log',\n 'run_once',\n 'debugger',\n]);\n\n/** A binding that runs a task file at run time (its tasks are not known to the flow). */\nexport function isIncludeTasks(ref: string | undefined): boolean {\n return /^(ansible\\.(builtin|legacy)\\.)?include_tasks$/.test(ref ?? '');\n}\n\n/** The module task or include_role of a bound node (without Option A's routing around it). */\nexport function bindingTask(node: FlowNode, impl: ImplBinding, timeout?: number | string): OutMap {\n const tag = `node_${node.id}`;\n const keywords = Object.entries(impl.keywords ?? {});\n if (impl.kind === 'role') {\n const options: OutMap = { name: impl.ref };\n const roleVars: OutMap = {};\n for (const [k, v] of Object.entries(impl.params ?? {}))\n (INCLUDE_OPTIONS.has(k) ? options : roleVars)[k] = v as Out;\n // Task keywords (AFD-26): conditions and loops stay on include_role; the rest reach every task\n // of the role through apply, as a static roles: entry would. Role variables live in params.\n const onTask: OutMap = {};\n const applied: OutMap = {};\n for (const [k, v] of keywords) {\n if (k === 'vars') continue;\n (ROLE_TASK_KEYWORDS.has(k) || WITH.test(k) ? onTask : applied)[k] = v as Out;\n }\n options.apply = { tags: flow([tag]), timeout, ...applied };\n return {\n name: `[${node.key}] Apply role`,\n 'ansible.builtin.include_role': options,\n ...onTask,\n vars: Object.keys(roleVars).length > 0 ? roleVars : undefined,\n };\n }\n const reg = registerName(node, impl);\n if (isIncludeTasks(impl.ref)) {\n // AFD-179: ansible-core refuses keywords outside its include list on include_tasks (no\n // ignore_unreachable, retries or until). Conditions, loops and vars stay on the include; the\n // rest reach every included task through apply, with the node's tag, as for a role.\n const onTask: OutMap = {};\n const applied: OutMap = {};\n for (const [k, v] of keywords)\n (INCLUDE_TASK_KEYWORDS.has(k) || WITH.test(k) ? onTask : applied)[k] = v as Out;\n const params = typeof impl.params === 'string' ? { file: impl.params } : (impl.params ?? {});\n return {\n name: `[${node.key}] ${jinjaLiteral(oneLine(node.title))}`,\n [impl.ref]: { ...(params as OutMap), apply: { tags: flow([tag]), timeout, ...applied } },\n ...onTask,\n register: reg,\n };\n }\n const { retries, delay, until } = node.settings ?? {};\n // A polling step stops when `until` holds (AFD-21); plain retries stop on the first success.\n const condition = until?.trim() || (retries ? `${reg} is succeeded` : undefined);\n return {\n name: `[${node.key}] ${jinjaLiteral(oneLine(node.title))}`,\n // AFD-291: a relative file the step reads is the repository's, not generated/'s.\n [impl.ref]: rootedParams(impl.ref, impl.params ?? {}) as Out,\n ...(Object.fromEntries(keywords) as OutMap),\n register: reg,\n ignore_unreachable: true,\n timeout,\n retries,\n delay: condition ? delay : undefined,\n until: condition,\n };\n}\n\n/** The generated task as text, for the properties view (\"Generated task\", mockup 11). */\nexport function bindingTaskText(node: FlowNode, impl: ImplBinding): string {\n if (impl.kind === 'playbook')\n return writeBlock(\n [{ import_playbook: impl.ref, vars: { afd_hosts: '<hosts arriving here>' } }],\n 0,\n ).join('\\n');\n const task = bindingTask(node, impl);\n if (impl.kind === 'module') {\n // The preview shows what the user configured; Option A adds ignore_unreachable for routing.\n delete task.ignore_unreachable;\n task.tags = flow([`node_${node.id}`]);\n }\n return writeBlock([task], 0).join('\\n');\n}\n\n/**\n * The expression a `from:` reads, and whether it is a host variable of the producing host (an\n * output) rather than an extra var. Inside a subflow, `<subflow>.<input>` follows the subflow's\n * input to where it comes from (AFD-21); an input without `from` is read by its own name.\n */\nexport function sourceExpr(\n model: FlowModel,\n node: FlowNode,\n level: string,\n from: string,\n depth = 0,\n): { expr: string; host: boolean } | undefined {\n const src = resolveFrom(model, node, level, 'inputs', from);\n switch (src.kind) {\n case 'flow':\n return { expr: [src.name, ...src.path].join('.'), host: false };\n case 'output':\n return src.name\n ? { expr: [outputVar(model, src.node, src.name), ...src.path].join('.'), host: true }\n : undefined;\n case 'subflowInput': {\n const up = src.field.from?.trim();\n const at = model.nodes.get(src.node.id)?.level;\n const inner =\n up && at && depth < 16 ? sourceExpr(model, src.node, at, up, depth + 1) : undefined;\n if (!inner) return { expr: [src.name, ...src.path].join('.'), host: false };\n return { expr: [inner.expr, ...src.path].join('.'), host: inner.host };\n }\n case 'unresolved': {\n // The validator reports it; the code reads the name, as it did before AFD-21.\n const [head, name = '', ...path] = from.split('.');\n if (src.target && name)\n return { expr: [outputVar(model, src.target, name), ...path].join('.'), host: true };\n return head === 'flow' && name ? { expr: [name, ...path].join('.'), host: false } : undefined;\n }\n default:\n return undefined;\n }\n}\n\n/**\n * Play vars for a node's inputs (05 \u00A74): `from: <key>.<output>[.path]` reads the upstream node's\n * output variable (hostvars persist across plays and imported levels in one run), `from:\n * flow.<input>` reads the extra var. Same-name references need no var (and `x: \"{{ x }}\"` would\n * recurse). `via` reads upstream outputs from another host's hostvars: a node that runs on its\n * inventory_target reads them from the first arriving host (AFD-14).\n */\nexport function inputVars(model: FlowModel, level: string, node: FlowNode, via?: string): OutMap {\n const vars: OutMap = {};\n for (const [name, field] of Object.entries(node.inputs ?? {})) {\n const from = field?.from?.trim();\n // AFD-187: an input's default is what the step gets when its source left nothing; before, the\n // checker counted it as fed while the code never saw it.\n const fallback = field?.default;\n if (!from) {\n if (fallback !== undefined) vars[name] = fallback as Out;\n continue;\n }\n const src = sourceExpr(model, node, level, from);\n const expr = src && (src.host && via ? `${via}.${src.expr}` : src.expr);\n if (!expr || expr === name) continue;\n vars[name] =\n fallback === undefined ? `{{ ${expr} }}` : `{{ ${expr} | default(${jinjaValue(fallback)}) }}`;\n }\n return vars;\n}\n\n/** A YAML value as a Jinja literal: strings quoted, null as none, lists and dicts element-wise. */\nexport function jinjaValue(value: unknown): string {\n if (value === null || value === undefined) return 'none';\n if (typeof value === 'string')\n return `'${value.replaceAll('\\\\', '\\\\\\\\').replaceAll(\"'\", \"\\\\'\")}'`;\n if (typeof value === 'number' || typeof value === 'boolean') return String(value);\n if (Array.isArray(value)) return `[${value.map(jinjaValue).join(', ')}]`;\n if (typeof value === 'object')\n return `{${Object.entries(value as Record<string, unknown>)\n .map(([k, v]) => `${jinjaValue(k)}: ${jinjaValue(v)}`)\n .join(', ')}}`;\n return 'none';\n}\n\nconst PLACEHOLDER: Record<ContractType, Out> = {\n string: 'TODO',\n integer: 0,\n boolean: false,\n list: [],\n dict: {},\n host_list: [],\n any: 'TODO',\n};\n\n/** set_fact placeholders for the outputs of an unbound node, so downstream inputs resolve. */\nexport function stubFacts(node: FlowNode): OutMap | undefined {\n const outputs = Object.entries(node.outputs ?? {});\n if (outputs.length === 0) return undefined;\n const facts: OutMap = {};\n for (const [name, field] of outputs) {\n const value = field?.default ?? PLACEHOLDER[field?.type ?? 'any'] ?? 'TODO';\n facts[name] = value as Out;\n }\n return { name: `[${node.key}] TODO outputs`, 'ansible.builtin.set_fact': facts };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAcO,IAAM,kBAAkB,oBAAI,IAAI;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,IAAM,wBAA6C,oBAAI,IAAI;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,SAAS,eAAe,KAAkC;AAC/D,SAAO,gDAAgD,KAAK,OAAO,EAAE;AACvE;AAGO,SAAS,YAAY,MAAgB,MAAmB,SAAmC;AAChG,QAAM,MAAM,QAAQ,KAAK,EAAE;AAC3B,QAAM,WAAW,OAAO,QAAQ,KAAK,YAAY,CAAC,CAAC;AACnD,MAAI,KAAK,SAAS,QAAQ;AACxB,UAAM,UAAkB,EAAE,MAAM,KAAK,IAAI;AACzC,UAAM,WAAmB,CAAC;AAC1B,eAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC;AACnD,OAAC,gBAAgB,IAAI,CAAC,IAAI,UAAU,UAAU,CAAC,IAAI;AAGrD,UAAM,SAAiB,CAAC;AACxB,UAAM,UAAkB,CAAC;AACzB,eAAW,CAAC,GAAG,CAAC,KAAK,UAAU;AAC7B,UAAI,MAAM,OAAQ;AAClB,OAAC,mBAAmB,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,SAAS,SAAS,CAAC,IAAI;AAAA,IACtE;AACA,YAAQ,QAAQ,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,QAAQ;AAC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AAO,UAAU,UAAW,QAAO,OAAO,KAAK;AAChF,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,IAAI,MAAM,IAAI,UAAU,EAAE,KAAK,IAAI,CAAC;AACrE,MAAI,OAAO,UAAU;AACnB,WAAO,IAAI,OAAO,QAAQ,KAAgC,EACvD,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,EAAE,EACpD,KAAK,IAAI,CAAC;AACf,SAAO;AACT;AAEA,IAAM,cAAyC;AAAA,EAC7C,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM,CAAC;AAAA,EACP,MAAM,CAAC;AAAA,EACP,WAAW,CAAC;AAAA,EACZ,KAAK;AACP;AAGO,SAAS,UAAU,MAAoC;AAC5D,QAAM,UAAU,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC;AACjD,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAM,QAAgB,CAAC;AACvB,aAAW,CAAC,MAAM,KAAK,KAAK,SAAS;AACnC,UAAM,QAAQ,OAAO,WAAW,YAAY,OAAO,QAAQ,KAAK,KAAK;AACrE,UAAM,IAAI,IAAI;AAAA,EAChB;AACA,SAAO,EAAE,MAAM,IAAI,KAAK,GAAG,kBAAkB,4BAA4B,MAAM;AACjF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
LAYOUT_FIX,
|
|
14
14
|
flowLayoutProblems
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TEJARYAE.js";
|
|
16
16
|
import {
|
|
17
17
|
acceptKey,
|
|
18
18
|
acceptMatches,
|
|
@@ -778,4 +778,4 @@ export {
|
|
|
778
778
|
opLabel,
|
|
779
779
|
applyOps
|
|
780
780
|
};
|
|
781
|
-
//# sourceMappingURL=chunk-
|
|
781
|
+
//# sourceMappingURL=chunk-ZXUXX3YY.js.map
|
package/dist/engine/binding.js
CHANGED
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
jinjaValue,
|
|
8
8
|
sourceExpr,
|
|
9
9
|
stubFacts
|
|
10
|
-
} from "../chunks/chunk-
|
|
10
|
+
} from "../chunks/chunk-XJAMBKE3.js";
|
|
11
|
+
import "../chunks/chunk-OJZSZBHW.js";
|
|
11
12
|
import "../chunks/chunk-56VTJ6YF.js";
|
|
13
|
+
import "../chunks/chunk-LNFMYJUJ.js";
|
|
12
14
|
import "../chunks/chunk-BAZIS67B.js";
|
|
13
15
|
import "../chunks/chunk-OEQXGULI.js";
|
|
14
16
|
import "../chunks/chunk-AJRIS5VY.js";
|
package/dist/engine/engines.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
engineFor
|
|
3
|
-
} from "../chunks/chunk-
|
|
4
|
-
import "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-CCWUUVSG.js";
|
|
4
|
+
import "../chunks/chunk-WTVGCMGV.js";
|
|
5
5
|
import "../chunks/chunk-OEEHAY5X.js";
|
|
6
6
|
import "../chunks/chunk-LPBLGBDT.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-XJAMBKE3.js";
|
|
8
|
+
import "../chunks/chunk-OJZSZBHW.js";
|
|
8
9
|
import "../chunks/chunk-ARA3VJR2.js";
|
|
9
10
|
import "../chunks/chunk-56VTJ6YF.js";
|
|
11
|
+
import "../chunks/chunk-LNFMYJUJ.js";
|
|
10
12
|
import "../chunks/chunk-BAZIS67B.js";
|
|
11
13
|
import "../chunks/chunk-X3DEH47B.js";
|
|
12
14
|
import "../chunks/chunk-TOTSB4HG.js";
|
package/dist/engine/files.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GENERATED_MARK,
|
|
3
3
|
generatedState
|
|
4
|
-
} from "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-APBEHKCF.js";
|
|
5
|
+
import "../chunks/chunk-WTVGCMGV.js";
|
|
6
6
|
import "../chunks/chunk-OEEHAY5X.js";
|
|
7
7
|
import "../chunks/chunk-LPBLGBDT.js";
|
|
8
|
-
import "../chunks/chunk-
|
|
8
|
+
import "../chunks/chunk-XJAMBKE3.js";
|
|
9
|
+
import "../chunks/chunk-OJZSZBHW.js";
|
|
9
10
|
import "../chunks/chunk-ARA3VJR2.js";
|
|
10
11
|
import "../chunks/chunk-56VTJ6YF.js";
|
|
12
|
+
import "../chunks/chunk-LNFMYJUJ.js";
|
|
11
13
|
import "../chunks/chunk-BAZIS67B.js";
|
|
12
14
|
import "../chunks/chunk-X3DEH47B.js";
|
|
13
15
|
import "../chunks/chunk-TOTSB4HG.js";
|
package/dist/engine/optionA.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CHECKSUM_PREFIX,
|
|
3
3
|
optionA
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-WTVGCMGV.js";
|
|
5
5
|
import "../chunks/chunk-OEEHAY5X.js";
|
|
6
6
|
import "../chunks/chunk-LPBLGBDT.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-XJAMBKE3.js";
|
|
8
|
+
import "../chunks/chunk-OJZSZBHW.js";
|
|
8
9
|
import "../chunks/chunk-ARA3VJR2.js";
|
|
9
10
|
import "../chunks/chunk-56VTJ6YF.js";
|
|
11
|
+
import "../chunks/chunk-LNFMYJUJ.js";
|
|
10
12
|
import "../chunks/chunk-BAZIS67B.js";
|
|
11
13
|
import "../chunks/chunk-X3DEH47B.js";
|
|
12
14
|
import "../chunks/chunk-TOTSB4HG.js";
|
package/dist/engine/preview.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
engineFor
|
|
3
|
-
} from "../chunks/chunk-
|
|
4
|
-
import "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-CCWUUVSG.js";
|
|
4
|
+
import "../chunks/chunk-WTVGCMGV.js";
|
|
5
5
|
import "../chunks/chunk-OEEHAY5X.js";
|
|
6
6
|
import "../chunks/chunk-LPBLGBDT.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-XJAMBKE3.js";
|
|
8
|
+
import "../chunks/chunk-OJZSZBHW.js";
|
|
8
9
|
import "../chunks/chunk-ARA3VJR2.js";
|
|
9
10
|
import "../chunks/chunk-56VTJ6YF.js";
|
|
11
|
+
import "../chunks/chunk-LNFMYJUJ.js";
|
|
10
12
|
import "../chunks/chunk-BAZIS67B.js";
|
|
11
13
|
import "../chunks/chunk-X3DEH47B.js";
|
|
12
14
|
import "../chunks/chunk-TOTSB4HG.js";
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/core/engine/preview.ts"],
|
|
4
4
|
"sourcesContent": ["// What a node compiles to, for the inspector (mockup 03), plus the engine's findings for the canvas.\nimport type { FlowDocument, Ulid } from '../flow/types';\nimport type { Finding } from '../flow/validate';\nimport { engineFor } from './engines';\n\nexport interface CodePreview {\n /** Generated play text per node (its own lines from its level file). */\n plays: Record<Ulid, string>;\n /** Engine findings the validator does not already report. */\n findings: Finding[];\n}\n\nexport function codePreview(doc: FlowDocument, source: string): CodePreview {\n const result = engineFor(doc).generate(doc, { source });\n const plays: Record<Ulid, string> = {};\n for (const [node, range] of Object.entries(result.plays)) {\n const file = result.files.find((f) => f.name === range.file);\n if (file) plays[node] = file.text.split('\\n').slice(range.start, range.end).join('\\n');\n }\n return {\n plays,\n findings: result.findings.filter((f) => f.code !== 'codegen-no-targets'),\n };\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYO,SAAS,YAAY,KAAmB,QAA6B;AAC1E,QAAM,SAAS,UAAU,GAAG,EAAE,SAAS,KAAK,EAAE,OAAO,CAAC;AACtD,QAAM,QAA8B,CAAC;AACrC,aAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACxD,UAAM,OAAO,OAAO,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,IAAI;AAC3D,QAAI,KAAM,OAAM,IAAI,IAAI,KAAK,KAAK,MAAM,IAAI,EAAE,MAAM,MAAM,OAAO,MAAM,GAAG,EAAE,KAAK,IAAI;AAAA,EACvF;AACA,SAAO;AAAA,IACL;AAAA,IACA,UAAU,OAAO,SAAS,OAAO,CAAC,MAAM,EAAE,SAAS,oBAAoB;AAAA,EACzE;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/engine/writePlan.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
planGenerated
|
|
3
|
-
} from "../chunks/chunk-
|
|
4
|
-
import "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-7ALTNZCI.js";
|
|
4
|
+
import "../chunks/chunk-CCWUUVSG.js";
|
|
5
|
+
import "../chunks/chunk-APBEHKCF.js";
|
|
6
|
+
import "../chunks/chunk-WTVGCMGV.js";
|
|
7
7
|
import "../chunks/chunk-OEEHAY5X.js";
|
|
8
8
|
import "../chunks/chunk-LPBLGBDT.js";
|
|
9
|
-
import "../chunks/chunk-
|
|
9
|
+
import "../chunks/chunk-XJAMBKE3.js";
|
|
10
|
+
import "../chunks/chunk-OJZSZBHW.js";
|
|
10
11
|
import "../chunks/chunk-ARA3VJR2.js";
|
|
11
12
|
import "../chunks/chunk-56VTJ6YF.js";
|
|
13
|
+
import "../chunks/chunk-LNFMYJUJ.js";
|
|
12
14
|
import "../chunks/chunk-BAZIS67B.js";
|
|
13
15
|
import "../chunks/chunk-X3DEH47B.js";
|
|
14
16
|
import "../chunks/chunk-TOTSB4HG.js";
|
package/dist/export/drawio.js
CHANGED
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
shiftOf,
|
|
10
10
|
toDrawio,
|
|
11
11
|
toneColour
|
|
12
|
-
} from "../chunks/chunk-
|
|
12
|
+
} from "../chunks/chunk-OW32YCZ6.js";
|
|
13
13
|
import "../chunks/chunk-YNEJJZMA.js";
|
|
14
14
|
import "../chunks/chunk-AXSX5DJE.js";
|
|
15
15
|
import "../chunks/chunk-X3DEH47B.js";
|
|
16
|
-
import "../chunks/chunk-
|
|
17
|
-
import "../chunks/chunk-
|
|
16
|
+
import "../chunks/chunk-KXD6FX2Z.js";
|
|
17
|
+
import "../chunks/chunk-LELKMVJG.js";
|
|
18
18
|
import "../chunks/chunk-X4UNEUME.js";
|
|
19
19
|
import "../chunks/chunk-RLCV7OFW.js";
|
|
20
20
|
import "../chunks/chunk-OY4PP6RF.js";
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
LAYOUT_FIX,
|
|
3
3
|
flowLayoutProblems,
|
|
4
4
|
layoutProblems
|
|
5
|
-
} from "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-TEJARYAE.js";
|
|
6
6
|
import "../chunks/chunk-SD6TCN3P.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
8
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-KXD6FX2Z.js";
|
|
8
|
+
import "../chunks/chunk-LELKMVJG.js";
|
|
9
9
|
import "../chunks/chunk-X4UNEUME.js";
|
|
10
10
|
import "../chunks/chunk-RLCV7OFW.js";
|
|
11
11
|
import "../chunks/chunk-KSM4O2XL.js";
|
package/dist/export/scene.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
levelSuffix,
|
|
3
3
|
portCentre,
|
|
4
4
|
scenesOf
|
|
5
|
-
} from "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-KXD6FX2Z.js";
|
|
6
|
+
import "../chunks/chunk-LELKMVJG.js";
|
|
7
7
|
import "../chunks/chunk-X4UNEUME.js";
|
|
8
8
|
import "../chunks/chunk-OY4PP6RF.js";
|
|
9
9
|
import "../chunks/chunk-TS4N2EIO.js";
|
package/dist/export/svg.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sceneSvg,
|
|
3
3
|
toSvg
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-37FKZNRN.js";
|
|
5
5
|
import "../chunks/chunk-JWYLAANO.js";
|
|
6
6
|
import "../chunks/chunk-NCPIAK5Y.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-OW32YCZ6.js";
|
|
8
8
|
import "../chunks/chunk-YNEJJZMA.js";
|
|
9
9
|
import "../chunks/chunk-AXSX5DJE.js";
|
|
10
10
|
import "../chunks/chunk-X3DEH47B.js";
|
|
11
|
-
import "../chunks/chunk-
|
|
12
|
-
import "../chunks/chunk-
|
|
11
|
+
import "../chunks/chunk-KXD6FX2Z.js";
|
|
12
|
+
import "../chunks/chunk-LELKMVJG.js";
|
|
13
13
|
import "../chunks/chunk-X4UNEUME.js";
|
|
14
14
|
import "../chunks/chunk-RLCV7OFW.js";
|
|
15
15
|
import "../chunks/chunk-OY4PP6RF.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Modules that read a local file, the parameter naming it and the subfolder Ansible looks in. */
|
|
2
|
+
export declare const LOCAL_FILES: Record<string, {
|
|
3
|
+
param: string;
|
|
4
|
+
sub: string;
|
|
5
|
+
}>;
|
|
6
|
+
/** The variable generated plays set to the repository root. */
|
|
7
|
+
export declare const REPO_ROOT_VAR = "afd_repo_root";
|
|
8
|
+
/**
|
|
9
|
+
* The repository file a module step names by a relative path, as written; undefined when it names
|
|
10
|
+
* none (another module, a remote source, an absolute or templated path).
|
|
11
|
+
*/
|
|
12
|
+
export declare function localFileOf(module: string, params: unknown): {
|
|
13
|
+
param: string;
|
|
14
|
+
path: string;
|
|
15
|
+
} | undefined;
|
|
16
|
+
/** The params with a relative repository file written from `{{ afd_repo_root }}`. */
|
|
17
|
+
export declare function rootedParams(module: string, params: unknown): unknown;
|