@pipelex/mthds-ui 0.59.0 → 0.60.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.
Files changed (50) hide show
  1. package/dist/{chunk-S4UMMHLE.js → chunk-43NAVRQK.js} +17 -2
  2. package/dist/chunk-43NAVRQK.js.map +1 -0
  3. package/dist/{chunk-6KWNAU4F.js → chunk-BQZ3BPJM.js} +13 -1
  4. package/dist/chunk-BQZ3BPJM.js.map +1 -0
  5. package/dist/{chunk-XMTXWXFO.js → chunk-KKT6OVO6.js} +3 -3
  6. package/dist/{chunk-5N3MP5TD.js → chunk-PWKNMKFA.js} +106 -35
  7. package/dist/chunk-PWKNMKFA.js.map +1 -0
  8. package/dist/{chunk-ZRSFFUHA.js → chunk-S36KN6CG.js} +3 -3
  9. package/dist/chunk-UVEGKTBU.js +600 -0
  10. package/dist/chunk-UVEGKTBU.js.map +1 -0
  11. package/dist/{chunk-7QUQJW6Q.js → chunk-YQJNKQWO.js} +91 -285
  12. package/dist/chunk-YQJNKQWO.js.map +1 -0
  13. package/dist/form/react/index.d.ts +1 -1
  14. package/dist/form/react/index.js +2 -2
  15. package/dist/graph/index.d.ts +48 -21
  16. package/dist/graph/index.js +61 -21
  17. package/dist/graph/react/detail/DetailPanel.css +49 -0
  18. package/dist/graph/react/graph-core.css +20 -0
  19. package/dist/graph/react/index.d.ts +2 -2
  20. package/dist/graph/react/index.js +92 -29
  21. package/dist/graph/react/index.js.map +1 -1
  22. package/dist/graph/react/styles/simple/SimpleDetailPanel.css +20 -0
  23. package/dist/graph/react/styles/simple/SimpleStyle.css +13 -0
  24. package/dist/index.d.ts +3 -2
  25. package/dist/index.js +61 -21
  26. package/dist/methodWords-DIEg1PVT.d.ts +180 -0
  27. package/dist/{registryJoin-CMfBspIs.d.ts → registryJoin-Cj1mIkqe.d.ts} +18 -10
  28. package/dist/standalone/graph-standalone.html +232 -130
  29. package/dist/standalone/graph-viewer.css +102 -0
  30. package/dist/standalone/graph-viewer.js +130 -130
  31. package/dist/static-graph/index.d.ts +1 -1
  32. package/dist/static-graph/index.js +33 -12
  33. package/dist/static-graph/index.js.map +1 -1
  34. package/dist/timeline/index.d.ts +42 -7
  35. package/dist/timeline/index.js +8 -3
  36. package/dist/timeline/react/RunTimeline.css +18 -0
  37. package/dist/timeline/react/index.d.ts +3 -2
  38. package/dist/timeline/react/index.js +20 -11
  39. package/dist/timeline/react/index.js.map +1 -1
  40. package/dist/timeline/react/styles/simple/SimpleProgress.css +25 -0
  41. package/dist/{types-CnDJyLYo.d.ts → types-BygAt1Si.d.ts} +51 -1
  42. package/package.json +2 -2
  43. package/dist/chunk-5N3MP5TD.js.map +0 -1
  44. package/dist/chunk-6KWNAU4F.js.map +0 -1
  45. package/dist/chunk-7QUQJW6Q.js.map +0 -1
  46. package/dist/chunk-P6IGZVWE.js +0 -155
  47. package/dist/chunk-P6IGZVWE.js.map +0 -1
  48. package/dist/chunk-S4UMMHLE.js.map +0 -1
  49. /package/dist/{chunk-XMTXWXFO.js.map → chunk-KKT6OVO6.js.map} +0 -0
  50. /package/dist/{chunk-ZRSFFUHA.js.map → chunk-S36KN6CG.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/graphAnalysis.ts","../src/graph/styles/humanize.ts","../src/graph/styles/nativeConcepts.ts","../src/graph/styles/methodWords.ts"],"sourcesContent":["import type {\n GraphSpec,\n GraphSpecNode,\n DataflowAnalysis,\n PipeBlueprintUnion,\n ConceptInfo,\n StuffRegistryEntry,\n} from \"./types\";\nimport { isBindingNode } from \"./types\";\nimport { makePipeRef } from \"./pipeRefs\";\n\nexport function buildDataflowAnalysis(graphspec: GraphSpec | null): DataflowAnalysis | null {\n if (!graphspec) return null;\n\n const stuffRegistry: Record<string, StuffRegistryEntry> = {};\n const stuffProducers: Record<string, string[]> = {};\n const stuffConsumers: Record<string, string[]> = {};\n const containmentTree: Record<string, string[]> = {};\n const childNodeIds = new Set<string>();\n\n // Build containment tree from edges\n for (const edge of graphspec.edges) {\n if (edge.kind === \"contains\") {\n if (!containmentTree[edge.source]) containmentTree[edge.source] = [];\n containmentTree[edge.source].push(edge.target);\n childNodeIds.add(edge.target);\n }\n }\n\n // Controller IDs are nodes that have children\n const controllerNodeIds = new Set<string>(Object.keys(containmentTree));\n\n // Register stuffs from all nodes; track producers/consumers from operators only\n for (const node of graphspec.nodes) {\n const nodeIo = node.io;\n const isController = controllerNodeIds.has(node.id);\n\n // Register outputs\n for (const output of nodeIo.outputs) {\n if (output.digest && !stuffRegistry[output.digest]) {\n stuffRegistry[output.digest] = {\n name: output.name,\n concept: output.concept,\n multiplicity: output.multiplicity,\n contentType: output.content_type,\n };\n }\n if (output.digest && !isController) {\n if (!stuffProducers[output.digest]) stuffProducers[output.digest] = [];\n stuffProducers[output.digest].push(node.id);\n }\n }\n\n // Register inputs\n for (const input of nodeIo.inputs) {\n if (input.digest && !stuffRegistry[input.digest]) {\n stuffRegistry[input.digest] = {\n name: input.name,\n concept: input.concept,\n multiplicity: input.multiplicity,\n contentType: input.content_type,\n };\n }\n if (input.digest && !isController) {\n if (!stuffConsumers[input.digest]) stuffConsumers[input.digest] = [];\n stuffConsumers[input.digest].push(node.id);\n }\n }\n }\n\n return {\n stuffRegistry,\n stuffProducers,\n stuffConsumers,\n controllerNodeIds,\n childNodeIds,\n containmentTree,\n };\n}\n\n/**\n * Build a map from node id -> controller id for all nodes that belong to a controller.\n * Includes both direct children (operators) and stuff nodes assigned to controllers.\n *\n * Stuff nodes are placed at the lowest controller level where they connect producers\n * to consumers. A stuff node produced inside controller C is promoted to C's parent\n * if none of its consumers are inside C (output flows outward).\n */\nexport function buildChildToControllerMap(\n graphspec: GraphSpec,\n analysis: DataflowAnalysis,\n): Record<string, string> {\n const childToController: Record<string, string> = {};\n\n // Direct children from containment tree\n for (const [ctrlId, children] of Object.entries(analysis.containmentTree)) {\n for (const childId of children) {\n childToController[childId] = ctrlId;\n }\n }\n\n // Stuff nodes produced by operators inside controllers. A stuff with several\n // producers (a condition's output, one per outcome) starts in the deepest\n // controller holding all of them, so no outcome's edge has to leave its group\n // to reach it.\n for (const [digest, producerIds] of Object.entries(analysis.stuffProducers)) {\n const stuffId = \"stuff_\" + digest;\n const ctrlId = commonController(producerIds, childToController);\n if (ctrlId) {\n childToController[stuffId] = ctrlId;\n }\n }\n\n // Stuff produced by controllers themselves -> assign to parent controller\n for (const node of graphspec.nodes) {\n if (!analysis.controllerNodeIds.has(node.id)) continue;\n const parentCtrlId = childToController[node.id];\n if (!parentCtrlId) continue;\n for (const output of node.io.outputs) {\n if (!output.digest) continue;\n const stuffId = \"stuff_\" + output.digest;\n if (!childToController[stuffId]) {\n childToController[stuffId] = parentCtrlId;\n }\n }\n }\n\n // Batch item stuff (fan-out) -> assign to the PipeBatch controller\n for (const edge of graphspec.edges) {\n if (edge.kind === \"batch_item\" && edge.target_stuff_digest) {\n const stuffId = \"stuff_\" + edge.target_stuff_digest;\n // edge.source is the PipeBatch controller node\n if (analysis.controllerNodeIds.has(edge.source)) {\n childToController[stuffId] = edge.source;\n }\n }\n }\n\n // ─── Promote stuff nodes whose consumers are all outside their controller ──\n // Stuff involved in stuff-to-stuff edges (batch/parallel) should not be promoted\n // when they have no operator consumers — they're intermediate batch/parallel data.\n const stuffInStuffEdges = new Set<string>();\n for (const edge of graphspec.edges) {\n if (\n edge.kind === \"batch_item\" ||\n edge.kind === \"batch_aggregate\" ||\n edge.kind === \"parallel_combine\"\n ) {\n if (edge.source_stuff_digest) stuffInStuffEdges.add(edge.source_stuff_digest);\n if (edge.target_stuff_digest) stuffInStuffEdges.add(edge.target_stuff_digest);\n }\n }\n\n const stuffPrefix = \"stuff_\";\n const stuffEntries = Object.keys(childToController).filter((id) => id.startsWith(stuffPrefix));\n\n for (const stuffId of stuffEntries) {\n const digest = stuffId.slice(stuffPrefix.length);\n let assignedCtrl: string | undefined = childToController[stuffId];\n if (!assignedCtrl) continue;\n\n const consumers = analysis.stuffConsumers[digest] || [];\n\n if (consumers.length === 0) {\n // No operator consumers — promote to root only if this is a pure final output\n // (not involved in batch/parallel stuff-to-stuff edges)\n if (!stuffInStuffEdges.has(digest)) {\n delete childToController[stuffId];\n }\n continue;\n }\n\n // Has consumers — promote until we find a level where at least one consumer is inside\n while (assignedCtrl) {\n const ctrl = assignedCtrl;\n const hasConsumerInside = consumers.some((consumerId) =>\n isDescendantOf(consumerId, ctrl, childToController),\n );\n if (hasConsumerInside) break;\n\n const parentCtrl: string | undefined = childToController[assignedCtrl];\n if (parentCtrl) {\n childToController[stuffId] = parentCtrl;\n assignedCtrl = parentCtrl;\n } else {\n delete childToController[stuffId];\n assignedCtrl = undefined;\n }\n }\n }\n\n return childToController;\n}\n\n/** The deepest controller every one of these nodes sits inside, or undefined at the root. */\nfunction commonController(\n nodeIds: readonly string[],\n childToController: Record<string, string>,\n): string | undefined {\n if (nodeIds.length === 0) return undefined;\n let candidate: string | undefined = childToController[nodeIds[0]];\n while (candidate) {\n const ctrl: string = candidate;\n if (nodeIds.every((id) => isDescendantOf(id, ctrl, childToController))) return ctrl;\n candidate = childToController[ctrl];\n }\n return undefined;\n}\n\n/** Check if nodeId is a descendant of ancestorCtrlId in the containment hierarchy. */\nfunction isDescendantOf(\n nodeId: string,\n ancestorCtrlId: string,\n childToController: Record<string, string>,\n): boolean {\n let current = childToController[nodeId];\n while (current) {\n if (current === ancestorCtrlId) return true;\n current = childToController[current];\n }\n return false;\n}\n\n// ─── Registry lookup helpers ───────────────────────────────────────────────\n\nexport function getPipeBlueprint(spec: GraphSpec, pipeRef: string): PipeBlueprintUnion | undefined {\n return spec.pipe_registry?.[pipeRef];\n}\n\n/**\n * The blueprint of the pipe a node runs, or nothing when the registry cannot say\n * which one it is. The one lookup the card and the detail panel share, so the two\n * never disagree about a node's blueprint.\n *\n * 1. A node carrying its domain resolves by its qualified ref and by nothing\n * else: two domains may declare the same code, and a node in domain `b` must\n * never be shown domain `a`'s pipe because `a` is the method's main domain.\n * 2. A node without one resolves in the pipeline's domain.\n * 3. Failing that, by a registry key ending in `.<pipe_code>`, accepted only when\n * exactly one key matches: with two, the code alone does not say which.\n *\n * A binding node has no blueprint: its `pipe_code` is the path it binds, and a\n * path spelled like a pipe's code would otherwise pick up that pipe.\n */\nexport function resolveNodeBlueprint(\n spec: GraphSpec,\n node: GraphSpecNode,\n): PipeBlueprintUnion | undefined {\n const registry = spec.pipe_registry;\n if (!registry || isBindingNode(node) || !node.pipe_code) return undefined;\n if (node.domain_code) return registry[makePipeRef(node.domain_code, node.pipe_code)];\n\n const pipelineDomain = spec.pipeline_ref?.domain;\n if (pipelineDomain) {\n const inPipelineDomain = registry[makePipeRef(pipelineDomain, node.pipe_code)];\n if (inPipelineDomain) return inPipelineDomain;\n }\n\n const suffix = `.${node.pipe_code}`;\n const matches = Object.keys(registry).filter((ref) => ref.endsWith(suffix));\n return matches.length === 1 ? registry[matches[0]] : undefined;\n}\n\nexport function getConceptInfo(spec: GraphSpec, conceptRef: string): ConceptInfo | undefined {\n return spec.concept_registry?.[conceptRef];\n}\n\nexport function resolveConceptRef(spec: GraphSpec, codeOrRef: string): ConceptInfo | undefined {\n if (!spec.concept_registry) return undefined;\n // Direct lookup first (e.g., \"test_domain.Summary\")\n const direct = spec.concept_registry[codeOrRef];\n if (direct) return direct;\n // Search by code (e.g., \"Summary\" matches \"test_domain.Summary\")\n for (const info of Object.values(spec.concept_registry)) {\n if (info.code === codeOrRef) return info;\n }\n return undefined;\n}\n","// Plain words from identifiers: the simple style's fallback when a method\n// declares nothing better. Pure, deterministic and tested — never a stand-in\n// for an authored description, and never a guess at meaning: an identifier is\n// split, cased and spelled, nothing more.\n\n/**\n * Words spelled as acronyms although they hold a vowel. A word with no vowel at\n * all (`cv`, `pdf`, `rfp`, `html`) is spelled as an acronym without being\n * listed, unless it is one of the `VOWELLESS_WORDS`.\n */\nconst VOWELED_ACRONYMS: ReadonlySet<string> = new Set([\n \"ai\",\n \"api\",\n \"faq\",\n \"iban\",\n \"id\",\n \"io\",\n \"ip\",\n \"json\",\n \"kpi\",\n \"ocr\",\n \"roi\",\n \"seo\",\n \"ui\",\n \"uri\",\n \"url\",\n \"uuid\",\n \"ux\",\n]);\n\nconst VOWELS = /[aeiouy]/;\n\n/**\n * Words with no vowel that are written in lowercase rather than spelled out:\n * abbreviations, units and ordinal suffixes found in identifiers (`weight_kg`\n * is \"Weight kg\", `nth_item` is \"Nth item\"). A plural is covered by its\n * singular (`hrs` by `hr`).\n */\nconst VOWELLESS_WORDS: ReadonlySet<string> = new Set([\n \"cfg\",\n \"cm\",\n \"cnt\",\n \"ctx\",\n \"dr\",\n \"dst\",\n \"fn\",\n \"ft\",\n \"hmm\",\n \"hr\",\n \"kg\",\n \"km\",\n \"lb\",\n \"mg\",\n \"ml\",\n \"mm\",\n \"mr\",\n \"mrs\",\n \"ms\",\n \"msg\",\n \"nd\",\n \"nth\",\n \"pkg\",\n \"pt\",\n \"rd\",\n \"src\",\n \"st\",\n \"th\",\n \"tmp\",\n \"vs\",\n]);\n\n/** Vowelless acronyms that end in `s` without being plurals (`css` is not two `cs`). */\nconst SINGULAR_S_ACRONYMS: ReadonlySet<string> = new Set([\n \"cms\",\n \"css\",\n \"dns\",\n \"gps\",\n \"rss\",\n \"sms\",\n]);\n\n/**\n * The plain names of the natives whose code does not read as words once split\n * (`YesNo` is not \"Yes no\"). Every other native reads well humanized.\n */\nconst NATIVE_PLAIN_NAMES: Readonly<Record<string, string>> = {\n Html: \"HTML\",\n JSON: \"JSON\",\n TextAndImages: \"Text and images\",\n YesNo: \"Yes or no\",\n SearchResult: \"Search result\",\n Composite: \"Combined results\",\n Dynamic: \"Data\",\n};\n\n/**\n * Natives that say what kind of value something is without saying what it is:\n * a final output of one of these is named by its variable, not its concept.\n */\nconst GENERIC_NATIVES: ReadonlySet<string> = new Set([\"Anything\", \"Dynamic\", \"Composite\"]);\n\nfunction isAcronymWord(lower: string): boolean {\n if (lower.length < 2 || !/^[a-z]+$/.test(lower)) return false;\n if (VOWELLESS_WORDS.has(lower)) return false;\n if (lower.endsWith(\"s\") && VOWELLESS_WORDS.has(lower.slice(0, -1))) return false;\n return !VOWELS.test(lower) || VOWELED_ACRONYMS.has(lower);\n}\n\n/** Spell one lowercase word: an acronym in capitals (a plural keeps its `s`), anything else as is. */\nfunction spellWord(lower: string, wasAllCaps: boolean): string {\n if (/^\\d+$/.test(lower)) return lower;\n if (wasAllCaps && lower.length >= 2) return lower.toUpperCase();\n // A plural acronym keeps its lowercase `s`: `cvs` is \"CVs\", not \"CVS\".\n if (lower.endsWith(\"s\") && !SINGULAR_S_ACRONYMS.has(lower) && isAcronymWord(lower.slice(0, -1))) {\n return lower.slice(0, -1).toUpperCase() + \"s\";\n }\n if (isAcronymWord(lower)) return lower.toUpperCase();\n return lower;\n}\n\n/**\n * Split an identifier into its words: on `_`, `-`, `.` and spaces, and at the\n * case boundaries of camel and Pascal case, keeping a run of capitals together\n * (`PDFDocument` is `PDF` and `Document`).\n */\nfunction splitIdentifier(identifier: string): { word: string; wasAllCaps: boolean }[] {\n const parts = identifier\n .replace(/([a-z\\d])([A-Z])/g, \"$1 $2\")\n .replace(/([A-Z]+)([A-Z][a-z])/g, \"$1 $2\")\n .replace(/([A-Za-z])(\\d)/g, \"$1 $2\")\n .split(/[\\s_\\-.]+/)\n .filter((p) => p.length > 0);\n return parts.map((p) => ({\n word: p.toLowerCase(),\n wasAllCaps: p.length >= 2 && p === p.toUpperCase() && /[A-Z]/.test(p),\n }));\n}\n\n/** Capitalize the first letter, leaving the rest as written. */\nfunction capitalizeFirst(text: string): string {\n return text.length === 0 ? text : text.charAt(0).toUpperCase() + text.slice(1);\n}\n\n/** The last segment of a dotted ref: the code without its domain (`recruitment.CandidateProfile` → `CandidateProfile`). */\nexport function stripDomain(ref: string): string {\n const dot = ref.lastIndexOf(\".\");\n return dot === -1 ? ref : ref.slice(dot + 1);\n}\n\n/**\n * An identifier as words in sentence case: `job_offer` → \"Job offer\",\n * `CandidateProfile` → \"Candidate profile\", `pr_url` → \"PR URL\",\n * `cvs` → \"CVs\". A dotted ref is humanized by its last segment.\n */\nexport function humanizeIdentifier(identifier: string): string {\n const words = splitIdentifier(stripDomain(identifier.trim()));\n if (words.length === 0) return \"\";\n return capitalizeFirst(words.map((w) => spellWord(w.word, w.wasAllCaps)).join(\" \"));\n}\n\n/** A concept's plain name, from its code or ref: a native's own plain name, or the humanized code. */\nexport function conceptPlainName(conceptRef: string): string {\n const code = stripDomain(conceptRef.trim());\n return NATIVE_PLAIN_NAMES[code] ?? humanizeIdentifier(code);\n}\n\n/** Whether a concept is a native that names no particular kind of content (`Anything`, `Dynamic`, `Composite`). */\nexport function isGenericConcept(conceptRef: string): boolean {\n return GENERIC_NATIVES.has(stripDomain(conceptRef.trim()));\n}\n\n/**\n * Authored text as a title: whitespace collapsed (descriptions are often\n * written across lines), the first letter capitalized, and a single closing\n * period dropped, since a label in a box reads as a heading. Nothing else is\n * touched: the words are the author's.\n */\nexport function sentenceCase(text: string): string {\n const collapsed = text.replace(/\\s+/g, \" \").trim();\n const trimmed =\n collapsed.endsWith(\".\") && !collapsed.endsWith(\"..\") ? collapsed.slice(0, -1) : collapsed;\n return capitalizeFirst(trimmed);\n}\n\n/**\n * An identifier as words inside a sentence: `humanizeIdentifier`'s words with\n * their first letter in lower case, unless the first word is an acronym\n * (`filing` → \"filing\", `cv_file` → \"CV file\").\n */\nexport function humanizeInSentence(identifier: string): string {\n return wordsInSentence(humanizeIdentifier(identifier));\n}\n\n/**\n * Words in sentence case moved inside a sentence: the first letter in lower\n * case, unless the first word is an acronym (\"High risk\" → \"high risk\", \"PDF\n * file\" stays \"PDF file\").\n */\nexport function wordsInSentence(words: string): string {\n const first = words.split(\" \")[0] ?? \"\";\n return first.length >= 2 && first === first.toUpperCase()\n ? words\n : words.charAt(0).toLowerCase() + words.slice(1);\n}\n\n/** The outcome keys that read better as other words: a yes-or-no test's. */\nconst OUTCOME_KEY_WORDS: Readonly<Record<string, string>> = {\n true: \"Yes\",\n false: \"No\",\n};\n\n/**\n * One key of a condition's outcome map in plain words: `high_priority` →\n * \"High priority\", a yes-or-no test's `true` and `false` → \"Yes\" and \"No\". A\n * key is always the method's own outcome, so one the method names `default`\n * reads \"Default\", never the default outcome's \"Otherwise\".\n */\nexport function outcomeKeyLabel(key: string): string {\n return OUTCOME_KEY_WORDS[key.toLowerCase()] ?? humanizeIdentifier(key);\n}\n","// What the styles know of the concepts the standard defines, the natives, as a\n// spec's concept registry records them. Internal to the styles: the module is\n// not re-exported from the graph entry.\n//\n// Pure and React-free.\n\nimport type { ConceptInfo, GraphSpec } from \"@graph/types\";\nimport { resolveConceptRef } from \"@graph/graphAnalysis\";\nimport { stripDomain } from \"./humanize\";\n\n/** The domain of the concepts the standard defines, as a spec's concept registry records them. */\nexport const NATIVE_DOMAIN = \"native\";\n\n/**\n * The natives whose value may live in storage: a text (and a Markdown text,\n * which refines it), an HTML fragment and a JSON object. Such a value travels\n * either inline or as a reference to where it is stored, so its schema carries\n * both forms side by side.\n */\nconst STORED_VALUE_NATIVES: ReadonlySet<string> = new Set([\"Text\", \"Markdown\", \"Html\", \"JSON\"]);\n\n/**\n * The members of a stored-value native's referenced form: where the value is\n * stored and three facts describing it without reading it. They say how the\n * runtime carries the value, never what the value is.\n */\nexport const STORED_VALUE_REFERENCE_MEMBERS: ReadonlySet<string> = new Set([\n \"url\",\n \"size\",\n \"mime_type\",\n \"preview\",\n]);\n\n/**\n * Whether a concept is a native whose value may live in storage (`Text`,\n * `Markdown`, `Html`, `JSON`), or refines one through any chain of refinements,\n * as a method's `Report` refining `Text` does. A concept with a structure of its\n * own is never one: the standard lets a concept refine or declare a structure,\n * not both, so a method's own field called `url` is never mistaken for a\n * stored value's reference.\n */\nexport function isStoredValueConcept(graphspec: GraphSpec, concept: ConceptInfo): boolean {\n const seen = new Set<ConceptInfo>();\n let current: ConceptInfo | undefined = concept;\n while (current && !seen.has(current)) {\n seen.add(current);\n if (current.domain_code === NATIVE_DOMAIN) return STORED_VALUE_NATIVES.has(current.code);\n const parent = current.refines;\n if (!parent) return false;\n const resolved = resolveConceptRef(graphspec, parent);\n if (!resolved) {\n // The registry lists only the concepts the run met, so a refined native\n // may be missing from it: its ref still names it.\n return (\n parent.startsWith(`${NATIVE_DOMAIN}.`) && STORED_VALUE_NATIVES.has(stripDomain(parent))\n );\n }\n current = resolved;\n }\n return false;\n}\n","// The words a method gives the person who runs it, read the same way by the\n// graph's simple style and by the run timeline's simple style:\n//\n// - a step's wording: its `activity` (\"Reading the NDA\"), else its\n// description, else its humanized code (MTHDS, \"What a Run Shows\");\n// - a condition's outcome words: the label, description and tone an outcome\n// table carries (MTHDS, \"Outcome Labels\");\n// - which steps are plumbing, hidden from a view of a run by their pipe type.\n//\n// Pure and React-free.\n\nimport type {\n ConceptInfo,\n OutcomeTone,\n OutcomeWords,\n PipeBlueprintUnion,\n PipeConditionBlueprint,\n StuffSpecInfo,\n} from \"@graph/types\";\nimport type { NodePipeType } from \"@graph/types\";\nimport { BINDING_STEP_TYPE, OUTCOME_TONE, isOutcomeTone } from \"@graph/types\";\nimport { makePipeRef, parsePipeRef } from \"@graph/pipeRefs\";\nimport {\n humanizeIdentifier,\n outcomeKeyLabel,\n sentenceCase,\n stripDomain,\n wordsInSentence,\n} from \"./humanize\";\nimport { NATIVE_DOMAIN } from \"./nativeConcepts\";\n\n// ─── A step's wording ────────────────────────────────────────────────────────\n\n/** Where a step's title came from: the method's words for a person, its words for a builder, or its code. */\nexport const WORDING_SOURCE = {\n ACTIVITY: \"activity\",\n DESCRIPTION: \"description\",\n CODE: \"code\",\n} as const;\n\nexport type WordingSource = (typeof WORDING_SOURCE)[keyof typeof WORDING_SOURCE];\n\n/** A step's title in plain words, and where it came from. */\nexport interface StepWording {\n title: string;\n source: WordingSource;\n}\n\n/** What a step's wording is read from: a registry pipe or a graph node, which both carry the two texts. */\nexport interface StepWordingSource {\n activity?: string | null;\n description?: string | null;\n}\n\n/**\n * A step's title in plain words: its `activity` when it states one, the words\n * written for the person watching a run; else its description, written for the\n * people who build methods; else its humanized code. Each authored text is\n * shown as its author wrote it, whitespace collapsed and one closing period\n * dropped (`sentenceCase`).\n */\nexport function stepWording(\n pipe: StepWordingSource | null | undefined,\n pipeCode: string,\n): StepWording {\n const activity = sentenceCase(pipe?.activity ?? \"\");\n if (activity) return { title: activity, source: WORDING_SOURCE.ACTIVITY };\n const described = sentenceCase(pipe?.description ?? \"\");\n if (described) return { title: described, source: WORDING_SOURCE.DESCRIPTION };\n return { title: humanizeIdentifier(pipeCode), source: WORDING_SOURCE.CODE };\n}\n\n/** A pipe's `activity` as a title, or `null` when it states none. */\nexport function activityTitle(pipe: StepWordingSource | null | undefined): string | null {\n return sentenceCase(pipe?.activity ?? \"\") || null;\n}\n\n// ─── A condition's outcome words ─────────────────────────────────────────────\n\n/** An outcome's words for people, each `null` when the method does not give it. */\nexport interface OutcomeWordsRead {\n label: string | null;\n description: string | null;\n /** One of the four tones; a word that is none of them reads as no tone. */\n tone: OutcomeTone | null;\n}\n\nfunction nonEmpty(value: unknown): string | null {\n if (typeof value !== \"string\") return null;\n const trimmed = value.replace(/\\s+/g, \" \").trim();\n return trimmed.length > 0 ? trimmed : null;\n}\n\nfunction readWords(words: OutcomeWords | null | undefined): OutcomeWordsRead | null {\n if (!words || typeof words !== \"object\") return null;\n const read: OutcomeWordsRead = {\n label: nonEmpty(words.label),\n description: nonEmpty(words.description),\n tone: isOutcomeTone(words.tone) ? words.tone : null,\n };\n return read.label !== null || read.description !== null || read.tone !== null ? read : null;\n}\n\n/**\n * One of a condition's outcomes: a key of its outcome map, or `null` for its\n * default outcome. The default is never spelled as a key, so an outcome the\n * method itself names `default` stays its own.\n */\nexport type OutcomeKey = string | null;\n\n/**\n * The words a condition gives one of its outcomes: the outcome map's key, or\n * `null` for its default outcome. `null` when the condition is unknown or wrote\n * that outcome as a bare pipe reference, which carries no words.\n */\nexport function outcomeWordsOf(\n condition: PipeBlueprintUnion | null | undefined,\n key: OutcomeKey,\n): OutcomeWordsRead | null {\n if (condition?.type !== \"PipeCondition\") return null;\n if (key === null) return readWords(condition.default_outcome_words);\n const words = condition.outcome_words;\n if (!words || !Object.hasOwn(words, key)) return null;\n return readWords(words[key]);\n}\n\n/**\n * The tone one outcome reads in, the one rule every view colours an outcome\n * by: the tone the method states; else neutral when the method gives the\n * outcome a label, since a named outcome is drawn as one; else none, and an\n * outcome named only by its key, or given only a description, keeps the\n * colour of what surrounds it. No tone is ever inferred.\n */\nexport function outcomeTone(\n words: Pick<OutcomeWordsRead, \"label\" | \"tone\"> | null | undefined,\n): OutcomeTone | null {\n if (!words) return null;\n if (words.tone) return words.tone;\n return words.label !== null ? OUTCOME_TONE.NEUTRAL : null;\n}\n\n/**\n * The tone of one arrow or row standing for several outcomes: a tone only when\n * every outcome in it has one (`outcomeTone`) and they all agree, since one row\n * cannot say two things, and an outcome without words says nothing to agree\n * with.\n */\nexport function sharedOutcomeTone(\n words: readonly (Pick<OutcomeWordsRead, \"label\" | \"tone\"> | null)[],\n): OutcomeTone | null {\n const tones = words.map(outcomeTone);\n if (tones.length === 0 || tones.some((tone) => tone === null)) return null;\n return new Set(tones).size === 1 ? tones[0] : null;\n}\n\n/**\n * The description and tone of a row or a line standing for a branch's\n * outcomes: a description only when exactly one of them has one, and a tone\n * by `sharedOutcomeTone`, which for a single outcome is its `outcomeTone`.\n */\nexport function branchOutcomeWords(\n condition: PipeBlueprintUnion | null | undefined,\n outcomes: readonly OutcomeKey[],\n): { description: string | null; tone: OutcomeTone | null } {\n const read = outcomes.map((key) => outcomeWordsOf(condition, key));\n const descriptions = read.flatMap((words) => (words?.description ? [words.description] : []));\n return {\n description: descriptions.length === 1 ? descriptions[0] : null,\n tone: sharedOutcomeTone(read),\n };\n}\n\n/** The keys of a run graph node's `execution_data` a live run's condition records the words of its outcome under. */\nexport const SELECTED_OUTCOME_WORDS_KEY = {\n LABEL: \"selected_outcome_label\",\n DESCRIPTION: \"selected_outcome_description\",\n TONE: \"selected_outcome_tone\",\n} as const;\n\n/**\n * The words of the outcome a live run's condition took, as its node's\n * `execution_data` records them, or `null` when it records none: a dry run, a\n * runtime that predates them, or an outcome written as a bare pipe reference.\n */\nexport function selectedOutcomeWords(\n executionData: Record<string, unknown> | null | undefined,\n): OutcomeWordsRead | null {\n if (!executionData) return null;\n return readWords({\n label: executionData[SELECTED_OUTCOME_WORDS_KEY.LABEL] as string | null | undefined,\n description: executionData[SELECTED_OUTCOME_WORDS_KEY.DESCRIPTION] as string | null | undefined,\n tone: executionData[SELECTED_OUTCOME_WORDS_KEY.TONE] as string | null | undefined,\n });\n}\n\n/**\n * Which outcome a live run's condition took, from what its node's\n * `execution_data` records: the outcome map's key, `null` for the default\n * outcome, or `undefined` when it records none, as a dry run does. The runtime\n * records the value the expression rendered (`evaluated_expression`) and the\n * pipe the outcome map names for it (`selected_outcome`), the default\n * outcome's when the value is no key; the two must agree, so a dry run's\n * `all_outcomes` takes none. Without the rendered value, the key is the one\n * whose pipe was run, and the default when no key names it.\n */\nexport function takenOutcomeKey(\n condition: PipeConditionBlueprint,\n executionData: Record<string, unknown> | null | undefined,\n): OutcomeKey | undefined {\n const selected = executionData?.selected_outcome;\n if (typeof selected !== \"string\") return undefined;\n const map = condition.outcome_map;\n const evaluated = executionData?.evaluated_expression;\n if (typeof evaluated === \"string\") {\n if (Object.hasOwn(map, evaluated)) return map[evaluated] === selected ? evaluated : undefined;\n return condition.default_outcome === selected ? null : undefined;\n }\n const key = Object.keys(map).find((each) => map[each] === selected);\n if (key !== undefined) return key;\n return condition.default_outcome === selected ? null : undefined;\n}\n\n/** How a static graph's outcome tag spells the default outcome (`no_fit | default`). */\nconst DEFAULT_OUTCOME_TAG = \"default\";\n\n/**\n * The outcomes a static graph's outcome tag names, as `buildStaticGraphSpec`\n * writes one on a branch taken on several (`no_fit | default`), where\n * `default` names the default outcome. The tag cannot tell that from an\n * outcome the method names `default`, so it is read only where the condition's\n * own blueprint is unknown; with the blueprint, `conditionBranches` says.\n */\nexport function outcomeKeysFromTag(tag: string): OutcomeKey[] {\n return tag\n .split(\"|\")\n .map((key) => key.trim())\n .filter((key) => key.length > 0)\n .map((key) => (key === DEFAULT_OUTCOME_TAG ? null : key));\n}\n\n/** Whether two lists name the same outcomes, in whatever order. */\nexport function sameOutcomes(a: readonly OutcomeKey[], b: readonly OutcomeKey[]): boolean {\n if (a.length !== b.length) return false;\n const keys = new Set(a);\n return keys.size === new Set(b).size && b.every((key) => keys.has(key));\n}\n\n/**\n * A branch's outcomes as one label, as an arrow or a row says them: each\n * outcome by its label when the condition gives it one, else in plain words\n * (`outcomeKeyLabel`; the default outcome reads \"Otherwise\"), joined by \"or\".\n * Plain words after the first go in lower case, unless they open with an\n * acronym, as `humanizeInSentence` keeps one (\"Text or PDF\").\n */\nexport function outcomeArrowLabel(\n outcomes: readonly OutcomeKey[],\n condition: PipeBlueprintUnion | null | undefined,\n): string {\n const labels = outcomes.map((key, index) => {\n const words = outcomeWordsOf(condition, key);\n if (words?.label) return words.label;\n const label = key === null ? DEFAULT_OUTCOME_WORDS : outcomeKeyLabel(key);\n return index === 0 ? label : wordsInSentence(label);\n });\n return labels.join(\" or \");\n}\n\n/** What the default outcome is called when the method does not name it. */\nconst DEFAULT_OUTCOME_WORDS = \"Otherwise\";\n\n/** One way a condition can go: the outcomes that lead to one pipe, or to `fail` or `continue`. */\nexport interface ConditionBranch {\n /**\n * What the outcomes lead to: the pipe's full reference, or `fail` or\n * `continue`. Unique among a condition's branches, so it identifies one.\n */\n target: string;\n /** The outcomes taken to it, in the order the condition writes them, the default last. */\n outcomes: OutcomeKey[];\n /**\n * The branch as its arrow and its row say it (`outcomeArrowLabel`). When two\n * branches would read the same, case aside, each is followed by its outcome\n * keys as the method writes them, \"otherwise\" for the default (\"Check\n * (high)\", \"Check (low)\"), so two arrows never read alike.\n */\n label: string;\n}\n\n/**\n * Each way a condition can go, one branch per pipe its outcomes lead to, the\n * order the condition writes its outcomes in. A bare pipe reference takes the\n * condition's own domain.\n */\nexport function conditionBranches(condition: PipeConditionBlueprint): ConditionBranch[] {\n const fullRef = (pipeRef: string): string => {\n if (pipeRef === \"fail\" || pipeRef === \"continue\") return pipeRef;\n const parsed = parsePipeRef(pipeRef);\n return parsed\n ? makePipeRef(parsed.domainPath ?? condition.domain_code, parsed.pipeCode)\n : pipeRef;\n };\n const byTarget = new Map<string, OutcomeKey[]>();\n const named: [OutcomeKey, string | null | undefined][] = Object.entries(condition.outcome_map);\n named.push([null, condition.default_outcome]);\n for (const [key, pipeRef] of named) {\n if (!pipeRef) continue;\n const target = fullRef(pipeRef);\n const outcomes = byTarget.get(target);\n if (outcomes) outcomes.push(key);\n else byTarget.set(target, [key]);\n }\n const branches = [...byTarget.entries()].map(([target, outcomes]) => ({\n target,\n outcomes,\n label: outcomeArrowLabel(outcomes, condition),\n }));\n // Labels that differ only in case read alike too (\"Approve or retry\" beside\n // \"Approve or Retry\").\n const counts = new Map<string, number>();\n const spoken = (label: string) => label.toLowerCase();\n for (const { label } of branches) counts.set(spoken(label), (counts.get(spoken(label)) ?? 0) + 1);\n for (const branch of branches) {\n if ((counts.get(spoken(branch.label)) ?? 0) < 2) continue;\n const keys = branch.outcomes.map((key) => key ?? DEFAULT_OUTCOME_WORDS.toLowerCase());\n branch.label = `${branch.label} (${keys.join(\", \")})`;\n }\n return branches;\n}\n\n// ─── Plumbing ────────────────────────────────────────────────────────────────\n\n/** The natives whose values are files: an output reaching one of them is file-valued. */\nconst FILE_NATIVE_CODES: ReadonlySet<string> = new Set([\"Image\", \"Document\"]);\n\n/** Looks a concept up by its full reference (`legal.Scan`), as a registry knows it. */\nexport type ConceptLookup = (conceptRef: string) => ConceptInfo | null | undefined;\n\n/**\n * Whether a pipe's output is file-valued (MTHDS, \"Naming Produced Files\"): its\n * concept is `native.Image` or `native.Document`, or refines one of them,\n * directly or through the method's own concepts, single or plural. `true` or\n * `false` when the chain of refinements says so, `null` when it cannot be\n * followed: a refinement `lookupConcept` does not know, or a cycle.\n *\n * A refinement written bare (`refines = \"Scan\"`) names a concept in the\n * refining concept's own domain, which `lookupConcept` is asked for first; a\n * bare `Image` or `Document` the domain does not declare is the native. A\n * bare name that resolves to neither is unknown, never taken for a native\n * that writes no file.\n *\n * Each concept on the way is read at its fullest: when `lookupConcept` knows\n * it with a refinement the concept at hand lacks, the lookup's entry is\n * followed. A concept that states no refinement (`refines: null`) reaches no\n * file; one that arrives without the field at all, and that the lookup cannot\n * complete, is unknown.\n */\nexport function isFileValuedOutput(\n output: StuffSpecInfo | null | undefined,\n lookupConcept?: ConceptLookup,\n): boolean | null {\n let concept: ConceptInfo | null | undefined = output?.concept;\n if (!concept) return null;\n const seen = new Set<string>();\n while (concept) {\n if (concept.domain_code === NATIVE_DOMAIN) return FILE_NATIVE_CODES.has(concept.code);\n concept = fullerConcept(concept, lookupConcept?.(`${concept.domain_code}.${concept.code}`));\n const refines: string | null | undefined = concept.refines;\n if (refines === undefined) return null;\n if (!refines) return false;\n const qualified: boolean = refines.includes(\".\");\n if (qualified && refines.slice(0, refines.lastIndexOf(\".\")) === NATIVE_DOMAIN) {\n return FILE_NATIVE_CODES.has(stripDomain(refines));\n }\n const ref: string = qualified ? refines : `${concept.domain_code}.${refines}`;\n if (seen.has(ref)) return null;\n seen.add(ref);\n const found: ConceptInfo | null | undefined = lookupConcept?.(ref);\n if (found) {\n concept = found;\n continue;\n }\n if (qualified) return null;\n return FILE_NATIVE_CODES.has(refines) ? true : null;\n }\n return null;\n}\n\n/**\n * How much a concept entry says of its refinement: a refinement it names, a\n * `refines: null` stating it names none, or nothing, the field left out.\n */\nfunction refinementWeight(concept: ConceptInfo): number {\n if (typeof concept.refines === \"string\" && concept.refines !== \"\") return 2;\n return concept.refines === undefined ? 0 : 1;\n}\n\n/** Of two entries for one concept, the one that says more of its refinement, `current` on a tie. */\nfunction fullerConcept(current: ConceptInfo, other: ConceptInfo | null | undefined): ConceptInfo {\n return other && refinementWeight(other) > refinementWeight(current) ? other : current;\n}\n\n/**\n * What a view of a run does with a step, by its pipe type (MTHDS, \"What a Run\n * Shows\"): shows it, leaves it out as plumbing, or leaves it out only when its\n * output is not a file. Keyed by `NodePipeType`, so a new pipe type does not\n * compile until it is placed here.\n */\nconst RUN_VIEW_ROLE: Record<NodePipeType, \"step\" | \"plumbing\" | \"plumbing-unless-file\"> = {\n PipeLLM: \"step\",\n PipeExtract: \"step\",\n PipeCompose: \"plumbing\",\n PipeImgGen: \"step\",\n PipeSearch: \"step\",\n PipeFunc: \"plumbing-unless-file\",\n PipeStructure: \"step\",\n PipeJudge: \"step\",\n PipeDocGen: \"step\",\n PipeSignature: \"step\",\n PipeSequence: \"step\",\n PipeParallel: \"step\",\n PipeCondition: \"step\",\n PipeBatch: \"step\",\n [BINDING_STEP_TYPE]: \"plumbing\",\n};\n\n/**\n * Whether a step is plumbing, which a view of a run does not show (MTHDS,\n * \"What a Run Shows\"): it only moves data from one shape to another. A\n * PipeCompose always is, and a binding step; a PipeFunc is unless its output\n * is file-valued (`isFileValuedOutput`, through `lookupConcept`). A PipeFunc\n * whose pipe is unknown, or whose output cannot be told, is shown: a step a\n * person waits for is never hidden on a guess. Every other pipe type, and a\n * type this package does not know, is a step or a group. `pipeType` is a\n * string because a run's snapshot carries it unvalidated.\n */\nexport function isPlumbingStep(\n pipeType: string,\n pipe?: PipeBlueprintUnion | null,\n lookupConcept?: ConceptLookup,\n): boolean {\n if (!Object.hasOwn(RUN_VIEW_ROLE, pipeType)) return false;\n const role = RUN_VIEW_ROLE[pipeType as NodePipeType];\n if (role !== \"plumbing-unless-file\") return role === \"plumbing\";\n if (!pipe) return false;\n return isFileValuedOutput(pipe.output, lookupConcept) === false;\n}\n\n/**\n * A concept lookup over what a pipe registry declares: every concept a pipe\n * of it reads or writes, by its full reference, and the concepts of a concept\n * registry beside it when there is one. Built once per registry. A concept\n * met several times keeps the entry that says most of its refinement, so a\n * poorer copy read later, one serialised without its `refines` or a stub for\n * a concept a pipe only names, never replaces a fuller one.\n */\nexport function registryConceptLookup(\n pipes: Readonly<Record<string, PipeBlueprintUnion>> | undefined,\n concepts?: Readonly<Record<string, ConceptInfo>> | null,\n): ConceptLookup {\n const known = new Map<string, ConceptInfo>();\n const add = (concept: ConceptInfo | null | undefined) => {\n if (concept?.domain_code && concept.code) {\n const ref = `${concept.domain_code}.${concept.code}`;\n const held = known.get(ref);\n known.set(ref, held ? fullerConcept(held, concept) : concept);\n }\n };\n for (const pipe of Object.values(pipes ?? {})) {\n add(pipe.output?.concept);\n for (const input of Object.values(pipe.inputs ?? {})) add(input?.concept);\n }\n for (const concept of Object.values(concepts ?? {})) add(concept);\n return (conceptRef) => known.get(conceptRef);\n}\n"],"mappings":";;;;;;;;;;;;AAWO,SAAS,sBAAsB,WAAsD;AAC1F,MAAI,CAAC,UAAW,QAAO;AAEvB,QAAM,gBAAoD,CAAC;AAC3D,QAAM,iBAA2C,CAAC;AAClD,QAAM,iBAA2C,CAAC;AAClD,QAAM,kBAA4C,CAAC;AACnD,QAAM,eAAe,oBAAI,IAAY;AAGrC,aAAW,QAAQ,UAAU,OAAO;AAClC,QAAI,KAAK,SAAS,YAAY;AAC5B,UAAI,CAAC,gBAAgB,KAAK,MAAM,EAAG,iBAAgB,KAAK,MAAM,IAAI,CAAC;AACnE,sBAAgB,KAAK,MAAM,EAAE,KAAK,KAAK,MAAM;AAC7C,mBAAa,IAAI,KAAK,MAAM;AAAA,IAC9B;AAAA,EACF;AAGA,QAAM,oBAAoB,IAAI,IAAY,OAAO,KAAK,eAAe,CAAC;AAGtE,aAAW,QAAQ,UAAU,OAAO;AAClC,UAAM,SAAS,KAAK;AACpB,UAAM,eAAe,kBAAkB,IAAI,KAAK,EAAE;AAGlD,eAAW,UAAU,OAAO,SAAS;AACnC,UAAI,OAAO,UAAU,CAAC,cAAc,OAAO,MAAM,GAAG;AAClD,sBAAc,OAAO,MAAM,IAAI;AAAA,UAC7B,MAAM,OAAO;AAAA,UACb,SAAS,OAAO;AAAA,UAChB,cAAc,OAAO;AAAA,UACrB,aAAa,OAAO;AAAA,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AAM,OAAO,MAAM,IAAI,GAAG;AAC1B,YAAM,IAAI,KAAK,OAAO,cAAc,MAAM,OAAO,IAAI,OAAO;AAAA,IAC9D;AAAA,EACF;AACA,aAAW,QAAQ,OAAO,OAAO,wBAAS,CAAC,CAAC,GAAG;AAC7C,SAAI,UAAK,WAAL,mBAAa,OAAO;AACxB,eAAW,SAAS,OAAO,QAAO,UAAK,WAAL,YAAe,CAAC,CAAC,EAAG,KAAI,+BAAO,OAAO;AAAA,EAC1E;AACA,aAAW,WAAW,OAAO,OAAO,8BAAY,CAAC,CAAC,EAAG,KAAI,OAAO;AAChE,SAAO,CAAC,eAAe,MAAM,IAAI,UAAU;AAC7C;","names":["_a"]}
