@almadar/core 10.129.0 → 11.0.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/behavior-package.d.ts +49 -11
- package/dist/behavior-package.js +1 -1
- package/dist/{orbital-CkFdDS9f.d.ts → builders-BdgbY7Th.d.ts} +5828 -6917
- package/dist/builders.d.ts +6 -6
- package/dist/builders.js +7 -6
- package/dist/{bus-CcbB__oo.d.ts → bus-C0hFDNFR.d.ts} +262 -354
- package/dist/chunk-347APWFM.js +286 -0
- package/dist/chunk-347APWFM.js.map +1 -0
- package/dist/chunk-5WQ3U7NJ.js +2363 -0
- package/dist/chunk-5WQ3U7NJ.js.map +1 -0
- package/dist/chunk-5YTPYMPZ.js +99 -0
- package/dist/chunk-5YTPYMPZ.js.map +1 -0
- package/dist/chunk-66Q5VX2F.js +3810 -0
- package/dist/chunk-66Q5VX2F.js.map +1 -0
- package/dist/chunk-7GHJU5WI.js +39 -0
- package/dist/chunk-7GHJU5WI.js.map +1 -0
- package/dist/chunk-B4MNHGBP.js +8 -0
- package/dist/chunk-B4MNHGBP.js.map +1 -0
- package/dist/chunk-E4T2MQAV.js +24 -0
- package/dist/chunk-E4T2MQAV.js.map +1 -0
- package/dist/chunk-ENOCKYGA.js +412 -0
- package/dist/chunk-ENOCKYGA.js.map +1 -0
- package/dist/chunk-FGT5OS2Y.js +918 -0
- package/dist/chunk-FGT5OS2Y.js.map +1 -0
- package/dist/chunk-GF7KCLNR.js +3284 -0
- package/dist/chunk-GF7KCLNR.js.map +1 -0
- package/dist/chunk-PNGFWLHD.js +1567 -0
- package/dist/chunk-PNGFWLHD.js.map +1 -0
- package/dist/{chunk-X4SC7FGF.js → chunk-RGACZEYC.js} +99 -96
- package/dist/chunk-RGACZEYC.js.map +1 -0
- package/dist/{chunk-RYPVOI6H.js → chunk-SNZYN7UA.js} +2541 -433
- package/dist/{chunk-RYPVOI6H.js.map → chunk-SNZYN7UA.js.map} +1 -1
- package/dist/{chunk-KDMV222Q.js → chunk-TDNQT3M3.js} +304 -373
- package/dist/chunk-TDNQT3M3.js.map +1 -0
- package/dist/chunk-VG7BRFUD.js +152 -0
- package/dist/chunk-VG7BRFUD.js.map +1 -0
- package/dist/chunk-Z7BI7DE7.js +1293 -0
- package/dist/chunk-Z7BI7DE7.js.map +1 -0
- package/dist/{domain-Dz3jP-UM.d.ts → domain-Cpmja5ak.d.ts} +55 -55
- package/dist/{effect-CiEVLsZz.d.ts → effect-DZaXwSAz.d.ts} +283 -453
- package/dist/{effect-result-Bebwu9yT.d.ts → effect-result-1HpXgeBc.d.ts} +656 -851
- package/dist/{expression-D0Fs0riG.d.ts → expression-DirYKz-f.d.ts} +5 -13
- package/dist/factory/index.d.ts +7 -144
- package/dist/factory/index.js +8 -8
- package/dist/factory-runtime/index.d.ts +7 -6
- package/dist/factory-runtime/index.js +527 -8
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/fixtures.d.ts +9 -11
- package/dist/fixtures.js +12 -8
- package/dist/fixtures.js.map +1 -1
- package/dist/i18n/index.d.ts +15 -19
- package/dist/i18n/index.js +2 -1
- package/dist/{index-BC-Jycqj.d.ts → index-D7SxwNdv.d.ts} +34 -734
- package/dist/index.d.ts +92 -247
- package/dist/index.js +322 -986
- package/dist/index.js.map +1 -1
- package/dist/kernel-wire.d.ts +3 -3
- package/dist/kernel-wire.js +3 -79
- package/dist/kernel-wire.js.map +1 -1
- package/dist/language/constructs.json +22 -2
- package/dist/language/program-types.json +203 -22
- package/dist/language/protocols.json +46 -0
- package/dist/language/ui-vocabulary.json +1697 -0
- package/dist/language/validation-codes.json +1222 -1212
- package/dist/language/vocabulary.json +44 -8
- package/dist/language-data.d.ts +7 -4
- package/dist/language-data.js +20 -14
- package/dist/language-data.js.map +1 -1
- package/dist/patterns/component-mapping.json +11 -1
- package/dist/patterns/definitions.d.ts +2 -2
- package/dist/patterns/definitions.js +1 -1
- package/dist/patterns/event-contracts.json +1 -15
- package/dist/patterns/game-font-families.json +13 -0
- package/dist/patterns/index.d.ts +24 -120
- package/dist/patterns/index.js +3 -3
- package/dist/patterns/pattern-tile-geometry.json +1065 -0
- package/dist/patterns/patterns-registry.json +2539 -431
- package/dist/patterns/registry.json +2539 -431
- package/dist/trait-sRjIivFq.d.ts +3519 -0
- package/dist/types/index.d.ts +9 -10
- package/dist/types/index.js +11 -5
- package/dist/{types-DGwrltUF.d.ts → types-C6_yPMpn.d.ts} +3 -3
- package/fixtures/events-wire/client-effects-by-trait/response.json +0 -18
- package/fixtures/events-wire/client-effects-provenance/response.json +0 -18
- package/fixtures/events-wire/effect-results-every-kind/response.json +2 -27
- package/fixtures/events-wire/navigate-1/response.json +8 -5
- package/fixtures/events-wire/navigate-2/response.json +11 -8
- package/fixtures/events-wire/navigate-3/response.json +14 -11
- package/fixtures/events-wire/navigate-back/response.json +7 -4
- package/fixtures/events-wire/render-ui-3/response.json +12 -9
- package/fixtures/events-wire/render-ui-clear/response.json +0 -7
- package/fixtures/events-wire/sse-stream/response.json +0 -20
- package/fixtures/events-wire/sse-stream/stream.json +0 -20
- package/fixtures/events-wire/stateless-traits/response.json +14 -5
- package/fixtures/kernel-wire/golden/basic-entity.json +1687 -0
- package/fixtures/kernel-wire/golden/entity-rerender.json +743 -0
- package/fixtures/kernel-wire/golden/rollback.json +793 -0
- package/fixtures/kernel-wire/golden/tick-counter.json +1538 -0
- package/fixtures/kernel-wire/golden/two-orbital-chore.json +847 -0
- package/fixtures/kernel-wire/golden/two-orbital-task.json +457 -0
- package/fixtures/kernel-wire/played-step.json +136 -0
- package/fixtures/kernel-wire/scripts/basic-entity.json +28 -0
- package/fixtures/kernel-wire/scripts/entity-rerender.json +13 -0
- package/fixtures/kernel-wire/scripts/rollback.json +53 -0
- package/fixtures/kernel-wire/scripts/tick-counter.json +26 -0
- package/fixtures/kernel-wire/scripts/two-orbital-chore.json +9 -0
- package/fixtures/kernel-wire/scripts/two-orbital-task.json +9 -0
- package/package.json +28 -19
- package/dist/builders-DmZE5By0.d.ts +0 -2663
- package/dist/chunk-45I2O4SJ.js +0 -4646
- package/dist/chunk-45I2O4SJ.js.map +0 -1
- package/dist/chunk-6LR43Z5E.js +0 -3061
- package/dist/chunk-6LR43Z5E.js.map +0 -1
- package/dist/chunk-GIUA3NUJ.js +0 -809
- package/dist/chunk-GIUA3NUJ.js.map +0 -1
- package/dist/chunk-GTY53NS5.js +0 -1908
- package/dist/chunk-GTY53NS5.js.map +0 -1
- package/dist/chunk-JOHDVS6J.js +0 -1614
- package/dist/chunk-JOHDVS6J.js.map +0 -1
- package/dist/chunk-KDMV222Q.js.map +0 -1
- package/dist/chunk-QRHJUS3D.js +0 -23
- package/dist/chunk-QRHJUS3D.js.map +0 -1
- package/dist/chunk-QUOTJULD.js +0 -4009
- package/dist/chunk-QUOTJULD.js.map +0 -1
- package/dist/chunk-V5VNGRVU.js +0 -66
- package/dist/chunk-V5VNGRVU.js.map +0 -1
- package/dist/chunk-X4SC7FGF.js.map +0 -1
- package/dist/entityAccess-BPSz1i2n.d.ts +0 -80
- package/dist/mock/index.d.ts +0 -153
- package/dist/mock/index.js +0 -190
- package/dist/mock/index.js.map +0 -1
- package/dist/schema-T5RT5s6H.d.ts +0 -282
- package/dist/state-machine/index.d.ts +0 -359
- package/dist/state-machine/index.js +0 -3
- package/dist/state-machine/index.js.map +0 -1
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
import { EventPayload, SExpr } from '../index.js';
|
|
2
|
-
import 'zod';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* State Machine Graph Algorithm Types
|
|
6
|
-
*
|
|
7
|
-
* Pure types used by BFS, guard payload, and replay path algorithms.
|
|
8
|
-
* These are decoupled from the verify-specific types (no Playwright, no HTTP).
|
|
9
|
-
*
|
|
10
|
-
* @packageDocumentation
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/** An edge in the state graph adjacency list */
|
|
14
|
-
interface StateEdge {
|
|
15
|
-
event: string;
|
|
16
|
-
to: string;
|
|
17
|
-
}
|
|
18
|
-
/** A node in the BFS queue */
|
|
19
|
-
interface BFSNode {
|
|
20
|
-
state: string;
|
|
21
|
-
depth: number;
|
|
22
|
-
}
|
|
23
|
-
/** A node in the BFS queue with a replay path */
|
|
24
|
-
interface BFSPathNode {
|
|
25
|
-
fromState: string;
|
|
26
|
-
replayPath: ReplayStep[];
|
|
27
|
-
}
|
|
28
|
-
/** A single step to replay to reach a given state */
|
|
29
|
-
interface ReplayStep {
|
|
30
|
-
/** Event to fire */
|
|
31
|
-
event: string;
|
|
32
|
-
/** State we're coming from */
|
|
33
|
-
fromState: string;
|
|
34
|
-
/** State we're transitioning to */
|
|
35
|
-
toState: string;
|
|
36
|
-
/** Slot the pattern renders in */
|
|
37
|
-
slot: string;
|
|
38
|
-
/** Pattern expected in the slot after this step */
|
|
39
|
-
expectedPattern?: string;
|
|
40
|
-
/** True if this step requires entity rows to be visible before clicking */
|
|
41
|
-
needsEntityData: boolean;
|
|
42
|
-
/** Payload to supply for this step (derived from guard pass case if guarded) */
|
|
43
|
-
guardPayload?: EventPayload;
|
|
44
|
-
/** Full payload schema for mock data generation */
|
|
45
|
-
payloadSchema?: PayloadFieldSchema[];
|
|
46
|
-
}
|
|
47
|
-
/** Payload field definition (name + type) */
|
|
48
|
-
interface PayloadFieldSchema {
|
|
49
|
-
name: string;
|
|
50
|
-
type: string;
|
|
51
|
-
required?: boolean;
|
|
52
|
-
}
|
|
53
|
-
/** Pass and fail payloads derived from a guard s-expression */
|
|
54
|
-
interface GuardPayload {
|
|
55
|
-
pass: EventPayload;
|
|
56
|
-
fail: EventPayload;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Minimal transition interface for graph algorithms.
|
|
60
|
-
* Compatible with both @almadar/core Transition and orbital-verify UnifiedTransition.
|
|
61
|
-
*/
|
|
62
|
-
interface GraphTransition {
|
|
63
|
-
from: string;
|
|
64
|
-
event: string;
|
|
65
|
-
to: string;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Transition input for the edge-covering walk algorithm.
|
|
69
|
-
* Extends GraphTransition with guard metadata for generating pass/fail walk steps.
|
|
70
|
-
*/
|
|
71
|
-
interface EdgeWalkTransition extends GraphTransition {
|
|
72
|
-
hasGuard: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Guard expression (when present). Mirrors `@almadar/core`'s `SExpr`
|
|
75
|
-
* union — a string atom (e.g. `"@payload.row"` for bare-binding
|
|
76
|
-
* existence guards declared by std-confirmation) OR an array
|
|
77
|
-
* (`["or", ...]`, `["=", ...]`). Pre-fix, the type was `unknown[]`
|
|
78
|
-
* which rejected the string form and `toEdgeWalkTransition`
|
|
79
|
-
* silently dropped it; downstream `buildGuardPayloads` then saw no
|
|
80
|
-
* guard and synthesized `{}` for the verifier's pass-case bus
|
|
81
|
-
* replay, leaving the modal closed and the portal observer
|
|
82
|
-
* reporting "slot not mounted" for every single-binding-guarded
|
|
83
|
-
* event.
|
|
84
|
-
*/
|
|
85
|
-
guard?: SExpr;
|
|
86
|
-
/** Event payload field declarations (e.g., [{ name: "id", type: "string", mockValue: "mock-products-1" }]).
|
|
87
|
-
* Used to generate mock payloads for events that require data (VIEW, EDIT).
|
|
88
|
-
* Callers should set mockValue for id fields using their entity context. */
|
|
89
|
-
payloadSchema?: Array<{
|
|
90
|
-
name: string;
|
|
91
|
-
type: string;
|
|
92
|
-
required?: boolean;
|
|
93
|
-
mockValue?: unknown;
|
|
94
|
-
}>;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* A single step in an edge-covering walk.
|
|
98
|
-
* The walk visits every transition (edge) in the state graph at least once.
|
|
99
|
-
*/
|
|
100
|
-
interface WalkStep {
|
|
101
|
-
/** Source state */
|
|
102
|
-
from: string;
|
|
103
|
-
/** Event to fire */
|
|
104
|
-
event: string;
|
|
105
|
-
/** Target state */
|
|
106
|
-
to: string;
|
|
107
|
-
/** Guard branch: null for unguarded, 'pass' or 'fail' for guarded */
|
|
108
|
-
guardCase: 'pass' | 'fail' | null;
|
|
109
|
-
/** Payload to send with the event */
|
|
110
|
-
payload: EventPayload;
|
|
111
|
-
/** True if this step is a repositioning step (navigating to reach a source state with uncovered edges) */
|
|
112
|
-
isRepositioning: boolean;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* State Graph Construction
|
|
117
|
-
*
|
|
118
|
-
* Build an adjacency list from state machine transitions.
|
|
119
|
-
* Extracted from orbital-verify-unified/src/analyze.ts.
|
|
120
|
-
*
|
|
121
|
-
* @packageDocumentation
|
|
122
|
-
*/
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Builds an adjacency list from state machine transitions.
|
|
126
|
-
*
|
|
127
|
-
* Constructs a state transition graph where each state maps to an array
|
|
128
|
-
* of outgoing edges (events and target states). Wildcard transitions
|
|
129
|
-
* (from === '*') are excluded since they don't represent fixed edges.
|
|
130
|
-
* Used as the foundation for state machine analysis, traversal, and verification.
|
|
131
|
-
*
|
|
132
|
-
* @param {GraphTransition[]} transitions - Array of state transitions
|
|
133
|
-
* @returns {Map<string, StateEdge[]>} State transition graph
|
|
134
|
-
*
|
|
135
|
-
* @example
|
|
136
|
-
* const graph = buildStateGraph(transitions);
|
|
137
|
-
* const edgesFromInitial = graph.get('initial'); // Array of outgoing edges
|
|
138
|
-
* console.log(`Initial state has ${edgesFromInitial?.length} transitions`);
|
|
139
|
-
*/
|
|
140
|
-
declare function buildStateGraph(transitions: GraphTransition[]): Map<string, StateEdge[]>;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* BFS Reachability Algorithms
|
|
144
|
-
*
|
|
145
|
-
* Breadth-first search over state machine graphs.
|
|
146
|
-
* Extracted from orbital-verify-unified/src/analyze.ts and phase3-server.ts.
|
|
147
|
-
*
|
|
148
|
-
* @packageDocumentation
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Collects all reachable states from an initial state using breadth-first search.
|
|
153
|
-
*
|
|
154
|
-
* Performs BFS traversal of the state machine to find all states reachable
|
|
155
|
-
* from the initial state, up to the specified maximum depth. Used for
|
|
156
|
-
* state machine analysis, verification, and test coverage assessment.
|
|
157
|
-
*
|
|
158
|
-
* @param {GraphTransition[]} transitions - Array of state transitions
|
|
159
|
-
* @param {string} initialState - Starting state name
|
|
160
|
-
* @param {number} [maxDepth=5] - Maximum search depth
|
|
161
|
-
* @returns {Set<string>} Set of reachable state names
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* const reachable = collectReachableStates(transitions, 'initial', 10);
|
|
165
|
-
* console.log('Reachable states:', Array.from(reachable));
|
|
166
|
-
*/
|
|
167
|
-
declare function collectReachableStates(transitions: GraphTransition[], initialState: string, maxDepth?: number): Set<string>;
|
|
168
|
-
/**
|
|
169
|
-
* Walks all reachable (state, event) pairs using BFS and invokes callback for each.
|
|
170
|
-
*
|
|
171
|
-
* Traverses the state machine using breadth-first search and calls the visitor
|
|
172
|
-
* function for each (state, edge) pair encountered. Used by server verification
|
|
173
|
-
* to test transitions by POSTing to endpoints and checking responses.
|
|
174
|
-
*
|
|
175
|
-
* @param {GraphTransition[]} transitions - Array of state transitions
|
|
176
|
-
* @param {string} initialState - Starting state name
|
|
177
|
-
* @param {number} maxDepth - Maximum BFS depth
|
|
178
|
-
* @param {(state: string, edge: StateEdge, depth: number) => Promise<boolean>} visitor - Callback for each pair
|
|
179
|
-
* @returns {Promise<{ visitedPairs: Set<string>; walkedEdges: number }>} Traversal statistics
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
* const result = await walkStatePairs(transitions, 'initial', 5, async (state, edge) => {
|
|
183
|
-
* console.log(`Transition: ${state} --${edge.event}--> ${edge.to}`);
|
|
184
|
-
* return true; // Continue exploration
|
|
185
|
-
* });
|
|
186
|
-
* console.log(`Visited ${result.visitedPairs.size} state-event pairs`);
|
|
187
|
-
*/
|
|
188
|
-
declare function walkStatePairs(transitions: GraphTransition[], initialState: string, maxDepth: number, visitor: (state: string, edge: StateEdge, depth: number) => Promise<boolean>): Promise<{
|
|
189
|
-
visitedPairs: Set<string>;
|
|
190
|
-
walkedEdges: number;
|
|
191
|
-
}>;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Guard Payload Builder
|
|
195
|
-
*
|
|
196
|
-
* Derive pass and fail payloads from guard s-expressions.
|
|
197
|
-
* Extracted from orbital-verify-unified/src/analyze.ts.
|
|
198
|
-
*
|
|
199
|
-
* @packageDocumentation
|
|
200
|
-
*/
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Extracts the first segment of a payload field reference.
|
|
204
|
-
*
|
|
205
|
-
* Parses binding references in the format "@payload.field" and extracts
|
|
206
|
-
* the first field name segment. Used for identifying payload fields in
|
|
207
|
-
* guard conditions for test data generation.
|
|
208
|
-
*
|
|
209
|
-
* @param {unknown} ref - Binding reference to extract from
|
|
210
|
-
* @returns {string | null} First field segment or null for non-payload references
|
|
211
|
-
*
|
|
212
|
-
* @example
|
|
213
|
-
* extractPayloadFieldRef('@payload.item'); // returns 'item'
|
|
214
|
-
* extractPayloadFieldRef('@payload.data.weight'); // returns 'data'
|
|
215
|
-
* extractPayloadFieldRef('@entity.id'); // returns null
|
|
216
|
-
* extractPayloadFieldRef('@user.name'); // returns null
|
|
217
|
-
*/
|
|
218
|
-
declare function extractPayloadFieldRef(ref: unknown): string | null;
|
|
219
|
-
/**
|
|
220
|
-
* Full dotted path of a payload reference — `'@payload.data.providerName'`
|
|
221
|
-
* → `['data', 'providerName']`. `extractPayloadFieldRef` keeps only the
|
|
222
|
-
* first segment, which made every guard on a NESTED payload field
|
|
223
|
-
* unsatisfiable by synthesis: `when ?data.providerName` was seeded as
|
|
224
|
-
* `{data: 'mock-test-value'}`, the runtime read `.providerName` off a
|
|
225
|
-
* string, and the pass-case dispatch was correctly rejected (std-booking
|
|
226
|
-
* BookingWizard NEXT — the whole step chain became unwalkable). Returns
|
|
227
|
-
* `null` for non-payload references.
|
|
228
|
-
*/
|
|
229
|
-
declare function extractPayloadFieldPath(ref: unknown): string[] | null;
|
|
230
|
-
/**
|
|
231
|
-
* Builds test payloads that satisfy or violate guard conditions.
|
|
232
|
-
*
|
|
233
|
-
* Generates pass/fail test data for guard s-expressions used in state machine
|
|
234
|
-
* transitions. Pass payloads satisfy the guard condition (allowing transition),
|
|
235
|
-
* fail payloads violate it (blocking transition). Used for automated testing
|
|
236
|
-
* and validation of state machine behavior.
|
|
237
|
-
*
|
|
238
|
-
* Supports operators: not-nil, nil, eq, not-eq, gt, gte, lt, lte, and, or, not
|
|
239
|
-
*
|
|
240
|
-
* @param {unknown} guard - Guard s-expression to analyze
|
|
241
|
-
* @returns {GuardPayload} Object with pass and fail payloads
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* // Guard: ['not-nil', '@payload.completed']
|
|
245
|
-
* buildGuardPayloads(['not-nil', '@payload.completed']);
|
|
246
|
-
* // Returns: { pass: { completed: 'mock-test-value' }, fail: { completed: null } }
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* // Guard: ['eq', '@payload.status', 'active']
|
|
250
|
-
* buildGuardPayloads(['eq', '@payload.status', 'active']);
|
|
251
|
-
* // Returns: { pass: { status: 'active' }, fail: { status: 'not-active' } }
|
|
252
|
-
*
|
|
253
|
-
* @example
|
|
254
|
-
* // Guard: ['and', ['not-nil', '@payload.id'], ['eq', '@payload.status', 'ready']]
|
|
255
|
-
* buildGuardPayloads(['and', ['not-nil', '@payload.id'], ['eq', '@payload.status', 'ready']]);
|
|
256
|
-
* // Returns: { pass: { id: 'mock-test-value', status: 'ready' }, fail: { id: null } }
|
|
257
|
-
*/
|
|
258
|
-
/**
|
|
259
|
-
* Evaluate a guard that is fully constant (no `@payload`/`@entity`/`@config`
|
|
260
|
-
* bindings — e.g. after molecule/organism inlining folds `@config.mode` to a
|
|
261
|
-
* literal). Returns the constant truth value, or `null` when the guard depends
|
|
262
|
-
* on a binding (so a payload must be synthesized). This lets callers (a) emit
|
|
263
|
-
* an empty payload for a constant guard (no field to satisfy) and (b) skip the
|
|
264
|
-
* meaningless variant: an always-true guard has no fail case, an always-false
|
|
265
|
-
* guard has no pass case. Without it, `(or (= "create" "create") @payload.row)`
|
|
266
|
-
* (create-mode modal OPEN) was synthesized with a spurious `row`, which the
|
|
267
|
-
* runtime read as edit-mode and rejected.
|
|
268
|
-
*/
|
|
269
|
-
declare function constTruth(guard: unknown): boolean | null;
|
|
270
|
-
declare function buildGuardPayloads(guard: unknown): GuardPayload;
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Replay Path Builder
|
|
274
|
-
*
|
|
275
|
-
* Compute the shortest path (replay steps) from an initial state
|
|
276
|
-
* to every reachable state in a state machine. Used by browser
|
|
277
|
-
* verification to navigate through states before running assertions.
|
|
278
|
-
*
|
|
279
|
-
* Extracted from orbital-verify-unified/src/analyze.ts (collectDataMutationTests).
|
|
280
|
-
*
|
|
281
|
-
* @packageDocumentation
|
|
282
|
-
*/
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Extended transition with render and payload info needed for replay path building.
|
|
286
|
-
* Compatible with orbital-verify's UnifiedTransition.
|
|
287
|
-
*/
|
|
288
|
-
interface ReplayTransition extends GraphTransition {
|
|
289
|
-
hasGuard: boolean;
|
|
290
|
-
guard?: unknown[];
|
|
291
|
-
payloadFields: string[];
|
|
292
|
-
payloadSchema: PayloadFieldSchema[];
|
|
293
|
-
renderEffects: Array<{
|
|
294
|
-
slot: string;
|
|
295
|
-
patternType: string | null;
|
|
296
|
-
}>;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Builds the shortest replay paths from initial state to all reachable states.
|
|
300
|
-
*
|
|
301
|
-
* Computes step-by-step navigation paths for state machine testing and verification.
|
|
302
|
-
* Uses breadth-first search to find shortest paths up to specified depth limit.
|
|
303
|
-
* Each path contains replay steps with event, state, and payload information
|
|
304
|
-
* needed to reproduce state transitions in tests.
|
|
305
|
-
*
|
|
306
|
-
* @param {ReplayTransition[]} transitions - Transitions with render/payload information
|
|
307
|
-
* @param {string} initialState - Starting state name
|
|
308
|
-
* @param {number} [maxDepth=3] - Maximum path length (default: 3)
|
|
309
|
-
* @returns {Map<string, ReplayStep[]>} Map of state names to replay step arrays
|
|
310
|
-
*
|
|
311
|
-
* @example
|
|
312
|
-
* // Build paths from 'initial' state
|
|
313
|
-
* const paths = buildReplayPaths(transitions, 'initial', 5);
|
|
314
|
-
*
|
|
315
|
-
* // Get steps to reach 'completed' state
|
|
316
|
-
* const stepsToComplete = paths.get('completed');
|
|
317
|
-
*
|
|
318
|
-
* // Execute replay steps
|
|
319
|
-
* for (const step of stepsToComplete) {
|
|
320
|
-
* await dispatchEvent(step.event, step.payload);
|
|
321
|
-
* }
|
|
322
|
-
*/
|
|
323
|
-
declare function buildReplayPaths(transitions: ReplayTransition[], initialState: string, maxDepth?: number): Map<string, ReplayStep[]>;
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Edge-Covering Walk Algorithm
|
|
327
|
-
*
|
|
328
|
-
* Computes an ordered sequence of events (WalkStep[]) that attempts to cover
|
|
329
|
-
* every transition (edge) in a state machine graph. This is a greedy chained
|
|
330
|
-
* walk: it does NOT guarantee 100% coverage. With no reset concept it can
|
|
331
|
-
* strand on absorbing states (no outgoing edges and no path back to uncovered
|
|
332
|
-
* edges), and a guard-fail misprediction desyncs the chained walk so later
|
|
333
|
-
* steps fire from the wrong state. Superseded by the hermetic per-frame walk
|
|
334
|
-
* in @almadar-io/verify, which re-seeds each frame independently.
|
|
335
|
-
*
|
|
336
|
-
* Algorithm:
|
|
337
|
-
* 1. Build adjacency list and edge universe (guarded transitions produce two edges)
|
|
338
|
-
* 2. Precompute BFS shortest paths between all state pairs (for repositioning)
|
|
339
|
-
* 3. Greedy DFS: at each state, prefer uncovered outgoing edges
|
|
340
|
-
* 4. When stuck, insert repositioning steps to nearest state with uncovered edges
|
|
341
|
-
* 5. Guard-fail steps don't advance state (guard blocks transition)
|
|
342
|
-
*
|
|
343
|
-
* Used by StateWalkEngine in @almadar-io/verify. Both orbital-verify and
|
|
344
|
-
* runtime-verify share this algorithm for consistent coverage.
|
|
345
|
-
*
|
|
346
|
-
* @packageDocumentation
|
|
347
|
-
*/
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Build an ordered walk that covers every edge in the state machine.
|
|
351
|
-
*
|
|
352
|
-
* @param transitions - All transitions in the state machine
|
|
353
|
-
* @param initialState - Starting state
|
|
354
|
-
* @returns Ordered walk steps covering every edge
|
|
355
|
-
*/
|
|
356
|
-
declare function buildEdgeCoveringWalk(transitions: EdgeWalkTransition[], initialState: string): WalkStep[];
|
|
357
|
-
|
|
358
|
-
export { buildEdgeCoveringWalk, buildGuardPayloads, buildReplayPaths, buildStateGraph, collectReachableStates, constTruth, extractPayloadFieldPath, extractPayloadFieldRef, walkStatePairs };
|
|
359
|
-
export type { BFSNode, BFSPathNode, EdgeWalkTransition, GraphTransition, GuardPayload, PayloadFieldSchema, ReplayStep, ReplayTransition, StateEdge, WalkStep };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { buildEdgeCoveringWalk, buildGuardPayloads, buildReplayPaths, buildStateGraph, collectReachableStates, constTruth, extractPayloadFieldPath, extractPayloadFieldRef, walkStatePairs } from '../chunk-GIUA3NUJ.js';
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|