@beehexa/hexasync-template-model 2608.21.4 → 2610.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canonicalGraph.d.ts +153 -0
- package/dist/canonicalGraph.d.ts.map +1 -0
- package/dist/canonicalGraph.js +321 -0
- package/dist/canonicalGraph.js.map +1 -0
- package/dist/collapseRule.d.ts +125 -0
- package/dist/collapseRule.d.ts.map +1 -0
- package/dist/collapseRule.js +87 -0
- package/dist/collapseRule.js.map +1 -0
- package/dist/flowRender.d.ts +364 -18
- package/dist/flowRender.d.ts.map +1 -1
- package/dist/flowRender.js +956 -123
- package/dist/flowRender.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/nodeAddress.d.ts +81 -0
- package/dist/nodeAddress.d.ts.map +1 -1
- package/dist/nodeAddress.js +70 -0
- package/dist/nodeAddress.js.map +1 -1
- package/dist/occurrenceExpansion.d.ts +50 -0
- package/dist/occurrenceExpansion.d.ts.map +1 -0
- package/dist/occurrenceExpansion.js +230 -0
- package/dist/occurrenceExpansion.js.map +1 -0
- package/dist/stepGlyph.d.ts +242 -29
- package/dist/stepGlyph.d.ts.map +1 -1
- package/dist/stepGlyph.js +403 -104
- package/dist/stepGlyph.js.map +1 -1
- package/dist/workerStepVocabularyAudit.d.ts +19 -0
- package/dist/workerStepVocabularyAudit.d.ts.map +1 -0
- package/dist/workerStepVocabularyAudit.js +134 -0
- package/dist/workerStepVocabularyAudit.js.map +1 -0
- package/dist/workflowMigration.d.ts +60 -0
- package/dist/workflowMigration.d.ts.map +1 -0
- package/dist/workflowMigration.js +75 -0
- package/dist/workflowMigration.js.map +1 -0
- package/manifests/collapse-rule.json +43 -0
- package/manifests/worker-step-roster.json +164 -0
- package/package.json +6 -2
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
export declare const CANONICAL_GRAPH_SCHEMA_VERSION: 1;
|
|
2
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
|
|
4
|
+
export interface JsonObject {
|
|
5
|
+
readonly [field: string]: JsonValue | undefined;
|
|
6
|
+
}
|
|
7
|
+
export type CanonicalContainerScope = 'top-level' | 'subprocess' | 'stage' | 'projection';
|
|
8
|
+
export interface QualifiedStepReference {
|
|
9
|
+
readonly dialect: string;
|
|
10
|
+
readonly provider: string;
|
|
11
|
+
readonly registryRevision?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CanonicalContainer {
|
|
14
|
+
readonly documentId: string;
|
|
15
|
+
readonly workflowId: string;
|
|
16
|
+
readonly scope: CanonicalContainerScope;
|
|
17
|
+
readonly stage?: string;
|
|
18
|
+
readonly parentNodeId?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface SourcePointer {
|
|
21
|
+
readonly adapterId: string;
|
|
22
|
+
readonly adapterVersion: string;
|
|
23
|
+
readonly path: string;
|
|
24
|
+
readonly derived: boolean;
|
|
25
|
+
readonly canonicalField?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface GraphCapabilities {
|
|
28
|
+
readonly semanticEdit: boolean;
|
|
29
|
+
readonly presentationEdit: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface EdgeCapabilities {
|
|
32
|
+
readonly reconnect: boolean;
|
|
33
|
+
readonly delete: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface CanonicalPort {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly nodeId: string;
|
|
38
|
+
readonly direction: 'input' | 'output';
|
|
39
|
+
readonly kind: string;
|
|
40
|
+
readonly provenance: readonly SourcePointer[];
|
|
41
|
+
}
|
|
42
|
+
export interface CanonicalRoute {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly sourceNodeId: string;
|
|
45
|
+
readonly sourcePortId: string;
|
|
46
|
+
readonly kind: string;
|
|
47
|
+
readonly targetIdentity?: string;
|
|
48
|
+
readonly role?: string;
|
|
49
|
+
readonly label?: string;
|
|
50
|
+
readonly order?: number;
|
|
51
|
+
readonly expression?: CanonicalExpression;
|
|
52
|
+
readonly conditions?: readonly CanonicalRouteCondition[];
|
|
53
|
+
readonly potentialBranches?: readonly CanonicalPotentialBranch[];
|
|
54
|
+
readonly provenance: readonly SourcePointer[];
|
|
55
|
+
}
|
|
56
|
+
export interface CanonicalExpression {
|
|
57
|
+
readonly provider: string;
|
|
58
|
+
readonly source: string;
|
|
59
|
+
}
|
|
60
|
+
export interface CanonicalRouteCondition {
|
|
61
|
+
readonly expression: CanonicalExpression;
|
|
62
|
+
readonly outcome: boolean;
|
|
63
|
+
readonly provenance: readonly SourcePointer[];
|
|
64
|
+
}
|
|
65
|
+
export interface CanonicalPotentialBranch {
|
|
66
|
+
readonly role: string;
|
|
67
|
+
readonly label?: string;
|
|
68
|
+
readonly targetIdentity?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface CanonicalEdge {
|
|
71
|
+
readonly id: string;
|
|
72
|
+
readonly source: {
|
|
73
|
+
readonly nodeId: string;
|
|
74
|
+
readonly portId: string;
|
|
75
|
+
};
|
|
76
|
+
readonly target: {
|
|
77
|
+
readonly nodeId: string;
|
|
78
|
+
readonly portId: string;
|
|
79
|
+
};
|
|
80
|
+
readonly kind: string;
|
|
81
|
+
readonly provenance: readonly SourcePointer[];
|
|
82
|
+
readonly capabilities: EdgeCapabilities;
|
|
83
|
+
}
|
|
84
|
+
export interface CanonicalNode {
|
|
85
|
+
readonly id: string;
|
|
86
|
+
readonly sourceIdentity: string;
|
|
87
|
+
readonly sourceAddress: string;
|
|
88
|
+
readonly stepRef: QualifiedStepReference;
|
|
89
|
+
readonly container: CanonicalContainer;
|
|
90
|
+
readonly kind: string;
|
|
91
|
+
readonly displayType: string;
|
|
92
|
+
readonly source: JsonObject;
|
|
93
|
+
readonly ports: readonly CanonicalPort[];
|
|
94
|
+
readonly provenance: readonly SourcePointer[];
|
|
95
|
+
readonly capabilities: GraphCapabilities;
|
|
96
|
+
}
|
|
97
|
+
export interface GraphDiagnostic {
|
|
98
|
+
readonly code: string;
|
|
99
|
+
readonly severity: 'info' | 'warning' | 'error';
|
|
100
|
+
readonly phase: 'compile';
|
|
101
|
+
readonly message: string;
|
|
102
|
+
readonly elementId?: string;
|
|
103
|
+
readonly graphId?: string;
|
|
104
|
+
readonly details?: Readonly<Record<string, JsonValue | undefined>>;
|
|
105
|
+
readonly causeCode?: string;
|
|
106
|
+
readonly source: SourcePointer;
|
|
107
|
+
readonly recoverable: boolean;
|
|
108
|
+
}
|
|
109
|
+
export interface WorkflowGraph {
|
|
110
|
+
readonly schemaVersion: typeof CANONICAL_GRAPH_SCHEMA_VERSION;
|
|
111
|
+
readonly graphId: string;
|
|
112
|
+
readonly dialect: string;
|
|
113
|
+
readonly sourceFingerprint: string;
|
|
114
|
+
readonly nodes: readonly CanonicalNode[];
|
|
115
|
+
readonly ports: readonly CanonicalPort[];
|
|
116
|
+
readonly routes: readonly CanonicalRoute[];
|
|
117
|
+
readonly edges: readonly CanonicalEdge[];
|
|
118
|
+
readonly capabilities: GraphCapabilities;
|
|
119
|
+
readonly provenance: readonly SourcePointer[];
|
|
120
|
+
readonly diagnostics: readonly GraphDiagnostic[];
|
|
121
|
+
}
|
|
122
|
+
export interface GenericWorkflowSource extends JsonObject {
|
|
123
|
+
readonly id?: JsonPrimitive;
|
|
124
|
+
readonly key?: JsonPrimitive;
|
|
125
|
+
readonly steps?: readonly JsonValue[];
|
|
126
|
+
}
|
|
127
|
+
export interface GenericWorkflowAdapterOptions {
|
|
128
|
+
readonly adapterId?: string;
|
|
129
|
+
readonly adapterVersion?: string;
|
|
130
|
+
readonly identityFields?: readonly string[];
|
|
131
|
+
readonly displayTypeFields?: readonly string[];
|
|
132
|
+
readonly supportedTypes?: readonly string[];
|
|
133
|
+
readonly dialect?: string;
|
|
134
|
+
readonly provider?: string;
|
|
135
|
+
readonly registryRevision?: string;
|
|
136
|
+
readonly container?: Partial<CanonicalContainer>;
|
|
137
|
+
readonly capabilities?: Partial<GraphCapabilities>;
|
|
138
|
+
}
|
|
139
|
+
export interface WorkflowSourceAdapter {
|
|
140
|
+
readonly id: string;
|
|
141
|
+
readonly version: string;
|
|
142
|
+
readonly identityFields: readonly string[];
|
|
143
|
+
readonly displayTypeFields: readonly string[];
|
|
144
|
+
readonly supportedTypes?: readonly string[];
|
|
145
|
+
readonly dialect: string;
|
|
146
|
+
readonly provider?: string;
|
|
147
|
+
readonly registryRevision?: string;
|
|
148
|
+
readonly container?: Partial<CanonicalContainer>;
|
|
149
|
+
readonly capabilities: GraphCapabilities;
|
|
150
|
+
}
|
|
151
|
+
export declare function genericWorkflowAdapter(options?: GenericWorkflowAdapterOptions): WorkflowSourceAdapter;
|
|
152
|
+
export declare function compileWorkflowGraph(source: GenericWorkflowSource, adapter: WorkflowSourceAdapter): WorkflowGraph;
|
|
153
|
+
//# sourceMappingURL=canonicalGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonicalGraph.d.ts","sourceRoot":"","sources":["../src/canonicalGraph.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,EAAG,CAAU,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,SAAS,EAAE,CAAC;AAC1E,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACjD;AACD,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG,YAAY,GAAG,OAAO,GAAG,YAAY,CAAC;AAC1F,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CA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CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjD,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACpD;AACD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjD,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;CAC1C;AAED,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,6BAAkC,GAC1C,qBAAqB,CAuBvB;AA+ED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,qBAAqB,GAC7B,aAAa,CA6Pf"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { identitySegment, keySegment, nodeAddress } from './nodeAddress.js';
|
|
2
|
+
export const CANONICAL_GRAPH_SCHEMA_VERSION = 1;
|
|
3
|
+
export function genericWorkflowAdapter(options = {}) {
|
|
4
|
+
const identityFields = options.identityFields ?? ['id', 'key'];
|
|
5
|
+
const displayTypeFields = options.displayTypeFields ?? ['type', 'displayType'];
|
|
6
|
+
if (identityFields.length === 0 || displayTypeFields.length === 0) {
|
|
7
|
+
throw new Error('A workflow adapter requires identity and display-type fields.');
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
id: options.adapterId ?? 'generic',
|
|
11
|
+
version: options.adapterVersion ?? '1',
|
|
12
|
+
identityFields: [...identityFields],
|
|
13
|
+
displayTypeFields: [...displayTypeFields],
|
|
14
|
+
...(options.supportedTypes === undefined
|
|
15
|
+
? {}
|
|
16
|
+
: { supportedTypes: [...options.supportedTypes] }),
|
|
17
|
+
dialect: options.dialect ?? 'generic/v1',
|
|
18
|
+
...(options.provider === undefined ? {} : { provider: options.provider }),
|
|
19
|
+
...(options.registryRevision === undefined ? {} : { registryRevision: options.registryRevision }),
|
|
20
|
+
...(options.container === undefined ? {} : { container: options.container }),
|
|
21
|
+
capabilities: {
|
|
22
|
+
semanticEdit: options.capabilities?.semanticEdit ?? false,
|
|
23
|
+
presentationEdit: options.capabilities?.presentationEdit ?? true,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const objectOf = (value) => typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
28
|
+
? value
|
|
29
|
+
: undefined;
|
|
30
|
+
const textOf = (value) => {
|
|
31
|
+
if (typeof value === 'string')
|
|
32
|
+
return value.trim() === '' ? undefined : value;
|
|
33
|
+
return typeof value === 'number' ? String(value) : undefined;
|
|
34
|
+
};
|
|
35
|
+
const firstField = (record, fields) => {
|
|
36
|
+
for (const field of fields) {
|
|
37
|
+
const value = textOf(record[field]);
|
|
38
|
+
if (value !== undefined)
|
|
39
|
+
return { field, value };
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
};
|
|
43
|
+
const stableValue = (value) => {
|
|
44
|
+
if (Array.isArray(value))
|
|
45
|
+
return value.map(stableValue);
|
|
46
|
+
const record = objectOf(value);
|
|
47
|
+
if (!record)
|
|
48
|
+
return value;
|
|
49
|
+
return Object.fromEntries(Object.keys(record).sort().map((key) => [key, stableValue(record[key])]));
|
|
50
|
+
};
|
|
51
|
+
const fingerprintOf = (source) => {
|
|
52
|
+
const input = JSON.stringify(stableValue(source));
|
|
53
|
+
let hash = 2166136261;
|
|
54
|
+
for (let index = 0; index < input.length; index += 1) {
|
|
55
|
+
hash ^= input.charCodeAt(index);
|
|
56
|
+
hash = Math.imul(hash, 16777619);
|
|
57
|
+
}
|
|
58
|
+
return 'fnv1a32:' + (hash >>> 0).toString(16).padStart(8, '0');
|
|
59
|
+
};
|
|
60
|
+
const pointer = (adapter, path, derived = false, canonicalField) => ({
|
|
61
|
+
adapterId: adapter.id,
|
|
62
|
+
adapterVersion: adapter.version,
|
|
63
|
+
path,
|
|
64
|
+
derived,
|
|
65
|
+
...(canonicalField === undefined ? {} : { canonicalField }),
|
|
66
|
+
});
|
|
67
|
+
const fieldPath = (base, field) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(field)
|
|
68
|
+
? base + '.' + field
|
|
69
|
+
: base + '[' + JSON.stringify(field) + ']';
|
|
70
|
+
const encodePart = (value) => {
|
|
71
|
+
if (value === undefined)
|
|
72
|
+
return 'u:';
|
|
73
|
+
return 's' + String(value.length) + ':' + value;
|
|
74
|
+
};
|
|
75
|
+
const qualifiedId = (adapter, container, provider, kind, identity) => [
|
|
76
|
+
adapter.id,
|
|
77
|
+
adapter.version,
|
|
78
|
+
adapter.dialect,
|
|
79
|
+
provider,
|
|
80
|
+
adapter.registryRevision,
|
|
81
|
+
container.documentId,
|
|
82
|
+
container.workflowId,
|
|
83
|
+
container.scope,
|
|
84
|
+
container.stage,
|
|
85
|
+
container.parentNodeId,
|
|
86
|
+
kind,
|
|
87
|
+
identity,
|
|
88
|
+
].map(encodePart).join('|');
|
|
89
|
+
export function compileWorkflowGraph(source, adapter) {
|
|
90
|
+
const workflowIdentity = firstField(source, adapter.identityFields)?.value ?? 'workflow';
|
|
91
|
+
const container = {
|
|
92
|
+
documentId: adapter.container?.documentId ?? workflowIdentity,
|
|
93
|
+
workflowId: adapter.container?.workflowId ?? workflowIdentity,
|
|
94
|
+
scope: adapter.container?.scope ?? 'top-level',
|
|
95
|
+
...(adapter.container?.stage === undefined ? {} : { stage: adapter.container.stage }),
|
|
96
|
+
...(adapter.container?.parentNodeId === undefined
|
|
97
|
+
? {}
|
|
98
|
+
: { parentNodeId: adapter.container.parentNodeId }),
|
|
99
|
+
};
|
|
100
|
+
const graphProvider = adapter.provider ?? '*';
|
|
101
|
+
const graphId = qualifiedId(adapter, container, graphProvider, 'graph', workflowIdentity);
|
|
102
|
+
const diagnostics = [];
|
|
103
|
+
const nodes = [];
|
|
104
|
+
const ports = [];
|
|
105
|
+
const byIdentity = new Map();
|
|
106
|
+
const rawSteps = source.steps;
|
|
107
|
+
const steps = rawSteps === undefined || Array.isArray(rawSteps) ? rawSteps ?? [] : [];
|
|
108
|
+
if (rawSteps !== undefined && !Array.isArray(rawSteps)) {
|
|
109
|
+
diagnostics.push({
|
|
110
|
+
code: 'INVALID_STEPS_COLLECTION',
|
|
111
|
+
severity: 'error',
|
|
112
|
+
phase: 'compile',
|
|
113
|
+
message: 'The steps field must be an array.',
|
|
114
|
+
source: pointer(adapter, '$.steps'),
|
|
115
|
+
recoverable: true,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
steps.forEach((rawStep, index) => {
|
|
119
|
+
const path = '$.steps[' + index + ']';
|
|
120
|
+
const step = objectOf(rawStep);
|
|
121
|
+
if (!step) {
|
|
122
|
+
diagnostics.push({
|
|
123
|
+
code: 'INVALID_STEP',
|
|
124
|
+
severity: 'error',
|
|
125
|
+
phase: 'compile',
|
|
126
|
+
message: 'The step must be an object.',
|
|
127
|
+
source: pointer(adapter, path),
|
|
128
|
+
recoverable: true,
|
|
129
|
+
});
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const identity = firstField(step, adapter.identityFields);
|
|
133
|
+
if (!identity) {
|
|
134
|
+
diagnostics.push({
|
|
135
|
+
code: 'MISSING_STEP_IDENTITY',
|
|
136
|
+
severity: 'error',
|
|
137
|
+
phase: 'compile',
|
|
138
|
+
message: 'The step has no configured identity.',
|
|
139
|
+
source: pointer(adapter, path),
|
|
140
|
+
recoverable: true,
|
|
141
|
+
});
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const addressSegment = identitySegment(identity.value, identity.field === 'id' ? 'id' : 'key');
|
|
145
|
+
if (!addressSegment) {
|
|
146
|
+
diagnostics.push({
|
|
147
|
+
code: 'INVALID_STEP_IDENTITY',
|
|
148
|
+
severity: 'error',
|
|
149
|
+
phase: 'compile',
|
|
150
|
+
message: 'The step identity cannot form an AD-33 address.',
|
|
151
|
+
source: pointer(adapter, fieldPath(path, identity.field)),
|
|
152
|
+
recoverable: true,
|
|
153
|
+
});
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const canonicalIdentity = 'value' in addressSegment
|
|
157
|
+
? addressSegment.value
|
|
158
|
+
: identity.value;
|
|
159
|
+
if (byIdentity.has(canonicalIdentity)) {
|
|
160
|
+
diagnostics.push({
|
|
161
|
+
code: 'DUPLICATE_STEP_IDENTITY',
|
|
162
|
+
severity: 'error',
|
|
163
|
+
phase: 'compile',
|
|
164
|
+
message: 'Duplicate step identity: ' + canonicalIdentity + '.',
|
|
165
|
+
elementId: byIdentity.get(canonicalIdentity)?.id,
|
|
166
|
+
source: pointer(adapter, fieldPath(path, identity.field)),
|
|
167
|
+
recoverable: true,
|
|
168
|
+
});
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const displayTypeField = firstField(step, adapter.displayTypeFields);
|
|
172
|
+
const authoredDisplayType = displayTypeField?.value;
|
|
173
|
+
const unsupportedDisplayType = authoredDisplayType !== undefined
|
|
174
|
+
&& adapter.supportedTypes !== undefined
|
|
175
|
+
&& adapter.supportedTypes.length > 0
|
|
176
|
+
&& !adapter.supportedTypes.includes(authoredDisplayType);
|
|
177
|
+
const displayType = authoredDisplayType === undefined || unsupportedDisplayType
|
|
178
|
+
? 'UNKNOWN'
|
|
179
|
+
: authoredDisplayType;
|
|
180
|
+
const provider = adapter.provider ?? displayType;
|
|
181
|
+
const nodeId = qualifiedId(adapter, container, provider, 'node', canonicalIdentity);
|
|
182
|
+
const stepPointer = pointer(adapter, path);
|
|
183
|
+
const identityDerived = adapter.identityFields.indexOf(identity.field) > 0
|
|
184
|
+
|| canonicalIdentity !== identity.value;
|
|
185
|
+
const fieldProvenance = Object.keys(step).map((field) => pointer(adapter, fieldPath(path, field), false, fieldPath('source', field)));
|
|
186
|
+
fieldProvenance.push(pointer(adapter, fieldPath(path, identity.field), identityDerived, 'sourceIdentity'), pointer(adapter, fieldPath(path, identity.field), identityDerived, 'sourceAddress'));
|
|
187
|
+
if (displayTypeField) {
|
|
188
|
+
const displayTypeDerived = adapter.displayTypeFields.indexOf(displayTypeField.field) > 0
|
|
189
|
+
|| unsupportedDisplayType;
|
|
190
|
+
fieldProvenance.push(pointer(adapter, fieldPath(path, displayTypeField.field), displayTypeDerived, 'displayType'));
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
fieldProvenance.push(pointer(adapter, path, true, 'displayType'));
|
|
194
|
+
}
|
|
195
|
+
const input = {
|
|
196
|
+
id: nodeId + '|4:port|5:input',
|
|
197
|
+
nodeId,
|
|
198
|
+
direction: 'input',
|
|
199
|
+
kind: 'input',
|
|
200
|
+
provenance: [stepPointer],
|
|
201
|
+
};
|
|
202
|
+
const output = {
|
|
203
|
+
id: nodeId + '|4:port|6:output',
|
|
204
|
+
nodeId,
|
|
205
|
+
direction: 'output',
|
|
206
|
+
kind: 'next',
|
|
207
|
+
provenance: [stepPointer],
|
|
208
|
+
};
|
|
209
|
+
const node = {
|
|
210
|
+
id: nodeId,
|
|
211
|
+
sourceIdentity: canonicalIdentity,
|
|
212
|
+
sourceAddress: nodeAddress([keySegment('steps'), addressSegment]),
|
|
213
|
+
stepRef: {
|
|
214
|
+
dialect: adapter.dialect,
|
|
215
|
+
provider,
|
|
216
|
+
...(adapter.registryRevision === undefined
|
|
217
|
+
? {}
|
|
218
|
+
: { registryRevision: adapter.registryRevision }),
|
|
219
|
+
},
|
|
220
|
+
container,
|
|
221
|
+
kind: displayType === 'UNKNOWN'
|
|
222
|
+
? 'unknown'
|
|
223
|
+
: displayType === 'IF' || displayType === 'SWITCH'
|
|
224
|
+
? 'decision'
|
|
225
|
+
: 'task',
|
|
226
|
+
displayType,
|
|
227
|
+
source: step,
|
|
228
|
+
ports: [input, output],
|
|
229
|
+
provenance: [stepPointer, ...fieldProvenance],
|
|
230
|
+
capabilities: adapter.capabilities,
|
|
231
|
+
};
|
|
232
|
+
nodes.push(node);
|
|
233
|
+
ports.push(input, output);
|
|
234
|
+
byIdentity.set(canonicalIdentity, node);
|
|
235
|
+
if (authoredDisplayType === undefined) {
|
|
236
|
+
diagnostics.push({
|
|
237
|
+
code: 'MISSING_STEP_TYPE',
|
|
238
|
+
severity: 'warning',
|
|
239
|
+
phase: 'compile',
|
|
240
|
+
message: 'The step has no configured display type.',
|
|
241
|
+
elementId: node.id,
|
|
242
|
+
source: pointer(adapter, path),
|
|
243
|
+
recoverable: true,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
else if (unsupportedDisplayType && displayTypeField) {
|
|
247
|
+
diagnostics.push({
|
|
248
|
+
code: 'UNSUPPORTED_STEP_TYPE',
|
|
249
|
+
severity: 'warning',
|
|
250
|
+
phase: 'compile',
|
|
251
|
+
message: 'Unsupported step type: ' + authoredDisplayType + '.',
|
|
252
|
+
elementId: node.id,
|
|
253
|
+
source: pointer(adapter, fieldPath(path, displayTypeField.field)),
|
|
254
|
+
recoverable: true,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
const routes = [];
|
|
259
|
+
const edges = [];
|
|
260
|
+
nodes.forEach((node) => {
|
|
261
|
+
const rawTargetIdentity = textOf(node.source.next);
|
|
262
|
+
const targetIdentity = rawTargetIdentity === undefined
|
|
263
|
+
? undefined
|
|
264
|
+
: (() => {
|
|
265
|
+
const segment = identitySegment(rawTargetIdentity, 'id');
|
|
266
|
+
return segment && 'value' in segment ? segment.value : undefined;
|
|
267
|
+
})();
|
|
268
|
+
if (!targetIdentity)
|
|
269
|
+
return;
|
|
270
|
+
const sourcePort = node.ports.find((port) => port.direction === 'output');
|
|
271
|
+
const target = byIdentity.get(targetIdentity);
|
|
272
|
+
const targetPort = target?.ports.find((port) => port.direction === 'input');
|
|
273
|
+
const routePointer = pointer(adapter, node.provenance[0].path + '.next');
|
|
274
|
+
const routeId = node.id + '|5:route|4:next|' + encodePart(targetIdentity);
|
|
275
|
+
routes.push({
|
|
276
|
+
id: routeId,
|
|
277
|
+
sourceNodeId: node.id,
|
|
278
|
+
sourcePortId: sourcePort?.id ?? node.id + '|4:port|6:output',
|
|
279
|
+
kind: 'next',
|
|
280
|
+
targetIdentity,
|
|
281
|
+
provenance: [routePointer],
|
|
282
|
+
});
|
|
283
|
+
if (!target || !sourcePort || !targetPort) {
|
|
284
|
+
diagnostics.push({
|
|
285
|
+
code: 'MISSING_ROUTE_TARGET',
|
|
286
|
+
severity: 'error',
|
|
287
|
+
phase: 'compile',
|
|
288
|
+
message: 'Route target does not exist: ' + targetIdentity + '.',
|
|
289
|
+
elementId: node.id,
|
|
290
|
+
source: routePointer,
|
|
291
|
+
recoverable: true,
|
|
292
|
+
});
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
edges.push({
|
|
296
|
+
id: routeId + '|4:edge|1:0',
|
|
297
|
+
source: { nodeId: node.id, portId: sourcePort.id },
|
|
298
|
+
target: { nodeId: target.id, portId: targetPort.id },
|
|
299
|
+
kind: 'next',
|
|
300
|
+
provenance: [routePointer],
|
|
301
|
+
capabilities: {
|
|
302
|
+
reconnect: adapter.capabilities.semanticEdit,
|
|
303
|
+
delete: adapter.capabilities.semanticEdit,
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
return {
|
|
308
|
+
schemaVersion: CANONICAL_GRAPH_SCHEMA_VERSION,
|
|
309
|
+
graphId,
|
|
310
|
+
dialect: adapter.dialect,
|
|
311
|
+
sourceFingerprint: fingerprintOf(source),
|
|
312
|
+
nodes,
|
|
313
|
+
ports,
|
|
314
|
+
routes,
|
|
315
|
+
edges,
|
|
316
|
+
capabilities: adapter.capabilities,
|
|
317
|
+
provenance: [pointer(adapter, '$')],
|
|
318
|
+
diagnostics,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
//# sourceMappingURL=canonicalGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonicalGraph.js","sourceRoot":"","sources":["../src/canonicalGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE5E,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAU,CAAC;AAiJzD,MAAM,UAAU,sBAAsB,CACpC,OAAO,GAAkC,EAAE;IAE3C,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/D,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC/E,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IACD,OAAO;QACL,EAAE,EAAE,OAAO,CAAC,SAAS,IAAI,SAAS;QAClC,OAAO,EAAE,OAAO,CAAC,cAAc,IAAI,GAAG;QACtC,cAAc,EAAE,CAAC,GAAG,cAAc,CAAC;QACnC,iBAAiB,EAAE,CAAC,GAAG,iBAAiB,CAAC;QACzC,GAAG,CAAC,OAAO,CAAC,cAAc,KAAK,S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,MAAM;QACN,KAAK;QACL,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,UAAU,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACnC,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The loop-collapse retention rule, vendored from core.api — Story 8.9, AD-32(b).
|
|
3
|
+
*
|
|
4
|
+
* ### Why this file is a COPY and not an implementation
|
|
5
|
+
*
|
|
6
|
+
* `ExecutionEvidenceAccumulator` in core.api decides which occurrences of a step survive a run and which fold into a
|
|
7
|
+
* range. The canvas has to draw the same reading, or the inspector and the diagram describe two different runs. AD-32(b)
|
|
8
|
+
* says neither owner may decide that rule alone, and AD-28 bars a CI job spanning the two repositories — so the rule is
|
|
9
|
+
* published there as `hexasync.steps/Manifests/collapse-rule-manifest.json`, byte-copied here to
|
|
10
|
+
* `manifests/collapse-rule.json`, and pinned on both sides:
|
|
11
|
+
*
|
|
12
|
+
* | change | what fails |
|
|
13
|
+
* | --- | --- |
|
|
14
|
+
* | the accumulator's retention behaviour | `CollapseRuleManifestAtddTests` in core.api — it runs the accumulator and reads the numbers back out |
|
|
15
|
+
* | the constants below | `story89LoopCollapse.atdd.spec.ts` — it reads the vendored manifest off disk and compares |
|
|
16
|
+
* | the vendored manifest goes stale | the same spec, from the other direction |
|
|
17
|
+
*
|
|
18
|
+
* This is Story 7.2's `worker-step-roster.json` pattern, deliberately unchanged.
|
|
19
|
+
*
|
|
20
|
+
* ### Why the constants are NAMED here and not read at runtime
|
|
21
|
+
*
|
|
22
|
+
* `template-model` runs in a webview and in a browser bundle, so it cannot read a file, and a JSON import would put a
|
|
23
|
+
* bundler-specific assertion in a published library's entry point. The numbers are therefore declared as constants and
|
|
24
|
+
* the vendored JSON is the thing a TEST compares them against — which is also the only place a comparison is useful,
|
|
25
|
+
* because a mismatch is a build-time defect, never a runtime condition a caller can handle.
|
|
26
|
+
*
|
|
27
|
+
* ⚠️ The accumulator has **no named threshold constants at all** — `StepState` encodes retention structurally with a
|
|
28
|
+
* first-success flag plus a two-slot slide, so "the fourth success" is emergent behaviour rather than a number anyone
|
|
29
|
+
* typed there. That is exactly why these constants must be pinned to the manifest instead of "kept in sync by reading
|
|
30
|
+
* the C#": there is nothing in the C# to read.
|
|
31
|
+
*/
|
|
32
|
+
/** The evidence envelope schema these thresholds describe. */
|
|
33
|
+
export declare const COLLAPSE_RULE_SCHEMA_VERSION = 2;
|
|
34
|
+
/** The first success of a step key always stays full. */
|
|
35
|
+
export declare const RETAINED_FIRST_SUCCESSES = 1;
|
|
36
|
+
/** The trailing successes that stay full — the accumulator's two-slot slide. */
|
|
37
|
+
export declare const RETAINED_LATEST_SUCCESSES = 2;
|
|
38
|
+
/**
|
|
39
|
+
* The step-local success ordinal on which compaction FIRST fires.
|
|
40
|
+
*
|
|
41
|
+
* Not an independent number: the first success plus the latest two are already full, so the next success is the first
|
|
42
|
+
* one that can push an older body into a range. Stated as a constant because a renderer sizing a fixture needs it, and
|
|
43
|
+
* derived from the two above so it cannot drift from them.
|
|
44
|
+
*/
|
|
45
|
+
export declare const FIRST_COMPACTED_SUCCESS_ORDINAL: number;
|
|
46
|
+
/** Every failure stays full. A failure never folds into a range, whatever its neighbours did. */
|
|
47
|
+
export declare const FAILURES_RETAINED = true;
|
|
48
|
+
/**
|
|
49
|
+
* How the six fields below are compared — ordinal (case-sensitive), with two nulls counting as equal.
|
|
50
|
+
*
|
|
51
|
+
* Mirrored from the manifest rather than left as prose, because a comparison rule the manifest publishes and neither
|
|
52
|
+
* side pins is a rule the accumulator can stop following with every test on both sides still green.
|
|
53
|
+
*/
|
|
54
|
+
export declare const RANGE_IDENTITY_COMPARISON = "ordinal";
|
|
55
|
+
export declare const RANGE_IDENTITY_NULLS_EQUAL = true;
|
|
56
|
+
/**
|
|
57
|
+
* What "adjacent" means when a range is extended rather than opened: the occurrence's global index is exactly one past
|
|
58
|
+
* the range's last, and its step-local occurrence is exactly one past the range's last.
|
|
59
|
+
*/
|
|
60
|
+
export declare const ADJACENCY_GLOBAL_INDEX_GAP = 1;
|
|
61
|
+
export declare const ADJACENCY_STEP_LOCAL_OCCURRENCE_GAP = 1;
|
|
62
|
+
/** A range id is minted once and does NOT change as the range extends — which is why an entry carries it. */
|
|
63
|
+
export declare const RANGE_ID_STABLE_ON_EXTENSION = true;
|
|
64
|
+
/**
|
|
65
|
+
* The six fields a range compares to decide whether an occurrence extends it, in the tuple's declared order.
|
|
66
|
+
*
|
|
67
|
+
* Case-sensitive (ordinal) with nulls equal, which is what `HasSameRoute` does. The renderer never compares these
|
|
68
|
+
* itself — the producer does, in core.api — but the list is what a fixture and a review have to agree on, and a plan
|
|
69
|
+
* whose ranges were folded on five fields is a different reading of the run.
|
|
70
|
+
*/
|
|
71
|
+
export declare const RANGE_IDENTITY_FIELDS: readonly ['stepKey', 'providerId', 'connectionId', 'flow', 'nextTarget', 'outcomeClass'];
|
|
72
|
+
/** The two `orderedTimeline` kinds, in the manifest's order. There is no third. */
|
|
73
|
+
export declare const TIMELINE_KINDS: readonly ['occurrence', 'range'];
|
|
74
|
+
/** How the accumulator mints a range id, and never re-mints it once the range extends. */
|
|
75
|
+
export declare const RANGE_ID_FORMAT = "range-{firstGlobalIndex}";
|
|
76
|
+
/** Which of the two things an entry in the plan is. */
|
|
77
|
+
export type OccurrenceKind = (typeof TIMELINE_KINDS)[number];
|
|
78
|
+
/**
|
|
79
|
+
* One position in a step's timeline: a retained occurrence, or a range standing in for a folded run.
|
|
80
|
+
*
|
|
81
|
+
* The plan is a TYPED PARAMETER and never an evidence envelope (FR26). The generator does not parse the envelope, does
|
|
82
|
+
* not know its member names, and cannot be made to: one internal shape owns the occurrence facts, and a producer
|
|
83
|
+
* (Epic 10's) converts. So this type is the whole contract between the two.
|
|
84
|
+
*/
|
|
85
|
+
export type OccurrenceEntry = RetainedOccurrence | CollapsedRange;
|
|
86
|
+
/** What both members share: where in the step's own run they sit, and how many occurrences they stand for. */
|
|
87
|
+
interface OccurrenceEntryBase {
|
|
88
|
+
/**
|
|
89
|
+
* The step-local occurrence ordinal, 1-based — `stepLocalOccurrence` in the envelope. For a range it is the FIRST
|
|
90
|
+
* occurrence the range covers, which is what makes the drawn chain read in the run's order.
|
|
91
|
+
*/
|
|
92
|
+
readonly ordinal: number;
|
|
93
|
+
/** Occurrences this entry stands for: `1` for a retained occurrence, the range's `count` for a range. */
|
|
94
|
+
readonly count: number;
|
|
95
|
+
}
|
|
96
|
+
/** One occurrence the accumulator kept in full. */
|
|
97
|
+
export interface RetainedOccurrence extends OccurrenceEntryBase {
|
|
98
|
+
readonly kind: 'occurrence';
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* One folded run.
|
|
102
|
+
*
|
|
103
|
+
* ⚠️ `rangeId` is REQUIRED here, and the discriminated union is the whole reason this is two interfaces rather than one
|
|
104
|
+
* with an optional field. A range with no id has no spellable address segment, so the expansion throws — at runtime,
|
|
105
|
+
* from a producer's fixture, long after the mistake was made. As a union it is a compile error in the producer.
|
|
106
|
+
*
|
|
107
|
+
* The id is carried rather than re-derived because the accumulator mints it once and never re-mints it as the range
|
|
108
|
+
* extends; deriving an address from the range's CURRENT first index would move a node's identity as a run grew.
|
|
109
|
+
*/
|
|
110
|
+
export interface CollapsedRange extends OccurrenceEntryBase {
|
|
111
|
+
readonly kind: 'range';
|
|
112
|
+
readonly rangeId: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The plan: for each authored node address, what the run did there, in timeline order.
|
|
116
|
+
*
|
|
117
|
+
* Keyed by node ADDRESS and never by step key, for AD-22's reason — a step key is not unique across a profile, and the
|
|
118
|
+
* expansion has to know which drawn node it is talking about. An address no group drew is ignored in silence, which is
|
|
119
|
+
* what every other overlay here does.
|
|
120
|
+
*/
|
|
121
|
+
export type OccurrencePlan = Readonly<Record<string, readonly OccurrenceEntry[]>>;
|
|
122
|
+
/** Does this entry describe a folded run rather than one retained occurrence? Narrows, so `rangeId` is reachable. */
|
|
123
|
+
export declare function isCollapsedRange(entry: OccurrenceEntry): entry is CollapsedRange;
|
|
124
|
+
export {};
|
|
125
|
+
//# sourceMappingURL=collapseRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapseRule.d.ts","sourceRoot":"","sources":["../src/collapseRule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,8DAA8D;AAC9D,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,yDAAyD;AACzD,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,gFAAgF;AAChF,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,QACc,CAAC;AAE3D,iGAAiG;AACjG,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,YAAY,CAAC;AACnD,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,mCAAmC,IAAI,CAAC;AAErD,6GAA6G;AAC7G,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,YAChC,SAAS,EACT,YAAY,EACZ,cAAc,EACd,MAAM,EACN,YAAY,EACZ,cAAc,CACN,CAAC;AAEX,mFAAmF;AACnF,eAAO,MAAM,cAAc,YAAI,YAAY,EAAE,OAAO,CAAU,CAAC;AAE/D,0FAA0F;AAC1F,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAE1D,uDAAuD;AACvD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,kBAAkB,GAAG,cAAc,CAAC;AAElE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