@@ -1,16 +1,29 @@
1
1
  import {
2
- makePipeRef,
3
- parsePipeRef
4
- } from "./chunk-2N65P32H.js";
5
- import {
2
+ NATIVE_DOMAIN,
3
+ STORED_VALUE_REFERENCE_MEMBERS,
4
+ activityTitle,
5
+ branchOutcomeWords,
6
+ buildChildToControllerMap,
7
+ buildDataflowAnalysis,
6
8
  conceptPlainName,
9
+ conditionBranches,
10
+ getPipeBlueprint,
7
11
  humanizeIdentifier,
8
12
  humanizeInSentence,
9
13
  isGenericConcept,
10
- outcomeLabel,
11
- pipeTitle,
14
+ isStoredValueConcept,
15
+ outcomeArrowLabel,
16
+ outcomeKeysFromTag,
17
+ resolveConceptRef,
18
+ resolveNodeBlueprint,
19
+ sameOutcomes,
20
+ stepWording,
12
21
  stripDomain
13
- } from "./chunk-P6IGZVWE.js";
22
+ } from "./chunk-UVEGKTBU.js";
23
+ import {
24
+ makePipeRef,
25
+ parsePipeRef
26
+ } from "./chunk-2N65P32H.js";
14
27
  import {
15
28
  ARROW_CLOSED_MARKER,
16
29
  BINDING_STEP_TYPE,
@@ -40,7 +53,7 @@ import {
40
53
  nodeWidth,
41
54
  stuffDigestFromId,
42
55
  stuffNodeId
43
- } from "./chunk-6KWNAU4F.js";
56
+ } from "./chunk-BQZ3BPJM.js";
44
57
  import {
45
58
  __objRest,
46
59
  __spreadProps,
@@ -261,6 +274,9 @@ function validateNode(node, path) {
261
274
  );
262
275
  }
