@beehexa/hexasync-template-worker-flow 2611.5.3 → 2611.8.2

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,4FAA4F;IAC5F,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;CACxF;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EACT,qBAAqB,GAAG,iBAAiB,GAAG,eAAe,GAAG,mBAAmB,GAAG,cAAc,GAClG,sBAAsB,CAAC;CAC5B;AAED,MAAM,MAAM,iBAAiB,GAAG,yBAAyB,GAAG,2BAA2B,CAAC;AAExF,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAMnE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,yBAAyB,GAAG,YAAY,CAcjF;AAED;;;;;;GAMG;AACH,wBAAiB,0BAA0B,CAAC,IAAI,EAAE,mBAAmB,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CA6F1G"}
@@ -0,0 +1,136 @@
1
+ import { entrySegment, identitySegment, keySegment, nodeAddress } from '@beehexa/hexasync-template-model';
2
+ /** The same authored base used by inspection, discovery and topology. */
3
+ export function workerHostAddress(host) {
4
+ return nodeAddress([
5
+ keySegment(host.collection), identitySegment(host.scope.componentId, 'id'),
6
+ ...(host.scope.componentType === 'WEBHOOK'
7
+ ? [keySegment('targets'), entrySegment(host.scope.targetKey)] : []),
8
+ ]);
9
+ }
10
+ /**
11
+ * The route-relevant view of one accepted declaration, read the one way every route consumer reads it: exact
12
+ * selected executor, selected payload addressed at its authored field, root recovery (a blank one routes nowhere)
13
+ * and the payload-first exception back-reference.
14
+ */
15
+ export function routableStep(declaration) {
16
+ const { step, executor, payload, recovery } = declaration;
17
+ const nested = step.data;
18
+ const fromStep = typeof nested?.fromStep === 'string' ? nested.fromStep : step.fromStep;
19
+ return {
20
+ key: declaration.key,
21
+ ...(step.next === undefined ? {} : { next: step.next }),
22
+ data: payload,
23
+ // A legacy `input` payload is addressed where it is written; an absent payload reads as `data`.
24
+ payloadField: Object.hasOwn(step, 'data') || step.input == null ? 'data' : 'input',
25
+ ...(typeof executor === 'string' ? { stepType: executor } : {}),
26
+ ...(recovery == null || (typeof recovery === 'string' && recovery.trim() === '') ? {} : { onError: recovery }),
27
+ ...(typeof fromStep === 'string' ? { fromStep } : {}),
28
+ };
29
+ }
30
+ /**
31
+ * One first-key-wins stream in stage/authored order, independent of chosen-entry reachability.
32
+ * Buffers only one stage to elect its first root/Begin/step before yielding immutable records.
33
+ * Rejections carry no payload and cannot supply graph attachments or relationship facts.
34
+ * A pusher must declare its own `id` (null, absent or blank is missing): without one, each nonempty stage yields one
35
+ * `missing-component-id` rejection and no step, and a caller-supplied `componentId` or `name` never substitutes for it.
36
+ */
37
+ export function* acceptedWorkerDeclarations(host) {
38
+ const base = workerHostAddress(host);
39
+ const invalidTarget = host.scope.componentType === 'WEBHOOK' && entrySegment(host.scope.targetKey) === undefined;
40
+ const invalidComponent = host.scope.componentId != null && identitySegment(host.scope.componentId, 'id') === undefined;
41
+ const ownId = host.component.id;
42
+ const missingComponentId = host.scope.componentType === 'PUSHER'
43
+ && (ownId == null || (typeof ownId === 'string' && ownId.trim() === ''));
44
+ for (const stage of host.stages) {
45
+ const rawSteps = host.component[stage.key];
46
+ if (!Array.isArray(rawSteps))
47
+ continue;
48
+ if (host.eligibility === 'unbound') {
49
+ if (rawSteps.length > 0)
50
+ yield { kind: 'rejected', scope: host.scope, stage, authoredIndex: -1, code: 'unbound-host' };
51
+ continue;
52
+ }
53
+ if (missingComponentId) {
54
+ if (rawSteps.length > 0)
55
+ yield { kind: 'rejected', scope: host.scope, stage, authoredIndex: -1, code: 'missing-component-id' };
56
+ continue;
57
+ }
58
+ const keys = new Set();
59
+ const addresses = new Set();
60
+ const pending = [];
61
+ let rootIndex;
62
+ let beginIndex;
63
+ let firstIndex;
64
+ for (let authoredIndex = 0; authoredIndex < rawSteps.length; authoredIndex += 1) {
65
+ const raw = rawSteps[authoredIndex];
66
+ const reject = (code, key) => {
67
+ pending.push({ kind: 'rejected', scope: host.scope, stage, authoredIndex, code, ...(key === undefined ? {} : { key }) });
68
+ };
69
+ if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
70
+ reject('invalid-declaration');
71
+ continue;
72
+ }
73
+ const step = raw;
74
+ const key = step.key;
75
+ if (typeof key !== 'string' || key.trim() === '') {
76
+ reject('invalid-address');
77
+ continue;
78
+ }
79
+ const segment = identitySegment(key, 'key');
80
+ if (segment === undefined || invalidTarget || invalidComponent) {
81
+ reject('invalid-address', key);
82
+ continue;
83
+ }
84
+ if (keys.has(key)) {
85
+ reject('duplicate-key', key);
86
+ continue;
87
+ }
88
+ const address = nodeAddress([keySegment(base), keySegment(stage.key), segment]);
89
+ if (addresses.has(address)) {
90
+ reject('address-collision', key);
91
+ continue;
92
+ }
93
+ keys.add(key);
94
+ addresses.add(address);
95
+ const data = step.data;
96
+ const input = step.input;
97
+ const payload = Object.hasOwn(step, 'data') ? step.data : step.input ?? null;
98
+ let connectionId;
99
+ let connectionSource;
100
+ // Non-string selected values remain invalid, rather than falling through to a valid later binding.
101
+ connectionId = step.connectorId;
102
+ connectionSource = 'connectorId';
103
+ if (connectionId == null || (typeof connectionId === 'string' && connectionId.trim() === '')) {
104
+ connectionId = data?.connectionId;
105
+ connectionSource = 'data.connectionId';
106
+ }
107
+ if (connectionId == null || (typeof connectionId === 'string' && connectionId.trim() === '')) {
108
+ connectionId = input?.connectionId;
109
+ connectionSource = 'input.connectionId';
110
+ }
111
+ if (connectionId == null || (typeof connectionId === 'string' && connectionId.trim() === '')) {
112
+ connectionId = undefined;
113
+ connectionSource = undefined;
114
+ }
115
+ const index = pending.length;
116
+ firstIndex ??= index;
117
+ const flag = step.rootStep;
118
+ if (rootIndex === undefined && (flag === true || (typeof flag === 'string' && flag.trim().toLowerCase() === 'true')))
119
+ rootIndex = index;
120
+ if (beginIndex === undefined && (step.provider === 'Begin' || step.displayType === 'Begin'))
121
+ beginIndex = index;
122
+ pending.push({
123
+ kind: 'accepted', scope: host.scope, stage, authoredIndex, address, key, isEntry: false, step,
124
+ executor: step.provider ?? step.displayType,
125
+ payload, recovery: Object.hasOwn(step, 'onError') ? step.onError : data?.onError,
126
+ connectionId, ...(connectionSource === undefined ? {} : { connectionSource }),
127
+ });
128
+ }
129
+ const entryIndex = rootIndex ?? beginIndex ?? firstIndex;
130
+ for (let index = 0; index < pending.length; index += 1) {
131
+ const declaration = pending[index];
132
+ yield index === entryIndex && declaration.kind === 'accepted' ? { ...declaration, isEntry: true } : declaration;
133
+ }
134
+ }
135
+ }
136
+ //# sourceMappingURL=declarations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarations.js","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAqC1G,yEAAyE;AACzE,MAAM,UAAU,iBAAiB,CAAC,IAAyB;IACzD,OAAO,WAAW,CAAC;QACjB,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC;QAC1E,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,KAAK,SAAS;YACxC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACtE,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,WAAsC;IACjE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,IAA0D,CAAC;IAC/E,MAAM,QAAQ,GAAG,OAAO,MAAM,EAAE,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,Q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gBAAgB,EAAE,CAAC;aAC9E,CAAC,CAAC;QACL,CAAC;QACD,MAAM,UAAU,GAAG,SAAS,IAAI,UAAU,IAAI,UAAU,CAAC;QACzD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YACvD,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAE,CAAC;YACpC,MAAM,KAAK,KAAK,UAAU,IAAI,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;QAClH,CAAC;IACH,CAAC;AACH,CAAC"}
package/dist/flow.d.ts CHANGED
@@ -1,4 +1,34 @@
1
- import { type StageEdge, type StageDefinition, type WorkerCollection, type PullerKind } from './stages.js';
1
+ /**
2
+ * A worker component's flow and its node index, from ONE pass — Story 4.1 AC-3 and AC-4.
3
+ *
4
+ * ### Why one pass is an acceptance criterion rather than an optimisation
5
+ *
6
+ * AC-3: *"the diagram and the node index come from one pass"*. Two passes are how a synthesised node ends up in one
7
+ * and not the other — drawn but unaddressable, or addressable but undrawn. Either way a click resolves to nothing,
8
+ * and the failure is invisible until someone clicks. So `workerFlow` returns nodes and edges together and there is
9
+ * no second entry point that produces only one of them.
10
+ *
11
+ * ### Every node is addressed by AD-33, including the synthesised ones
12
+ *
13
+ * A step node is `<component>:<stage>:key_<stepKey>`. A **decision** node is the branch's own path —
14
+ * `<step>:next:if` or `<step>:data:if` — which is what makes it stable: the diamond keeps that address however many
15
+ * steps are added around it. The three previous schemes all numbered it (`_D_<n>`, `_IF_<n>`), so inserting a step
16
+ * above renumbered a node that nothing had renamed.
17
+ *
18
+ * A synthesised node carries `owner`, the address of the step that produced it, so a click on the diamond resolves
19
+ * to a real line in a real file (AC-3's *"the node reports the step that produced it"*).
20
+ *
21
+ * ### Source location arrives as DATA (AD-3)
22
+ *
23
+ * `file`, `range` and `sourceText` are supplied by a `locate` callback rather than read here. This package is core:
24
+ * it cannot open a file, and the extension bundles it into a host with no filesystem at all. Story 4.1 records that
25
+ * this half exists nowhere yet for a worker step — the only source-range machinery in any repo is dashboard's
26
+ * *frontend* path — so the seam is defined here and the producer is an adapter's job. A node whose location the
27
+ * caller cannot supply simply has none, which is the honest answer rather than a guessed line number.
28
+ */
29
+ import { type StageEdge, type StageDefinition, type WorkerHostCollection, type WorkerHostInput, type WorkerHostScope, type EffectiveWorkerHost, type PullerKind } from './stages.js';
30
+ import { type WorkerDeclarationDiagnostic } from './declarations.js';
31
+ import { type JunctionKind, type RouteArm, type RouteCertainty, type RouteRole } from './routeGraph.js';
2
32
  /** Where a node came from in the authored source. Every field optional: an absent location is not a guessed one. */