263
276
  requireNonEmptyString(node.description, `${path}.description`);
277
+ if (typeof node.activity !== "string" || node.activity.trim() === "") {
278
+ delete node.activity;
279
+ }
264
280
  requireNonEmptyString(node.domain_code, `${path}.domain_code`);
265
281
  let io = node.io;
266
282
  if (io === void 0) {
@@ -378,185 +394,6 @@ function asCardNode(node, path = "node") {
378
394
  return asPipeCallNode(node, path);
379
395
  }
380
396
 
381
- // src/graph/graphAnalysis.ts
382
- function buildDataflowAnalysis(graphspec) {
383
- if (!graphspec) return null;
384
- const stuffRegistry = {};
385
- const stuffProducers = {};
386
- const stuffConsumers = {};
387
- const containmentTree = {};
388
- const childNodeIds = /* @__PURE__ */ new Set();
389
- for (const edge of graphspec.edges) {
390
- if (edge.kind === "contains") {
391
- if (!containmentTree[edge.source]) containmentTree[edge.source] = [];
392
- containmentTree[edge.source].push(edge.target);
393
- childNodeIds.add(edge.target);
394
- }
395
- }
396
- const controllerNodeIds = new Set(Object.keys(containmentTree));
397
- for (const node of graphspec.nodes) {
398
- const nodeIo = node.io;
399
- const isController = controllerNodeIds.has(node.id);
400
- for (const output of nodeIo.outputs) {
401
- if (output.digest && !stuffRegistry[output.digest]) {
402
- stuffRegistry[output.digest] = {
403
- name: output.name,
404
- concept: output.concept,
405
- multiplicity: output.multiplicity,
406
- contentType: output.content_type
407
- };
408
- }
409
- if (output.digest && !isController) {
410
- if (!stuffProducers[output.digest]) stuffProducers[output.digest] = [];
411
- stuffProducers[output.digest].push(node.id);
412
- }
413
- }
414
- for (const input of nodeIo.inputs) {
415
- if (input.digest && !stuffRegistry[input.digest]) {
416
- stuffRegistry[input.digest] = {
417
- name: input.name,
418
- concept: input.concept,
419
- multiplicity: input.multiplicity,
420
- contentType: input.content_type
421
- };
422
- }
423
- if (input.digest && !isController) {
424
- if (!stuffConsumers[input.digest]) stuffConsumers[input.digest] = [];
425
- stuffConsumers[input.digest].push(node.id);
426
- }
427
- }
428
- }
429
- return {
430
- stuffRegistry,
431
- stuffProducers,
432
- stuffConsumers,
433
- controllerNodeIds,
434
- childNodeIds,
435
- containmentTree
436
- };
437
- }
438
- function buildChildToControllerMap(graphspec, analysis) {
439
- const childToController = {};
440
- for (const [ctrlId, children] of Object.entries(analysis.containmentTree)) {
441
- for (const childId of children) {
442
- childToController[childId] = ctrlId;
443
- }
444
- }
445
- for (const [digest, producerIds] of Object.entries(analysis.stuffProducers)) {
446
- const stuffId = "stuff_" + digest;
447
- const ctrlId = commonController(producerIds, childToController);
448
- if (ctrlId) {
449
- childToController[stuffId] = ctrlId;
450
- }
451
- }
452
- for (const node of graphspec.nodes) {
453
- if (!analysis.controllerNodeIds.has(node.id)) continue;
454
- const parentCtrlId = childToController[node.id];
455
- if (!parentCtrlId) continue;
456
- for (const output of node.io.outputs) {
457
- if (!output.digest) continue;
458
- const stuffId = "stuff_" + output.digest;
459
- if (!childToController[stuffId]) {
460
- childToController[stuffId] = parentCtrlId;
461
- }
462
- }
463
- }
464
- for (const edge of graphspec.edges) {
465
- if (edge.kind === "batch_item" && edge.target_stuff_digest) {
466
- const stuffId = "stuff_" + edge.target_stuff_digest;
467
- if (analysis.controllerNodeIds.has(edge.source)) {
468
- childToController[stuffId] = edge.source;
469
- }
470
- }
471
- }
472
- const stuffInStuffEdges = /* @__PURE__ */ new Set();
473
- for (const edge of graphspec.edges) {
474
- if (edge.kind === "batch_item" || edge.kind === "batch_aggregate" || edge.kind === "parallel_combine") {
475
- if (edge.source_stuff_digest) stuffInStuffEdges.add(edge.source_stuff_digest);
476
- if (edge.target_stuff_digest) stuffInStuffEdges.add(edge.target_stuff_digest);
477
- }
478
- }
479
- const stuffPrefix = "stuff_";
480
- const stuffEntries = Object.keys(childToController).filter((id) => id.startsWith(stuffPrefix));
481
- for (const stuffId of stuffEntries) {
482
- const digest = stuffId.slice(stuffPrefix.length);
483
- let assignedCtrl = childToController[stuffId];
484
- if (!assignedCtrl) continue;
485
- const consumers = analysis.stuffConsumers[digest] || [];
486
- if (consumers.length === 0) {
487
- if (!stuffInStuffEdges.has(digest)) {
488
- delete childToController[stuffId];
489
- }
490
- continue;
491
- }
492
- while (assignedCtrl) {
493
- const ctrl = assignedCtrl;
494
- const hasConsumerInside = consumers.some(
495
- (consumerId) => isDescendantOf(consumerId, ctrl, childToController)
496
- );
497
- if (hasConsumerInside) break;
498
- const parentCtrl = childToController[assignedCtrl];
499
- if (parentCtrl) {
500
- childToController[stuffId] = parentCtrl;
501
- assignedCtrl = parentCtrl;
502
- } else {
503
- delete childToController[stuffId];
504
- assignedCtrl = void 0;
505
- }
506
- }
507
- }
508
- return childToController;
509
- }
510
- function commonController(nodeIds, childToController) {
511
- if (nodeIds.length === 0) return void 0;
512
- let candidate = childToController[nodeIds[0]];
513
- while (candidate) {
514
- const ctrl = candidate;
515
- if (nodeIds.every((id) => isDescendantOf(id, ctrl, childToController))) return ctrl;
516
- candidate = childToController[ctrl];
517
- }
518
- return void 0;
519
- }
520
- function isDescendantOf(nodeId, ancestorCtrlId, childToController) {
521
- let current = childToController[nodeId];
522
- while (current) {
523
- if (current === ancestorCtrlId) return true;
524
- current = childToController[current];
525
- }
526
- return false;
527
- }
528
- function getPipeBlueprint(spec, pipeRef) {
529
- var _a;
530
- return (_a = spec.pipe_registry) == null ? void 0 : _a[pipeRef];
531
- }
532
- function resolveNodeBlueprint(spec, node) {
533
- var _a;
534
- const registry = spec.pipe_registry;
535
- if (!registry || isBindingNode(node) || !node.pipe_code) return void 0;
536
- if (node.domain_code) return registry[makePipeRef(node.domain_code, node.pipe_code)];
537
- const pipelineDomain = (_a = spec.pipeline_ref) == null ? void 0 : _a.domain;
538
- if (pipelineDomain) {
539
- const inPipelineDomain = registry[makePipeRef(pipelineDomain, node.pipe_code)];
540
- if (inPipelineDomain) return inPipelineDomain;
541
- }
542
- const suffix = `.${node.pipe_code}`;
543
- const matches = Object.keys(registry).filter((ref) => ref.endsWith(suffix));
544
- return matches.length === 1 ? registry[matches[0]] : void 0;
545
- }
546
- function getConceptInfo(spec, conceptRef) {
547
- var _a;
548
- return (_a = spec.concept_registry) == null ? void 0 : _a[conceptRef];
549
- }
550
- function resolveConceptRef(spec, codeOrRef) {
551
- if (!spec.concept_registry) return void 0;
552
- const direct = spec.concept_registry[codeOrRef];
553
- if (direct) return direct;
554
- for (const info of Object.values(spec.concept_registry)) {
555
- if (info.code === codeOrRef) return info;
556
- }
557
- return void 0;
558
- }
559
-
560
397
  // src/graph/pipeCardPayload.ts
561
398
  function ioPill(item) {
562
399
  return {
@@ -2013,32 +1850,6 @@ function estimateWrap(text, lineWidthPx, fontPx, maxLines) {
2013
1850
  return { lines, drawnLines, clamped: lines > maxLines };
2014
1851
  }
2015
1852
 
2016
- // src/graph/styles/nativeConcepts.ts
2017
- var NATIVE_DOMAIN = "native";
2018
- var STORED_VALUE_NATIVES = /* @__PURE__ */ new Set(["Text", "Markdown", "Html", "JSON"]);
2019
- var STORED_VALUE_REFERENCE_MEMBERS = /* @__PURE__ */ new Set([
2020
- "url",
2021
- "size",
2022
- "mime_type",
2023
- "preview"
2024
- ]);
2025
- function isStoredValueConcept(graphspec, concept) {
2026
- const seen = /* @__PURE__ */ new Set();
2027
- let current = concept;
2028
- while (current && !seen.has(current)) {
2029
- seen.add(current);
2030
- if (current.domain_code === NATIVE_DOMAIN) return STORED_VALUE_NATIVES.has(current.code);
2031
- const parent = current.refines;
2032
- if (!parent) return false;
2033
- const resolved = resolveConceptRef(graphspec, parent);
2034
- if (!resolved) {
2035
- return parent.startsWith(`${NATIVE_DOMAIN}.`) && STORED_VALUE_NATIVES.has(stripDomain(parent));
2036
- }
2037
- current = resolved;
2038
- }
2039
- return false;
2040
- }
2041
-
2042
1853
  // src/graph/styles/simpleStyle.ts
2043
1854
  var SIMPLE_STEP_WIDTH = 160;
2044
1855
  var SIMPLE_STEP_WIDE_WIDTH = 200;
@@ -2233,6 +2044,20 @@ function stepIdentity(spec) {
2233
2044
  function forEachLabel(itemName) {
2234
2045
  return `For each ${humanizeInSentence(itemName)}`;
2235
2046
  }
2047
+ function isBranchTarget(target, node) {
2048
+ if (!node.pipe_code) return false;
2049
+ const arrow = target.indexOf("->");
2050
+ const parsed = parsePipeRef(arrow === -1 ? target : target.slice(target.lastIndexOf("->") + 2));
2051
+ if (!parsed || parsed.pipeCode !== node.pipe_code) return false;
2052
+ if (node.domain_code === void 0) return true;
2053
+ if (arrow === -1) return parsed.domainPath === node.domain_code;
2054
+ return node.domain_code === target.slice(0, arrow) || parsed.domainPath === null || parsed.domainPath === node.domain_code;
2055
+ }
2056
+ function tagNamesOutcomes(tag, outcomes) {
2057
+ const spelled = outcomes.map((key) => key != null ? key : "default").sort();
2058
+ const named = tag.split("|").map((key) => key.trim()).filter((key) => key.length > 0).sort();
2059
+ return spelled.length === named.length && spelled.every((key, index) => key === named[index]);
2060
+ }
2236
2061
  function isBuiltInConcept(graphspec, conceptRef) {
2237
2062
  const info = resolveConceptRef(graphspec, conceptRef);
2238
2063
  if (info) return info.domain_code === NATIVE_DOMAIN;
@@ -2248,7 +2073,7 @@ function simpleValueTitle(graphspec, item, role) {
2248
2073
  return plain && plain.toLowerCase() !== title.toLowerCase() ? { title, subtitle: plain } : { title };
2249
2074
  }
2250
2075
  function projectSimpleGraph(input) {
2251
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2076
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2252
2077
  const { graphspec, nodes, analysis, rawAnalysis } = input;
2253
2078
  const graphMode = graphSpecMode(graphspec);
2254
2079
  const specById = new Map(graphspec.nodes.map((n) => [n.id, n]));
@@ -2413,36 +2238,25 @@ function projectSimpleGraph(input) {
2413
2238
  return current;
2414
2239
  }
2415
2240
  function outcomeFor(decisionId, branchId) {
2416
- var _a2;
2241
+ var _a2, _b2, _c2;
2417
2242
  const branch = specById.get(branchId);
2418
- const tagged = (_a2 = branch == null ? void 0 : branch.tags) == null ? void 0 : _a2.outcome;
2419
- if (tagged) return outcomeLabel(tagged);
2420
- const contains = graphspec.edges.find(
2421
- (e) => e.kind === "contains" && repOf(e.source) === decisionId && e.target === branchId && e.label
2422
- );
2423
- if (contains == null ? void 0 : contains.label) return outcomeLabel(contains.label);
2424
2243
  const decision = specById.get(decisionId);
2425
- if (!(decision == null ? void 0 : decision.domain_code) || !decision.pipe_code || !(branch == null ? void 0 : branch.pipe_code)) return void 0;
2426
- const blueprint = getPipeBlueprint(
2427
- graphspec,
2428
- makePipeRef(decision.domain_code, decision.pipe_code)
2429
- );
2430
- if ((blueprint == null ? void 0 : blueprint.type) !== "PipeCondition") return void 0;
2431
- const conditionDomain = decision.domain_code;
2432
- const branchCode = branch.pipe_code;
2433
- function namesBranch(pipeRef) {
2434
- var _a3;
2435
- const parsed = parsePipeRef(pipeRef);
2436
- if (!parsed) return stripDomain(pipeRef) === branchCode;
2437
- if (parsed.pipeCode !== branchCode) return false;
2438
- const domain = (_a3 = parsed.domainPath) != null ? _a3 : conditionDomain;
2439
- return (branch == null ? void 0 : branch.domain_code) === void 0 || branch.domain_code === domain;
2440
- }
2441
- const outcomes = Object.entries(blueprint.outcome_map).filter(([, pipeRef]) => namesBranch(pipeRef)).map(([outcome]) => outcome);
2442
- if (blueprint.default_outcome && namesBranch(blueprint.default_outcome)) {
2443
- outcomes.push("default");
2444
- }
2445
- return outcomes.length > 0 ? outcomeLabel(outcomes.join("|")) : void 0;
2244
+ const blueprint = (decision == null ? void 0 : decision.domain_code) && decision.pipe_code ? getPipeBlueprint(graphspec, makePipeRef(decision.domain_code, decision.pipe_code)) : void 0;
2245
+ const condition = (blueprint == null ? void 0 : blueprint.type) === "PipeCondition" ? blueprint : null;
2246
+ const tagged = (_c2 = (_a2 = branch == null ? void 0 : branch.tags) == null ? void 0 : _a2.outcome) != null ? _c2 : (_b2 = graphspec.edges.find(
2247
+ (e) => e.kind === "contains" && repOf(e.source) === decisionId && e.target === branchId && e.label
2248
+ )) == null ? void 0 : _b2.label;
2249
+ if (condition && branch) {
2250
+ const answering = conditionBranches(condition).filter(
2251
+ ({ target, outcomes: outcomes2 }) => isBranchTarget(target, branch) && (!tagged || tagNamesOutcomes(tagged, outcomes2))
2252
+ );
2253
+ if (answering.length === 1) {
2254
+ return { label: answering[0].label, outcomes: answering[0].outcomes };
2255
+ }
2256
+ }
2257
+ if (!tagged) return void 0;
2258
+ const outcomes = outcomeKeysFromTag(tagged);
2259
+ return outcomes.length > 0 ? { label: outcomeArrowLabel(outcomes, condition), outcomes } : void 0;
2446
2260
  }
2447
2261
  function decisionsAbove(nodeId) {
2448
2262
  const chain = [];
@@ -2462,8 +2276,9 @@ function projectSimpleGraph(input) {
2462
2276
  let edge = edges.get(key);
2463
2277
  if (edge && newOnly) return;
2464
2278
  if (!edge) {
2465
- const label = decisionSet.has(source) ? outcomeFor(source, branchOf(source, target)) : void 0;
2466
- edge = simpleEdge(`simple_edge_${edgeCount++}`, source, target, label);
2279
+ const outcome = decisionSet.has(source) ? outcomeFor(source, branchOf(source, target)) : void 0;
2280
+ edge = simpleEdge(`simple_edge_${edgeCount++}`, source, target, outcome == null ? void 0 : outcome.label);
2281
+ if (outcome) edge.outcomes = outcome.outcomes;
2467
2282
  edges.set(key, edge);
2468
2283
  }
2469
2284
  if (digest && !((_a2 = edge.carries) == null ? void 0 : _a2.includes(digest))) edge.carries = [...(_b2 = edge.carries) != null ? _b2 : [], digest];
@@ -2604,12 +2419,15 @@ function projectSimpleGraph(input) {
2604
2419
  if (spec.pipe_type === BINDING_STEP_TYPE) {
2605
2420
  return humanizeIdentifier((_b2 = (_a2 = spec.pipe_code) == null ? void 0 : _a2.split(".").pop()) != null ? _b2 : "");
2606
2421
  }
2422
+ const markingBatch = markedSteps[spec.id] ? specById.get(markedSteps[spec.id]) : void 0;
2423
+ const batchWords = activityTitle(markingBatch);
2424
+ if (batchWords) return batchWords;
2607
2425
  let source = spec;
2608
- if (folded && spec.pipe_type === "PipeBatch") {
2426
+ if (folded && spec.pipe_type === "PipeBatch" && !activityTitle(spec)) {
2609
2427
  const branch = specById.get((_d2 = (_c2 = rawAnalysis.containmentTree[spec.id]) == null ? void 0 : _c2[0]) != null ? _d2 : "");
2610
2428
  if (branch) source = branch;
2611
2429
  }
2612
- return pipeTitle(source.description, (_e2 = source.pipe_code) != null ? _e2 : "").title;
2430
+ return stepWording(source, (_e2 = source.pipe_code) != null ? _e2 : "").title;
2613
2431
  }
2614
2432
  const stepById = new Map(drawnSteps.map((card) => [card.id, card]));
2615
2433
  for (const spec of graphspec.nodes) {
@@ -2653,7 +2471,7 @@ function projectSimpleGraph(input) {
2653
2471
  continue;
2654
2472
  }
2655
2473
  if (decisionSet.has(spec.id)) {
2656
- const title = pipeTitle(spec.description, (_i = spec.pipe_code) != null ? _i : "").title;
2474
+ const title = stepWording(spec, (_i = spec.pipe_code) != null ? _i : "").title;
2657
2475
  simpleNodes.push({
2658
2476
  id: spec.id,
2659
2477
  type: NODE_TYPE_SIMPLE_DECISION,
@@ -2702,7 +2520,7 @@ function projectSimpleGraph(input) {
2702
2520
  for (const frameId of frameSet) {
2703
2521
  const spec = specById.get(frameId);
2704
2522
  if (!spec) continue;
2705
- const title = forEachLabel(itemName(frameId) || "item");
2523
+ const title = (_j = activityTitle(spec)) != null ? _j : forEachLabel(itemName(frameId) || "item");
2706
2524
  simpleNodes.push({
2707
2525
  id: frameId,
2708
2526
  type: NODE_TYPE_SIMPLE_FRAME,
@@ -2766,7 +2584,7 @@ function projectSimpleGraph(input) {
2766
2584
  for (const conditionId of liveControllers) {
2767
2585
  const drawn = drawnAs(conditionId);
2768
2586
  if (!decisionSet.has(drawn)) continue;
2769
- for (const item of (_k = (_j = specById.get(conditionId)) == null ? void 0 : _j.io.inputs) != null ? _k : []) {
2587
+ for (const item of (_l = (_k = specById.get(conditionId)) == null ? void 0 : _k.io.inputs) != null ? _l : []) {
2770
2588
  if (!item.digest) continue;
2771
2589
  const readers = decisionReads.get(item.digest);
2772
2590
  if (readers) readers.push(drawn);
@@ -2805,7 +2623,7 @@ function projectSimpleGraph(input) {
2805
2623
  if (from.length > 0 || to.length > 0) valueFlows.set(digest, { from, to });
2806
2624
  }
2807
2625
  const runs = /* @__PURE__ */ new Map();
2808
- for (const id of drawnIds) runs.set(id, (_l = runIds.get(id)) != null ? _l : [id]);
2626
+ for (const id of drawnIds) runs.set(id, (_m = runIds.get(id)) != null ? _m : [id]);
2809
2627
  return {
2810
2628
  nodes: simpleNodes,
2811
2629
  edges: [...edges.values()],
@@ -3142,7 +2960,7 @@ function stepTitlesInside(specById, childrenOf, id) {
3142
2960
  const children = childrenOf(nodeId);
3143
2961
  if (children.length === 0) {
3144
2962
  if ((spec == null ? void 0 : spec.kind) === "operator") {
3145
- titles.push(pipeTitle(spec.description, (_a = spec.pipe_code) != null ? _a : "").title);
2963
+ titles.push(stepWording(spec, (_a = spec.pipe_code) != null ? _a : "").title);
3146
2964
  }
3147
2965
  return;
3148
2966
  }
@@ -3190,22 +3008,6 @@ function decisionOutcomes(graphspec, decision, decisionRuns, context) {
3190
3008
  if ((blueprint == null ? void 0 : blueprint.type) !== "PipeCondition") return [];
3191
3009
  const domain = decision.domain_code;
3192
3010
  const { specById, childrenOf } = context;
3193
- const fullRef = (pipeRef) => {
3194
- var _a;
3195
- if (isOutcomeEnd(pipeRef)) return pipeRef;
3196
- const parsed = parsePipeRef(pipeRef);
3197
- return parsed ? makePipeRef((_a = parsed.domainPath) != null ? _a : domain, parsed.pipeCode) : pipeRef;
3198
- };
3199
- const byBranch = /* @__PURE__ */ new Map();
3200
- const named = Object.entries(blueprint.outcome_map);
3201
- if (blueprint.default_outcome) named.push(["default", blueprint.default_outcome]);
3202
- for (const [outcome, pipeRef] of named) {
3203
- if (!pipeRef) continue;
3204
- const ref = fullRef(pipeRef);
3205
- const outcomes = byBranch.get(ref);
3206
- if (outcomes) outcomes.push(outcome);
3207
- else byBranch.set(ref, [outcome]);
3208
- }
3209
3011
  const ranIn = (ref, run) => childrenOf(run.id).some((childId) => {
3210
3012
  var _a;
3211
3013
  const child = specById.get(childId);
@@ -3213,24 +3015,34 @@ function decisionOutcomes(graphspec, decision, decisionRuns, context) {
3213
3015
  const childRef = makePipeRef((_a = child.domain_code) != null ? _a : domain, child.pipe_code);
3214
3016
  return childRef === ref && child.status !== "skipped" && child.status !== "scheduled";
3215
3017
  });
3216
- return [...byBranch.entries()].map(([ref, outcomes]) => {
3018
+ return conditionBranches(blueprint).map(({ target, outcomes, label }) => {
3217
3019
  var _a;
3218
- const label = outcomeLabel(outcomes.join("|"));
3219
- if (isOutcomeEnd(ref)) return { label, leadsToTitle: "", ends: ref };
3220
- const branch = getPipeBlueprint(graphspec, ref);
3221
- const parsed = parsePipeRef(ref);
3222
- const code = (_a = parsed == null ? void 0 : parsed.pipeCode) != null ? _a : stripDomain(ref);
3223
- const row = {
3020
+ const words = outcomeWords(blueprint, outcomes);
3021
+ if (isOutcomeEnd(target))
3022
+ return __spreadValues({ target, outcomes, label, leadsToTitle: "", ends: target }, words);
3023
+ const branch = getPipeBlueprint(graphspec, target);
3024
+ const parsed = parsePipeRef(target);
3025
+ const code = (_a = parsed == null ? void 0 : parsed.pipeCode) != null ? _a : stripDomain(target);
3026
+ const row = __spreadValues({
3027
+ target,
3028
+ outcomes,
3224
3029
  label,
3225
- leadsToTitle: pipeTitle(branch == null ? void 0 : branch.description, code).title
3226
- };
3227
- const edge = context.edges.find((e) => e.label === label);
3030
+ leadsToTitle: stepWording(branch, code).title
3031
+ }, words);
3032
+ const edge = context.edges.find((e) => e.outcomes && sameOutcomes(e.outcomes, outcomes));
3228
3033
  const leadsTo = edge ? context.link(edge.target) : null;
3229
3034
  if (leadsTo) row.leadsTo = leadsTo;
3230
- if (context.resolved) row.taken = decisionRuns.filter((run) => ranIn(ref, run)).length;
3035
+ if (context.resolved) row.taken = decisionRuns.filter((run) => ranIn(target, run)).length;
3231
3036
  return row;
3232
3037
  });
3233
3038
  }
3039
+ function outcomeWords(blueprint, outcomes) {
3040
+ const { description, tone } = branchOutcomeWords(blueprint, outcomes);
3041
+ const result = {};
3042
+ if (description) result.description = description;
3043
+ if (tone) result.tone = tone;
3044
+ return result;
3045
+ }
3234
3046
  function isOutcomeEnd(pipeRef) {
3235
3047
  return pipeRef === "fail" || pipeRef === "continue";
3236
3048
  }
@@ -3253,12 +3065,6 @@ export {
3253
3065
  validateGraphSpec,
3254
3066
  asPipeCallNode,
3255
3067
  asCardNode,
3256
- buildDataflowAnalysis,
3257
- buildChildToControllerMap,
3258
- getPipeBlueprint,
3259
- resolveNodeBlueprint,
3260
- getConceptInfo,
3261
- resolveConceptRef,
3262
3068
  buildPipeCardPayload,
3263
3069
  buildDataflowGraph,
3264
3070
  buildGraph,
@@ -3312,4 +3118,4 @@ export {
3312
3118
  GRAPH_STYLE_PIPELINES,
3313
3119
  buildSimpleNodeDetail
3314
3120
  };
3315
- //# sourceMappingURL=chunk-7QUQJW6Q.js.map
3121
+ //# sourceMappingURL=chunk-YQJNKQWO.js.map