3
33
  export interface NodeLocation {
4
34
  /** The authored file, as the caller identifies files — a URI here, a path there. Never parsed by this package. */
@@ -19,7 +49,7 @@ export interface NodeLocation {
19
49
  }
20
50
  /** What the caller is asked to locate. Enough to find the node without knowing this package's internals. */
21
51
  export interface LocateRequest {
22
- readonly collection: WorkerCollection;
52
+ readonly collection: WorkerHostCollection;
23
53
  readonly stage: string;
24
54
  /** Absent for a synthesised node, which has no line of its own. */
25
55
  readonly stepKey?: string;
@@ -48,8 +78,8 @@ export interface FlowNode extends NodeLocation {
48
78
  readonly runtime: 'worker';
49
79
  readonly stage: string;
50
80
  /**
51
- * The step's type as the worker dispatches it: its string `provider`, else its string `displayType`, else absent
52
- * (`stepOf`). The authored `type` field is never read.
81
+ * String form of the exact selected executor (`provider ?? displayType`); absent for an invalid non-string selection.
82
+ * The authored `type` field is never read.
53
83
  */
54
84
  readonly type?: string;
55
85
  /**
@@ -62,13 +92,7 @@ export interface FlowNode extends NodeLocation {
62
92
  * evidence argued against the behaviour it was used to defend. Story 4.6 could not have reproduced its own baseline.
63
93
  */
64
94
  readonly name?: string;
65
- /**
66
- * An ENTRY step (`rootStep`, or `root`).
67
- *
68
- * For the renderer rather than for routing: a stage arrow must leave a terminal and land on an ENTRY, which is how
69
- * dashboard chooses its target. Without this the renderer could only guess "first in document order" — the fourth
70
- * stage geometry the Story 4.3 review found.
71
- */
95
+ /** The one chosen entry: first rootStep, otherwise exact Begin, otherwise first accepted step. */
72
96
  readonly isEntry?: boolean;
73
97
  /**
74
98
  * A branch point, drawn as a diamond.
@@ -79,15 +103,13 @@ export interface FlowNode extends NodeLocation {
79
103
  */
80
104
  readonly decides: boolean;
81
105
  /**
82
- * What a renderer writes inside a synthesised node: the condition text, the expression, or the unresolved target.
83
- *
84
- * Added by the review: without it, even the one junction the first version created could not carry the baseline's
85
- * label (`cond.if`, or the expression verbatim), and the only candidate carrier was the unimplemented `locate`
86
- * seam.
106
+ * What a renderer may write inside a synthesised node: a controlled caption (`If`, `Switch`, `Possible route`,
107
+ * `Unresolved route`, `Invalid route`, a cycle note) or the literal key a dead end names. Never a condition or an
108
+ * expression: those are step payload, and the structural model does not evaluate or copy them.
87
109
  */
88
110
  readonly label?: string;
89
111
  /** For a synthesised node, which kind it is — so a renderer picks a shape without parsing the label. */
90
- readonly junction?: 'if' | 'expression' | 'unknown';
112
+ readonly junction?: JunctionKind;
91
113
  /** For a step node, its authored key. Absent on a synthesised node, which has no key of its own. */
92
114
  readonly stepKey?: string;
93
115
  /** For a synthesised node, the address of the step that produced it. */
@@ -96,8 +118,9 @@ export interface FlowNode extends NodeLocation {
96
118
  /** The whole model for one component. */
97
119
  export interface WorkerFlow {
98
120
  readonly address: string;
99
- readonly collection: WorkerCollection;
100
- /** Reported, never used to choose the stage list. */
121
+ readonly collection: WorkerHostCollection;
122
+ readonly scope: WorkerHostScope;
123
+ readonly eligibility: EffectiveWorkerHost['eligibility'];
101
124
  readonly pullerKind?: PullerKind;
102
125
  readonly stages: readonly StageDefinition[];
103
126
  readonly stageEdges: readonly StageEdge[];
@@ -105,16 +128,7 @@ export interface WorkerFlow {
105
128
  readonly nodes: readonly FlowNode[];
106
129
  /** Edges between nodes, with both ends as ADDRESSES. Every end is indexed in `nodes`. */
107
130
  readonly edges: readonly FlowEdgeAddressed[];
108
- /**
109
- * Step keys declared more than once in one stage, and therefore dropped.
110
- *
111
- * Present only when it happened, so a consumer that does not care reads nothing — but reported rather than
112
- * swallowed: one corpus file does this, and a graph that is quietly smaller than the document is its own defect.
113
- */
114
- readonly duplicateStepKeys?: readonly {
115
- readonly stage: string;
116
- readonly key: string;
117
- }[];
131
+ readonly diagnostics: readonly WorkerDeclarationDiagnostic[];
118
132
  }
119
133
  /** A route edge with both ends addressed, and its unresolved cases preserved. */
120
134
  export interface FlowEdgeAddressed {
@@ -130,32 +144,20 @@ export interface FlowEdgeAddressed {
130
144
  readonly to: string;
131
145
  readonly label?: string;
132
146
  readonly stage: string;
147
+ /**
148
+ * The declaring field: `next`, an IF/SWITCH payload `branch`, `onError` `recovery`, or a `fromStep` `exception`.
149
+ * Stage-local routing only — host lifecycle between stages is `stageEdges`, never a route edge.
150
+ */
151
+ readonly role: RouteRole;
152
+ /** `possible` for a dynamic-route candidate or a SWITCH case; never presented as a chosen transition. */
153
+ readonly certainty: RouteCertainty;
154
+ /** The conditional (`then`/`else`) or SWITCH (`case`) arm the edge leaves by. */
155
+ readonly arm?: RouteArm;
133
156
  }
134
- export interface WorkerFlowInput {
135
- readonly collection: WorkerCollection;
136
- /** The parsed component, authored form. */
137
- readonly component: Record<string, unknown>;
138
- /** Its `id`, authored — AD-33 keeps the token rather than a composed GUID. */
139
- readonly componentId?: unknown;
157
+ export type WorkerFlowInput = WorkerHostInput & {
140
158
  /** Supplies file/range/sourceText for a node, or nothing. */
141
159
  readonly locate?: (request: LocateRequest) => NodeLocation | undefined;
142
- }
143
- /**
144
- * ⛔ `branchOf` was DELETED here (Story 4.1 review, MEDIUM-2).
145
- *
146
- * It decided independently of `routeEdges` what "branches" means, and the two disagreed: an `IF` whose `data`
147
- * carried only `{ expression }` was meant to route through its `next` while `branchOf` synthesised a diamond anyway —
148
- * an orphan node asserting a decision the document does not make. Two functions owning one concept, with only one of
149
- * them the authority.
150
- *
151
- * ⚠️ **Correction (Story 4.7 review).** The route graph did NOT in fact route that case through `next` — it drew the
152
- * diamond and dropped the `next` edge, orphaning its target, so this paragraph described the intent rather than the
153
- * behaviour for two stories. `routeGraph.ts` now has the fallback its flat twin `routes.ts` always had. Deleting
154
- * `branchOf` was still the right call; the claim about what survived it was just untrue until now.
155
- *
156
- * `routeGraph` is now that single authority: it decides where a junction belongs *while* placing the edge that
157
- * reaches it, so a junction cannot exist without an arrow into it and an arrow cannot bypass one.
158
- */
160
+ };
159
161
  /**
160
162
  * The flow model and the node index for one component.
161
163
  *
@@ -1 +1 @@
1
- {"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../src/flow.ts"],"names":[],"mappings":"AAkCA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AAIrB,oHAAoH;AACpH,MAAM,WAAW,YAAY;IAC3B,kHAAkH;IAClH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,KAAK,EAAE;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC;QACtE,QAAQ,CAAC,GAAG,EAAE;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC;KACrE,CAAC;IACF,uFAAuF;IACvF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,4GAA4G;AAC5G,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,QAA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C,WAAW,EAAE,SAAS,2BAA2B,EAAE,CAAC;CAC9D;AAED,iFAAiF;AACjF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,yGAAyG;IACzG,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,iFAAiF;IACjF,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;CACzB;AAED,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC9C,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,YAAY,GAAG,SAAS,CAAC;CACxE,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,UAAU,CAiH7D"}
package/dist/flow.js CHANGED
@@ -26,108 +26,9 @@
26
26
  * *frontend* path — so the seam is defined here and the producer is an adapter's job. A node whose location the
27
27
  * caller cannot supply simply has none, which is the honest answer rather than a guessed line number.
28
28
  */
29
- import { keySegment, identitySegment, nodeAddress, normalizeComponentKey, } from '@beehexa/hexasync-template-model';
30
- import { stagesPresent, stageEdges, pullerKindOf, } from './stages.js';
31
- import { routeGraph, junctionAddress } from './routeGraph.js';
32
- /**
33
- * A boolean flag as authored — `true`, or the string a JSON-served profile may carry.
34
- *
35
- * Deliberately narrow: only the exact strings `'true'`/`'TRUE'` (any case, trimmed) count. `'1'`, `'yes'` and the like
36
- * are NOT accepted, because widening a flag reader is how `'false'`-adjacent values start meaning true somewhere down
37
- * the line — and no corpus or UI has ever written them for this field.
38
- */
39
- function isTruthyFlag(value) {
40
- return (value === true ||
41
- (typeof value === 'string' && value.trim().toLowerCase() === 'true'));
42
- }
43
- /**
44
- * A step's own `key`/`name`/type, read defensively: a document is untrusted input.
45
- *
46
- * The type is the step's string `provider`, else its string `displayType`, else absent — the order the worker
47
- * dispatches by (`provider ?? displayType`) and the value it records as an occurrence's `provider`, so the glyph
48
- * family, the label's type text, the branching test and the inspector's evidence renderer all name ONE step type.
49
- * The authored `type` field is never read: the worker does not dispatch on it, and a step carrying
50
- * `{ provider: 'IF', type: 'API' }` drew an API glyph over a node the inspector then rendered as a branch (FR39).
51
- */
52
- function stepOf(raw) {
53
- if (!raw || typeof raw !== 'object' || Array.isArray(raw))
54
- return undefined;
55
- const step = raw;
56
- const key = typeof step.key === 'string' ? step.key : undefined;
57
- if (key === undefined || key === '')
58
- return undefined;
59
- /**
60
- * A step the composer DELETES is not in the flow (Story 4.1 review, HIGH-2).
61
- *
62
- * `!CHECK_EXISTS_ITEMS` is the corpus's one such key — `001-projects/continental-cosmetics/…/QuickBooksCategoryPusher.override.yaml`.
63
- * AD-33 rule 6 stops the `!` reaching an address, and this used to be the whole treatment: the node was still
64
- * created, and `identitySegment` refusing the segment silently re-addressed it onto its PARENT STAGE. Three
65
- * consequences, all real: `addressMatches` then made every sibling step a descendant of the phantom, so clicking
66
- * it selected the entire stage; the node reported a raw `stepKey` no composed document contains, disagreeing with
67
- * its own normalised address; and two removed steps in one stage collapsed onto one byte-identical address.
68
- *
69
- * Rule 6 was adopted so an address is never minted for a node the composer deletes. Skipping the step is the only
70
- * reading of that which also declines to mint the NODE.
71
- */
72
- if (normalizeComponentKey(key)?.removes === true)
73
- return undefined;
74
- const type = typeof step.provider === 'string'
75
- ? step.provider
76
- : typeof step.displayType === 'string'
77
- ? step.displayType
78
- : undefined;
79
- const name = typeof step.name === 'string' && step.name.trim() !== ''
80
- ? step.name.trim()
81
- : undefined;
82
- // `rootStep` is the worker spelling; `root` is the frontend's. Both accepted, since a document may use either.
83
- //
84
- // The STRING `'true'` counts. A YAML corpus writes a bare `rootStep: true` (5,060 of 5,060 occurrences), so a
85
- // boolean-only test looks complete when read against the templates — but a profile served to a UI as JSON can carry
86
- // the quoted form, and `dashboard-v2` types the field as `rootStep?: string` and tested `String(s.rootStep) ===
87
- // 'true'` in the emitter this package replaced. A coercion like that is written because the strict test failed.
88
- // Missing it does not error: entry detection just silently picks the first declared step, so an inter-stage arrow
89
- // lands on the wrong node and the diagram still looks plausible.
90
- const isEntry = isTruthyFlag(step.rootStep) || isTruthyFlag(step.root);
91
- return {
92
- key,
93
- ...(step.next !== undefined ? { next: step.next } : {}),
94
- ...(type !== undefined ? { stepType: type, type } : {}),
95
- ...(step.data !== undefined ? { data: step.data } : {}),
96
- ...(step.onError !== undefined ? { onError: step.onError } : {}),
97
- /**
98
- * `fromStep`, from the step or from its `data` — an Exception step is authored both ways.
99
- *
100
- * `data.fromStep` is the RUNTIME's own spelling: `ErrorExecutor` reads `$.data.fromStep` first and falls back to
101
- * `$.fromStep`, and every `StepIteratorTests` fixture writes it under `data`. The report's `toFlowStep` accepted
102
- * both; this read only the top level, so an Exception step authored the runtime's way lost its `|"Exception"|`
103
- * back-edge entirely (Story 4.6 review, L1).
104
- */
105
- ...(typeof step.fromStep === 'string'
106
- ? { fromStep: step.fromStep }
107
- : typeof step.data?.fromStep ===
108
- 'string'
109
- ? { fromStep: step.data.fromStep }
110
- : {}),
111
- ...(name !== undefined ? { name } : {}),
112
- ...(isEntry ? { isEntry: true } : {}),
113
- };
114
- }
115
- /**
116
- * ⛔ `branchOf` was DELETED here (Story 4.1 review, MEDIUM-2).
117
- *
118
- * It decided independently of `routeEdges` what "branches" means, and the two disagreed: an `IF` whose `data`
119
- * carried only `{ expression }` was meant to route through its `next` while `branchOf` synthesised a diamond anyway —
120
- * an orphan node asserting a decision the document does not make. Two functions owning one concept, with only one of
121
- * them the authority.
122
- *
123
- * ⚠️ **Correction (Story 4.7 review).** The route graph did NOT in fact route that case through `next` — it drew the
124
- * diamond and dropped the `next` edge, orphaning its target, so this paragraph described the intent rather than the
125
- * behaviour for two stories. `routeGraph.ts` now has the fallback its flat twin `routes.ts` always had. Deleting
126
- * `branchOf` was still the right call; the claim about what survived it was just untrue until now.
127
- *
128
- * `routeGraph` is now that single authority: it decides where a junction belongs *while* placing the edge that
129
- * reaches it, so a junction cannot exist without an arrow into it and an arrow cannot bypass one.
130
- */
29
+ import { selectEffectiveHost, stageEdges, } from './stages.js';
30
+ import { acceptedWorkerDeclarations, routableStep, workerHostAddress, } from './declarations.js';
31
+ import { routeGraph, junctionAddress, } from './routeGraph.js';
131
32
  /**
132
33
  * The flow model and the node index for one component.
133
34
  *
@@ -135,66 +36,51 @@ function stepOf(raw) {
135
36
  * can contain something the other does not know about — see the note on "one pass" above.
136
37
  */
137
38
  export function workerFlow(input) {
138
- const { collection, component, componentId, locate } = input;
139
- const base = nodeAddress([
140
- keySegment(collection),
141
- identitySegment(componentId, 'id'),
142
- ]);
143
- const stages = stagesPresent(collection, component);
39
+ const { collection, locate } = input;
40
+ const host = selectEffectiveHost(input);
41
+ const base = workerHostAddress(host);
42
+ const stages = host.eligibility === 'unbound' ? [] : host.stages.filter(stage => {
43
+ const raw = host.component[stage.key];
44
+ return Array.isArray(raw) && raw.length > 0;
45
+ });
144
46
  const nodes = [];
145
47
  const edges = [];
146
- const duplicates = [];
147
- for (const stage of stages) {
148
- const raw = component[stage.key];
149
- const parsed = raw.map(stepOf).filter((s) => s !== undefined);
150
- /**
151
- * Steps are DE-DUPLICATED by key, and the duplicates are dropped (Story 4.1 review, HIGH-1).
152
- *
153
- * One corpus pusher — `001-projects/ru9/rubaby/partials/Pusher-SapoOmniOrder.yaml` — declares `key: CREATE`
154
- * twice in one `pushSteps`, and it survives composition. Addressing both produced two nodes with ONE address,
155
- * the second step's route attributed to the first node, and `addressForRenderedId` returning `undefined` — a
156
- * click resolving to nothing, which is the failure this model's own docblock calls invisible until someone
157
- * clicks.
158
- *
159
- * Dropped rather than disambiguated with a counter: a counter is what AD-33 exists to remove, and the runtime
160
- * itself cannot address the second `CREATE` either — `next: CREATE` names the first. Reported so the caller can
161
- * surface it, because a silently smaller graph is its own defect.
162
- */
163
- const steps = [];
164
- for (const step of parsed) {
165
- if (steps.some((s) => s.key === step.key)) {
166
- duplicates.push({ stage: stage.key, key: String(step.key) });
167
- continue;
168
- }
169
- steps.push(step);
170
- }
171
- /** Each step's address, and the map every edge end is resolved through. */
172
- const addressOf = new Map();
173
- for (const step of steps) {
174
- addressOf.set(step.key, nodeAddress([
175
- keySegment(base),
176
- keySegment(stage.key),
177
- identitySegment(step.key, 'key'),
178
- ]));
48
+ const diagnostics = [];
49
+ const byStage = new Map();
50
+ for (const declaration of acceptedWorkerDeclarations(host)) {
51
+ if (declaration.kind === 'rejected') {
52
+ diagnostics.push(declaration);
53
+ continue;
179
54
  }
55
+ const bucket = byStage.get(declaration.stage.key);
56
+ if (bucket)
57
+ bucket.push(declaration);
58
+ else
59
+ byStage.set(declaration.stage.key, [declaration]);
60
+ }
61
+ for (const stage of stages) {
62
+ const declarations = byStage.get(stage.key) ?? [];
63
+ const steps = declarations.map(routableStep);
64
+ const addressOf = new Map(declarations.map(declaration => [declaration.key, declaration.address]));
180
65
  const graph = routeGraph(steps);
66
+ /** Junction path → address, keyed by an unambiguous tuple (a step key may contain spaces). */
181
67
  const junctionOf = new Map();
182
- for (const step of steps) {
183
- const address = addressOf.get(step.key);
68
+ for (const declaration of declarations) {
69
+ const { step, key, executor, address, isEntry } = declaration;
184
70
  nodes.push({
185
71
  address,
186
72
  runtime: 'worker',
187
73
  stage: stage.key,
188
- ...(step.type !== undefined ? { type: step.type } : {}),
189
- ...(step.name !== undefined ? { name: step.name } : {}),
190
- ...(step.isEntry === true ? { isEntry: true } : {}),
74
+ ...(typeof executor === 'string' ? { type: executor } : {}),
75
+ ...(typeof step.name === 'string' && step.name.trim() !== '' ? { name: step.name.trim() } : {}),
76
+ ...(isEntry ? { isEntry: true } : {}),
191
77
  // A step is never itself the diamond — see `decides`.
192
78
  decides: false,
193
- stepKey: step.key,
79
+ stepKey: key,
194
80
  ...(locate?.({
195
81
  collection,
196
82
  stage: stage.key,
197
- stepKey: step.key,
83
+ stepKey: key,
198
84
  address,
199
85
  }) ?? {}),
200
86
  });
@@ -204,7 +90,7 @@ export function workerFlow(input) {
204
90
  if (owner === undefined)
205
91
  continue;
206
92
  const address = junctionAddress(owner, point.path);
207
- junctionOf.set(`${point.owner} ${point.path.join(' ')}`, address);
93
+ junctionOf.set(JSON.stringify([point.owner, ...point.path]), address);
208
94
  nodes.push({
209
95
  address,
210
96
  runtime: 'worker',
@@ -227,7 +113,7 @@ export function workerFlow(input) {
227
113
  /** An edge end, as an address. */
228
114
  const endAddress = (end) => end.kind === 'step'
229
115
  ? addressOf.get(end.key)
230
- : junctionOf.get(`${end.owner} ${end.path.join(' ')}`);
116
+ : junctionOf.get(JSON.stringify([end.owner, ...end.path]));
231
117
  for (const edge of graph.edges) {
232
118
  const from = endAddress(edge.from);
233
119
  const to = endAddress(edge.to);
@@ -240,20 +126,24 @@ export function workerFlow(input) {
240
126
  to,
241
127
  ...(edge.label !== undefined ? { label: edge.label } : {}),
242
128
  stage: stage.key,
129
+ role: edge.role,
130
+ certainty: edge.certainty,
131
+ ...(edge.arm !== undefined ? { arm: edge.arm } : {}),
243
132
  });
244
133
  }
245
134
  }
246
135
  return {
247
136
  address: base,
248
137
  collection,
249
- ...(collection === 'pullers'
250
- ? { pullerKind: pullerKindOf(component) }
251
- : {}),
138
+ scope: host.scope,
139
+ eligibility: host.eligibility,
140
+ ...(host.collection === 'pullers' && (host.mode === 'legacy' || host.mode === 'steps')
141
+ ? { pullerKind: host.mode } : {}),
252
142
  stages,
253
- stageEdges: stageEdges(collection, component),
143
+ stageEdges: host.eligibility === 'unbound' ? [] : stageEdges(collection, host.component),
254
144
  nodes,
255
145
  edges,
256
- ...(duplicates.length > 0 ? { duplicateStepKeys: duplicates } : {}),
146
+ diagnostics,
257
147
  };
258
148
  }
259
149
  //# sourceMappingUR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