@almadar/core 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,6 +67,15 @@ interface GraphTransition {
67
67
  interface EdgeWalkTransition extends GraphTransition {
68
68
  hasGuard: boolean;
69
69
  guard?: unknown[];
70
+ /** Event payload field declarations (e.g., [{ name: "id", type: "string", mockValue: "mock-products-1" }]).
71
+ * Used to generate mock payloads for events that require data (VIEW, EDIT).
72
+ * Callers should set mockValue for id fields using their entity context. */
73
+ payloadSchema?: Array<{
74
+ name: string;
75
+ type: string;
76
+ required?: boolean;
77
+ mockValue?: unknown;
78
+ }>;
70
79
  }
71
80
  /**
72
81
  * A single step in an edge-covering walk.
@@ -307,11 +307,28 @@ function findNearestUncoveredState(currentState, graph, uncovered, shortestPaths
307
307
  return nearestState;
308
308
  }
309
309
  function buildPayloadForEdge(transition, guardCase) {
310
- if (!transition.hasGuard || !transition.guard || !guardCase) {
311
- return {};
310
+ if (transition.hasGuard && transition.guard && guardCase) {
311
+ const payloads = buildGuardPayloads(transition.guard);
312
+ return guardCase === "pass" ? payloads.pass : payloads.fail;
312
313
  }
313
- const payloads = buildGuardPayloads(transition.guard);
314
- return guardCase === "pass" ? payloads.pass : payloads.fail;
314
+ if (transition.payloadSchema && transition.payloadSchema.length > 0) {
315
+ const payload = {};
316
+ for (const field of transition.payloadSchema) {
317
+ if (field.mockValue !== void 0) {
318
+ payload[field.name] = field.mockValue;
319
+ } else if (field.type === "string") {
320
+ payload[field.name] = `mock-${field.name}`;
321
+ } else if (field.type === "number") {
322
+ payload[field.name] = 1;
323
+ } else if (field.type === "boolean") {
324
+ payload[field.name] = true;
325
+ } else {
326
+ payload[field.name] = `mock-${field.name}`;
327
+ }
328
+ }
329
+ return payload;
330
+ }
331
+ return {};
315
332
  }
316
333
 
317
334
  export { buildEdgeCoveringWalk, buildGuardPayloads, buildReplayPaths, buildStateGraph, collectReachableStates, extractPayloadFieldRef, walkStatePairs };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/state-machine/graph.ts","../../src/state-machine/bfs.ts","../../src/state-machine/guard-payloads.ts","../../src/state-machine/replay-paths.ts","../../src/state-machine/edge-walk.ts"],"names":[],"mappings":";AA2BO,SAAS,gBACd,WAAA,EAC0B;AAC1B,EAAA,MAAM,KAAA,uBAAY,GAAA,EAAyB;AAC3C,EAAA,KAAA,MAAW,KAAK,WAAA,EAAa;AAC3B,IAAA,IAAI,CAAA,CAAE,SAAS,GAAA,EAAK;AACpB,IAAA,IAAI,CAAC,KAAA,CAAM,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,EAAG,KAAA,CAAM,GAAA,CAAI,CAAA,CAAE,IAAA,EAAM,EAAE,CAAA;AAC5C,IAAA,KAAA,CAAM,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,CAAG,IAAA,CAAK,EAAE,KAAA,EAAO,CAAA,CAAE,KAAA,EAAO,EAAA,EAAI,CAAA,CAAE,EAAA,EAAI,CAAA;AAAA,EACtD;AACA,EAAA,OAAO,KAAA;AACT;;;ACRO,SAAS,sBAAA,CACd,WAAA,EACA,YAAA,EACA,QAAA,GAAW,CAAA,EACE;AACb,EAAA,MAAM,KAAA,GAAQ,gBAAgB,WAAW,CAAA;AACzC,EAAA,MAAM,OAAA,mBAAU,IAAI,GAAA,CAAY,CAAC,YAAY,CAAC,CAAA;AAC9C,EAAA,MAAM,QAAmB,CAAC,EAAE,OAAO,YAAA,EAAc,KAAA,EAAO,GAAG,CAAA;AAE3D,EAAA,OAAO,KAAA,CAAM,SAAS,CAAA,EAAG;AACvB,IAAA,MAAM,OAAA,GAAU,MAAM,KAAA,EAAM;AAC5B,IAAA,IAAI,OAAA,CAAQ,SAAS,QAAA,EAAU;AAE/B,IAAA,MAAM,QAAQ,KAAA,CAAM,GAAA,CAAI,OAAA,CAAQ,KAAK,KAAK,EAAC;AAC3C,IAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,MAA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EACe;AAEf,EAAA,MAAM,mBAAA,uBAA0B,GAAA,EAAY;AAC5C,EAAA,KAAA,MAAW,OAAO,SAAA,EAAW;AAE3B,IAAA,MAAM,SAAA,GAAY,GAAA,CAAI,KAAA,CAAM,GAAG,EAAE,CAAC,CAAA;AAClC,IAAA,mBAAA,CAAoB,IAAI,SAAS,CAAA;AAAA,EACnC;AAGA,EAAA,IAAI,mBAAA,CAAoB,GAAA,CAAI,YAAY,CAAA,EAAG,OAAO,YAAA;AAGlD,EAAA,MAAM,KAAA,GAAQ,aAAA,CAAc,GAAA,CAAI,YAAY,CAAA;AAC5C,EAAA,IAAI,CAAC,OAAO,OAAO,IAAA;AAEnB,EAAA,IAAI,YAAA,GAA8B,IAAA;AAClC,EAAA,IAAI,WAAA,GAAc,QAAA;AAElB,EAAA,KAAA,MAAW,UAAU,mBAAA,EAAqB;AACxC,IAAA,MAAM,IAAA,GAAO,KAAA,CAAM,GAAA,CAAI,MAAM,CAAA;AAC7B,IAAA,IAAI,IAAA,IAAQ,IAAA,CAAK,MAAA,GAAS,WAAA,EAAa;AACrC,MAAA,WAAA,GAAc,IAAA,CAAK,MAAA;AACnB,MAAA,YAAA,GAAe,MAAA;AAAA,IACjB;AAAA,EACF;AAEA,EAAA,OAAO,YAAA;AACT;AAKA,SAAS,mBAAA,CACP,YACA,SAAA,EACyB;AACzB,EAAA,IAAI,CAAC,UAAA,CAAW,QAAA,IAAY,CAAC,UAAA,CAAW,KAAA,IAAS,CAAC,SAAA,EAAW;AAC3D,IAAA,OAAO,EAAC;AAAA,EACV;AAEA,EAAA,MAAM,QAAA,GAAW,kBAAA,CAAmB,UAAA,CAAW,KAAK,CAAA;AACpD,EAAA,OAAO,SAAA,KAAc,MAAA,GAAS,QAAA,CAAS,IAAA,GAAO,QAAA,CAAS,IAAA;AACzD","file":"index.js","sourcesContent":["/**\n * State Graph Construction\n *\n * Build an adjacency list from state machine transitions.\n * Extracted from orbital-verify-unified/src/analyze.ts.\n *\n * @packageDocumentation\n */\n\nimport type { GraphTransition, StateEdge } from './types.js';\n\n/**\n * Builds an adjacency list from state machine transitions.\n * \n * Constructs a state transition graph where each state maps to an array\n * of outgoing edges (events and target states). Wildcard transitions\n * (from === '*') are excluded since they don't represent fixed edges.\n * Used as the foundation for state machine analysis, traversal, and verification.\n * \n * @param {GraphTransition[]} transitions - Array of state transitions\n * @returns {Map<string, StateEdge[]>} State transition graph\n * \n * @example\n * const graph = buildStateGraph(transitions);\n * const edgesFromInitial = graph.get('initial'); // Array of outgoing edges\n * console.log(`Initial state has ${edgesFromInitial?.length} transitions`);\n */\nexport function buildStateGraph(\n transitions: GraphTransition[]\n): Map<string, StateEdge[]> {\n const graph = new Map<string, StateEdge[]>();\n for (const t of transitions) {\n if (t.from === '*') continue;\n if (!graph.has(t.from)) graph.set(t.from, []);\n graph.get(t.from)!.push({ event: t.event, to: t.to });\n }\n return graph;\n}\n","/**\n * BFS Reachability Algorithms\n *\n * Breadth-first search over state machine graphs.\n * Extracted from orbital-verify-unified/src/analyze.ts and phase3-server.ts.\n *\n * @packageDocumentation\n */\n\nimport type { BFSNode, StateEdge } from './types.js';\nimport { buildStateGraph } from './graph.js';\nimport type { GraphTransition } from './types.js';\n\n/**\n * Collects all reachable states from an initial state using breadth-first search.\n * \n * Performs BFS traversal of the state machine to find all states reachable\n * from the initial state, up to the specified maximum depth. Used for\n * state machine analysis, verification, and test coverage assessment.\n * \n * @param {GraphTransition[]} transitions - Array of state transitions\n * @param {string} initialState - Starting state name\n * @param {number} [maxDepth=5] - Maximum search depth\n * @returns {Set<string>} Set of reachable state names\n * \n * @example\n * const reachable = collectReachableStates(transitions, 'initial', 10);\n * console.log('Reachable states:', Array.from(reachable));\n */\nexport function collectReachableStates(\n transitions: GraphTransition[],\n initialState: string,\n maxDepth = 5\n): Set<string> {\n const graph = buildStateGraph(transitions);\n const visited = new Set<string>([initialState]);\n const queue: BFSNode[] = [{ state: initialState, depth: 0 }];\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n if (current.depth >= maxDepth) continue;\n\n const edges = graph.get(current.state) ?? [];\n for (const edge of edges) {\n if (!visited.has(edge.to)) {\n visited.add(edge.to);\n queue.push({ state: edge.to, depth: current.depth + 1 });\n }\n }\n }\n\n return visited;\n}\n\n/**\n * Walks all reachable (state, event) pairs using BFS and invokes callback for each.\n * \n * Traverses the state machine using breadth-first search and calls the visitor\n * function for each (state, edge) pair encountered. Used by server verification\n * to test transitions by POSTing to endpoints and checking responses.\n * \n * @param {GraphTransition[]} transitions - Array of state transitions\n * @param {string} initialState - Starting state name\n * @param {number} maxDepth - Maximum BFS depth\n * @param {(state: string, edge: StateEdge, depth: number) => Promise<boolean>} visitor - Callback for each pair\n * @returns {Promise<{ visitedPairs: Set<string>; walkedEdges: number }>} Traversal statistics\n * \n * @example\n * const result = await walkStatePairs(transitions, 'initial', 5, async (state, edge) => {\n * console.log(`Transition: ${state} --${edge.event}--> ${edge.to}`);\n * return true; // Continue exploration\n * });\n * console.log(`Visited ${result.visitedPairs.size} state-event pairs`);\n */\nexport async function walkStatePairs(\n transitions: GraphTransition[],\n initialState: string,\n maxDepth: number,\n visitor: (state: string, edge: StateEdge, depth: number) => Promise<boolean>\n): Promise<{ visitedPairs: Set<string>; walkedEdges: number }> {\n const graph = buildStateGraph(transitions);\n const visitedPairs = new Set<string>();\n const queue: BFSNode[] = [{ state: initialState, depth: 0 }];\n let walkedEdges = 0;\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n if (current.depth >= maxDepth) continue;\n\n const edges = graph.get(current.state) ?? [];\n for (const edge of edges) {\n const pairKey = `${current.state}:${edge.event}`;\n if (visitedPairs.has(pairKey)) continue;\n visitedPairs.add(pairKey);\n\n const shouldEnqueue = await visitor(current.state, edge, current.depth);\n walkedEdges++;\n\n if (shouldEnqueue) {\n const stateVisited = [...visitedPairs].some((k) => k.startsWith(`${edge.to}:`));\n if (!stateVisited) {\n queue.push({ state: edge.to, depth: current.depth + 1 });\n }\n }\n }\n }\n\n return { visitedPairs, walkedEdges };\n}\n","/**\n * Guard Payload Builder\n *\n * Derive pass and fail payloads from guard s-expressions.\n * Extracted from orbital-verify-unified/src/analyze.ts.\n *\n * @packageDocumentation\n */\n\nimport type { GuardPayload } from './types.js';\n\n/**\n * Extracts the first segment of a payload field reference.\n * \n * Parses binding references in the format \"@payload.field\" and extracts\n * the first field name segment. Used for identifying payload fields in\n * guard conditions for test data generation.\n * \n * @param {unknown} ref - Binding reference to extract from\n * @returns {string | null} First field segment or null for non-payload references\n * \n * @example\n * extractPayloadFieldRef('@payload.item'); // returns 'item'\n * extractPayloadFieldRef('@payload.data.weight'); // returns 'data'\n * extractPayloadFieldRef('@entity.id'); // returns null\n * extractPayloadFieldRef('@user.name'); // returns null\n */\nexport function extractPayloadFieldRef(ref: unknown): string | null {\n if (typeof ref !== 'string') return null;\n const match = ref.match(/^@payload\\.([A-Za-z0-9_]+)/);\n return match ? match[1] : null;\n}\n\n/**\n * Builds test payloads that satisfy or violate guard conditions.\n * \n * Generates pass/fail test data for guard s-expressions used in state machine\n * transitions. Pass payloads satisfy the guard condition (allowing transition),\n * fail payloads violate it (blocking transition). Used for automated testing\n * and validation of state machine behavior.\n * \n * Supports operators: not-nil, nil, eq, not-eq, gt, gte, lt, lte, and, or, not\n * \n * @param {unknown} guard - Guard s-expression to analyze\n * @returns {GuardPayload} Object with pass and fail payloads\n * \n * @example\n * // Guard: ['not-nil', '@payload.completed']\n * buildGuardPayloads(['not-nil', '@payload.completed']);\n * // Returns: { pass: { completed: 'mock-test-value' }, fail: { completed: null } }\n * \n * @example\n * // Guard: ['eq', '@payload.status', 'active']\n * buildGuardPayloads(['eq', '@payload.status', 'active']);\n * // Returns: { pass: { status: 'active' }, fail: { status: 'not-active' } }\n * \n * @example\n * // Guard: ['and', ['not-nil', '@payload.id'], ['eq', '@payload.status', 'ready']]\n * buildGuardPayloads(['and', ['not-nil', '@payload.id'], ['eq', '@payload.status', 'ready']]);\n * // Returns: { pass: { id: 'mock-test-value', status: 'ready' }, fail: { id: null } }\n */\nexport function buildGuardPayloads(guard: unknown): GuardPayload {\n if (!Array.isArray(guard) || guard.length === 0) {\n return { pass: {}, fail: {} };\n }\n\n const op = String(guard[0]);\n\n if (op === 'not-nil' || op === 'not_nil') {\n const field = extractPayloadFieldRef(guard[1]);\n if (field) return { pass: { [field]: 'mock-test-value' }, fail: { [field]: null } };\n }\n\n if (op === 'nil') {\n const field = extractPayloadFieldRef(guard[1]);\n if (field) return { pass: {}, fail: { [field]: 'mock-test-value' } };\n }\n\n if (op === 'eq' || op === '==' || op === '=') {\n const field = extractPayloadFieldRef(guard[1]);\n const val = guard[2];\n if (field && val !== undefined) {\n const failVal =\n typeof val === 'number' ? val + 1\n : typeof val === 'string' ? `not-${val}`\n : null;\n return { pass: { [field]: val }, fail: { [field]: failVal } };\n }\n }\n\n if (op === 'not-eq' || op === '!=' || op === 'neq') {\n const field = extractPayloadFieldRef(guard[1]);\n const val = guard[2];\n if (field && val !== undefined) {\n const passVal =\n typeof val === 'number' ? val + 1\n : typeof val === 'string' ? `not-${val}`\n : 'other';\n return { pass: { [field]: passVal }, fail: { [field]: val } };\n }\n }\n\n if (op === 'gt' || op === '>') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n + 1 }, fail: { [field]: n - 1 } };\n }\n\n if (op === 'gte' || op === '>=') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n }, fail: { [field]: n - 1 } };\n }\n\n if (op === 'lt' || op === '<') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n - 1 }, fail: { [field]: n + 1 } };\n }\n\n if (op === 'lte' || op === '<=') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n }, fail: { [field]: n + 1 } };\n }\n\n if (op === 'and') {\n const subs = (guard.slice(1) as unknown[]).filter(Array.isArray);\n if (subs.length >= 2) {\n const s1 = buildGuardPayloads(subs[0]);\n const s2 = buildGuardPayloads(subs[1]);\n return { pass: { ...s1.pass, ...s2.pass }, fail: s1.fail };\n }\n if (subs.length === 1) return buildGuardPayloads(subs[0]);\n }\n\n if (op === 'or') {\n const subs = (guard.slice(1) as unknown[]).filter(Array.isArray);\n if (subs.length >= 2) {\n const s1 = buildGuardPayloads(subs[0]);\n const s2 = buildGuardPayloads(subs[1]);\n return { pass: s1.pass, fail: { ...s1.fail, ...s2.fail } };\n }\n if (subs.length === 1) return buildGuardPayloads(subs[0]);\n }\n\n if (op === 'not') {\n const inner = buildGuardPayloads(guard[1]);\n return { pass: inner.fail, fail: inner.pass };\n }\n\n return { pass: {}, fail: {} };\n}\n","/**\n * Replay Path Builder\n *\n * Compute the shortest path (replay steps) from an initial state\n * to every reachable state in a state machine. Used by browser\n * verification to navigate through states before running assertions.\n *\n * Extracted from orbital-verify-unified/src/analyze.ts (collectDataMutationTests).\n *\n * @packageDocumentation\n */\n\nimport type { GraphTransition, ReplayStep, PayloadFieldSchema } from './types.js';\n\n/** Entity-data sentinel payload fields: presence means transition needs a selected row */\nconst ENTITY_PAYLOAD_FIELDS = new Set(['data', 'row', 'item', 'id']);\n\n/**\n * Extended transition with render and payload info needed for replay path building.\n * Compatible with orbital-verify's UnifiedTransition.\n */\nexport interface ReplayTransition extends GraphTransition {\n hasGuard: boolean;\n guard?: unknown[];\n payloadFields: string[];\n payloadSchema: PayloadFieldSchema[];\n renderEffects: Array<{\n slot: string;\n patternType: string | null;\n }>;\n}\n\n/**\n * Builds the shortest replay paths from initial state to all reachable states.\n * \n * Computes step-by-step navigation paths for state machine testing and verification.\n * Uses breadth-first search to find shortest paths up to specified depth limit.\n * Each path contains replay steps with event, state, and payload information\n * needed to reproduce state transitions in tests.\n * \n * @param {ReplayTransition[]} transitions - Transitions with render/payload information\n * @param {string} initialState - Starting state name\n * @param {number} [maxDepth=3] - Maximum path length (default: 3)\n * @returns {Map<string, ReplayStep[]>} Map of state names to replay step arrays\n * \n * @example\n * // Build paths from 'initial' state\n * const paths = buildReplayPaths(transitions, 'initial', 5);\n * \n * // Get steps to reach 'completed' state\n * const stepsToComplete = paths.get('completed');\n * \n * // Execute replay steps\n * for (const step of stepsToComplete) {\n * await dispatchEvent(step.event, step.payload);\n * }\n */\nexport function buildReplayPaths(\n transitions: ReplayTransition[],\n initialState: string,\n maxDepth = 3\n): Map<string, ReplayStep[]> {\n type QueueNode = { state: string; path: ReplayStep[] };\n\n const queue: QueueNode[] = [{ state: initialState, path: [] }];\n const replayPaths = new Map<string, ReplayStep[]>();\n replayPaths.set(initialState, []);\n\n while (queue.length > 0) {\n const { state, path } = queue.shift()!;\n if (path.length >= maxDepth) continue;\n\n const fromHere = transitions.filter(\n (t) => t.from === state && t.event !== 'INIT',\n );\n\n for (const transition of fromHere) {\n if (replayPaths.has(transition.to)) continue;\n\n const renderEffect = transition.renderEffects.find((re) => re.patternType !== null);\n const stepNeedsEntityData =\n transition.hasGuard ||\n transition.payloadFields.some((f) => ENTITY_PAYLOAD_FIELDS.has(f));\n\n const step: ReplayStep = {\n event: transition.event,\n fromState: state,\n toState: transition.to,\n slot: renderEffect?.slot ?? 'main',\n expectedPattern: renderEffect?.patternType ?? undefined,\n needsEntityData: stepNeedsEntityData,\n payloadSchema: transition.payloadSchema.length > 0 ? transition.payloadSchema : undefined,\n };\n\n const newPath = [...path, step];\n replayPaths.set(transition.to, newPath);\n queue.push({ state: transition.to, path: newPath });\n }\n }\n\n return replayPaths;\n}\n","/**\n * Edge-Covering Walk Algorithm\n *\n * Computes an ordered sequence of events (WalkStep[]) that covers every\n * transition (edge) in a state machine graph at least once. This guarantees\n * 100% transition coverage regardless of graph topology.\n *\n * Algorithm:\n * 1. Build adjacency list and edge universe (guarded transitions produce two edges)\n * 2. Precompute BFS shortest paths between all state pairs (for repositioning)\n * 3. Greedy DFS: at each state, prefer uncovered outgoing edges\n * 4. When stuck, insert repositioning steps to nearest state with uncovered edges\n * 5. Guard-fail steps don't advance state (guard blocks transition)\n *\n * Used by StateWalkEngine in @almadar-io/verify. Both orbital-verify and\n * runtime-verify share this algorithm for consistent coverage.\n *\n * @packageDocumentation\n */\n\nimport type { EdgeWalkTransition, WalkStep, StateEdge } from './types.js';\nimport { buildGuardPayloads } from './guard-payloads.js';\n\n/**\n * Build an ordered walk that covers every edge in the state machine.\n *\n * @param transitions - All transitions in the state machine\n * @param initialState - Starting state\n * @returns Ordered walk steps covering every edge\n */\nexport function buildEdgeCoveringWalk(\n transitions: EdgeWalkTransition[],\n initialState: string,\n): WalkStep[] {\n // 1. Build adjacency list, skip wildcards and INIT\n const filtered = transitions.filter(\n (t) => t.from !== '*' && t.event !== 'INIT',\n );\n\n const graph = new Map<string, Array<{ event: string; to: string; transition: EdgeWalkTransition }>>();\n const allStates = new Set<string>();\n\n for (const t of filtered) {\n allStates.add(t.from);\n allStates.add(t.to);\n if (!graph.has(t.from)) graph.set(t.from, []);\n graph.get(t.from)!.push({ event: t.event, to: t.to, transition: t });\n }\n\n // Ensure initial state is in the set\n allStates.add(initialState);\n\n // 2. Build edge universe. Guarded transitions produce pass + fail edges.\n const uncovered = new Set<string>();\n const edgeMeta = new Map<string, { transition: EdgeWalkTransition; guardCase: 'pass' | 'fail' | null }>();\n\n for (const t of filtered) {\n if (t.hasGuard) {\n const keyPass = `${t.from}+${t.event}->${t.to}[pass]`;\n const keyFail = `${t.from}+${t.event}->${t.to}[fail]`;\n uncovered.add(keyPass);\n uncovered.add(keyFail);\n edgeMeta.set(keyPass, { transition: t, guardCase: 'pass' });\n edgeMeta.set(keyFail, { transition: t, guardCase: 'fail' });\n } else {\n const key = `${t.from}+${t.event}->${t.to}`;\n uncovered.add(key);\n edgeMeta.set(key, { transition: t, guardCase: null });\n }\n }\n\n if (uncovered.size === 0) return [];\n\n // 3. Precompute BFS shortest paths between all state pairs\n const shortestPaths = new Map<string, Map<string, Array<{ event: string; to: string }>>>();\n for (const state of allStates) {\n shortestPaths.set(state, bfsShortestPaths(state, graph));\n }\n\n // 4. Greedy walk\n const walk: WalkStep[] = [];\n let currentState = initialState;\n const maxIterations = uncovered.size * allStates.size * 2; // safety bound\n let iterations = 0;\n\n while (uncovered.size > 0 && iterations < maxIterations) {\n iterations++;\n\n // Find uncovered edges from currentState\n const outgoing = findUncoveredEdges(currentState, graph, uncovered);\n\n if (outgoing.length > 0) {\n // Pick first uncovered edge\n const pick = outgoing[0];\n const payload = buildPayloadForEdge(pick.transition, pick.guardCase);\n\n walk.push({\n from: currentState,\n event: pick.transition.event,\n to: pick.transition.to,\n guardCase: pick.guardCase,\n payload,\n isRepositioning: false,\n });\n\n uncovered.delete(pick.key);\n\n // Guard-fail doesn't advance state\n if (pick.guardCase !== 'fail') {\n currentState = pick.transition.to;\n }\n } else {\n // Stuck: find nearest state with uncovered edges\n const target = findNearestUncoveredState(currentState, graph, uncovered, shortestPaths);\n\n if (!target) {\n // No reachable state with uncovered edges. Remaining edges are unreachable.\n break;\n }\n\n // Insert repositioning steps\n const repoPath = shortestPaths.get(currentState)?.get(target);\n if (!repoPath || repoPath.length === 0) break;\n\n for (const step of repoPath) {\n walk.push({\n from: currentState,\n event: step.event,\n to: step.to,\n guardCase: null,\n payload: {},\n isRepositioning: true,\n });\n currentState = step.to;\n }\n }\n }\n\n return walk;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * BFS from a source state, returning shortest paths to all reachable states.\n * Each path is an array of {event, to} steps.\n */\nfunction bfsShortestPaths(\n source: string,\n graph: Map<string, Array<{ event: string; to: string; transition: EdgeWalkTransition }>>,\n): Map<string, Array<{ event: string; to: string }>> {\n const paths = new Map<string, Array<{ event: string; to: string }>>();\n const visited = new Set<string>([source]);\n const queue: Array<{ state: string; path: Array<{ event: string; to: string }> }> = [\n { state: source, path: [] },\n ];\n\n while (queue.length > 0) {\n const { state, path } = queue.shift()!;\n const edges = graph.get(state) ?? [];\n\n for (const edge of edges) {\n if (visited.has(edge.to)) continue;\n visited.add(edge.to);\n const newPath = [...path, { event: edge.event, to: edge.to }];\n paths.set(edge.to, newPath);\n queue.push({ state: edge.to, path: newPath });\n }\n }\n\n return paths;\n}\n\n/**\n * Find uncovered edges from a given state.\n */\nfunction findUncoveredEdges(\n state: string,\n graph: Map<string, Array<{ event: string; to: string; transition: EdgeWalkTransition }>>,\n uncovered: Set<string>,\n): Array<{ key: string; transition: EdgeWalkTransition; guardCase: 'pass' | 'fail' | null }> {\n const edges = graph.get(state) ?? [];\n const result: Array<{ key: string; transition: EdgeWalkTransition; guardCase: 'pass' | 'fail' | null }> = [];\n\n for (const edge of edges) {\n if (edge.transition.hasGuard) {\n const keyPass = `${state}+${edge.event}->${edge.to}[pass]`;\n const keyFail = `${state}+${edge.event}->${edge.to}[fail]`;\n // Prefer pass first (advances state), then fail\n if (uncovered.has(keyPass)) {\n result.push({ key: keyPass, transition: edge.transition, guardCase: 'pass' });\n }\n if (uncovered.has(keyFail)) {\n result.push({ key: keyFail, transition: edge.transition, guardCase: 'fail' });\n }\n } else {\n const key = `${state}+${edge.event}->${edge.to}`;\n if (uncovered.has(key)) {\n result.push({ key, transition: edge.transition, guardCase: null });\n }\n }\n }\n\n return result;\n}\n\n/**\n * Find the nearest state (from currentState) that has uncovered outgoing edges.\n */\nfunction findNearestUncoveredState(\n currentState: string,\n graph: Map<string, Array<{ event: string; to: string; transition: EdgeWalkTransition }>>,\n uncovered: Set<string>,\n shortestPaths: Map<string, Map<string, Array<{ event: string; to: string }>>>,\n): string | null {\n // Collect states that have uncovered edges\n const statesWithUncovered = new Set<string>();\n for (const key of uncovered) {\n // Key format: \"state+EVENT->target\" or \"state+EVENT->target[pass]\"\n const fromState = key.split('+')[0];\n statesWithUncovered.add(fromState);\n }\n\n // If current state has uncovered edges, return it (shouldn't happen, but handle it)\n if (statesWithUncovered.has(currentState)) return currentState;\n\n // Find nearest reachable state with uncovered edges\n const paths = shortestPaths.get(currentState);\n if (!paths) return null;\n\n let nearestState: string | null = null;\n let nearestDist = Infinity;\n\n for (const target of statesWithUncovered) {\n const path = paths.get(target);\n if (path && path.length < nearestDist) {\n nearestDist = path.length;\n nearestState = target;\n }\n }\n\n return nearestState;\n}\n\n/**\n * Build a payload for a given edge based on its guard case.\n */\nfunction buildPayloadForEdge(\n transition: EdgeWalkTransition,\n guardCase: 'pass' | 'fail' | null,\n): Record<string, unknown> {\n if (!transition.hasGuard || !transition.guard || !guardCase) {\n return {};\n }\n\n const payloads = buildGuardPayloads(transition.guard);\n return guardCase === 'pass' ? payloads.pass : payloads.fail;\n}\n"]}
1
+ {"version":3,"sources":["../../src/state-machine/graph.ts","../../src/state-machine/bfs.ts","../../src/state-machine/guard-payloads.ts","../../src/state-machine/replay-paths.ts","../../src/state-machine/edge-walk.ts"],"names":[],"mappings":";AA2BO,SAAS,gBACd,WAAA,EAC0B;AAC1B,EAAA,MAAM,KAAA,uBAAY,GAAA,EAAyB;AAC3C,EAAA,KAAA,MAAW,KAAK,WAAA,EAAa;AAC3B,IAAA,IAAI,CAAA,CAAE,SAAS,GAAA,EAAK;AACpB,IAAA,IAAI,CAAC,KAAA,CAAM,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,EAAG,KAAA,CAAM,GAAA,CAAI,CAAA,CAAE,IAAA,EAAM,EAAE,CAAA;AAC5C,IAAA,KAAA,CAAM,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,CAAG,IAAA,CAAK,EAAE,KAAA,EAAO,CAAA,CAAE,KAAA,EAAO,EAAA,EAAI,CAAA,CAAE,EAAA,EAAI,CAAA;AAAA,EACtD;AACA,EAAA,OAAO,KAAA;AACT;;;ACRO,SAAS,sBAAA,CACd,WAAA,EACA,YAAA,EACA,QAAA,GAAW,CAAA,EACE;AACb,EAAA,MAAM,KAAA,GAAQ,gBAAgB,WAAW,CAAA;AACzC,EAAA,MAAM,OAAA,m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ency list from state machine transitions.\n * Extracted from orbital-verify-unified/src/analyze.ts.\n *\n * @packageDocumentation\n */\n\nimport type { GraphTransition, StateEdge } from './types.js';\n\n/**\n * Builds an adjacency list from state machine transitions.\n * \n * Constructs a state transition graph where each state maps to an array\n * of outgoing edges (events and target states). Wildcard transitions\n * (from === '*') are excluded since they don't represent fixed edges.\n * Used as the foundation for state machine analysis, traversal, and verification.\n * \n * @param {GraphTransition[]} transitions - Array of state transitions\n * @returns {Map<string, StateEdge[]>} State transition graph\n * \n * @example\n * const graph = buildStateGraph(transitions);\n * const edgesFromInitial = graph.get('initial'); // Array of outgoing edges\n * console.log(`Initial state has ${edgesFromInitial?.length} transitions`);\n */\nexport function buildStateGraph(\n transitions: GraphTransition[]\n): Map<string, StateEdge[]> {\n const graph = new Map<string, StateEdge[]>();\n for (const t of transitions) {\n if (t.from === '*') continue;\n if (!graph.has(t.from)) graph.set(t.from, []);\n graph.get(t.from)!.push({ event: t.event, to: t.to });\n }\n return graph;\n}\n","/**\n * BFS Reachability Algorithms\n *\n * Breadth-first search over state machine graphs.\n * Extracted from orbital-verify-unified/src/analyze.ts and phase3-server.ts.\n *\n * @packageDocumentation\n */\n\nimport type { BFSNode, StateEdge } from './types.js';\nimport { buildStateGraph } from './graph.js';\nimport type { GraphTransition } from './types.js';\n\n/**\n * Collects all reachable states from an initial state using breadth-first search.\n * \n * Performs BFS traversal of the state machine to find all states reachable\n * from the initial state, up to the specified maximum depth. Used for\n * state machine analysis, verification, and test coverage assessment.\n * \n * @param {GraphTransition[]} transitions - Array of state transitions\n * @param {string} initialState - Starting state name\n * @param {number} [maxDepth=5] - Maximum search depth\n * @returns {Set<string>} Set of reachable state names\n * \n * @example\n * const reachable = collectReachableStates(transitions, 'initial', 10);\n * console.log('Reachable states:', Array.from(reachable));\n */\nexport function collectReachableStates(\n transitions: GraphTransition[],\n initialState: string,\n maxDepth = 5\n): Set<string> {\n const graph = buildStateGraph(transitions);\n const visited = new Set<string>([initialState]);\n const queue: BFSNode[] = [{ state: initialState, depth: 0 }];\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n if (current.depth >= maxDepth) continue;\n\n const edges = graph.get(current.state) ?? [];\n for (const edge of edges) {\n if (!visited.has(edge.to)) {\n visited.add(edge.to);\n queue.push({ state: edge.to, depth: current.depth + 1 });\n }\n }\n }\n\n return visited;\n}\n\n/**\n * Walks all reachable (state, event) pairs using BFS and invokes callback for each.\n * \n * Traverses the state machine using breadth-first search and calls the visitor\n * function for each (state, edge) pair encountered. Used by server verification\n * to test transitions by POSTing to endpoints and checking responses.\n * \n * @param {GraphTransition[]} transitions - Array of state transitions\n * @param {string} initialState - Starting state name\n * @param {number} maxDepth - Maximum BFS depth\n * @param {(state: string, edge: StateEdge, depth: number) => Promise<boolean>} visitor - Callback for each pair\n * @returns {Promise<{ visitedPairs: Set<string>; walkedEdges: number }>} Traversal statistics\n * \n * @example\n * const result = await walkStatePairs(transitions, 'initial', 5, async (state, edge) => {\n * console.log(`Transition: ${state} --${edge.event}--> ${edge.to}`);\n * return true; // Continue exploration\n * });\n * console.log(`Visited ${result.visitedPairs.size} state-event pairs`);\n */\nexport async function walkStatePairs(\n transitions: GraphTransition[],\n initialState: string,\n maxDepth: number,\n visitor: (state: string, edge: StateEdge, depth: number) => Promise<boolean>\n): Promise<{ visitedPairs: Set<string>; walkedEdges: number }> {\n const graph = buildStateGraph(transitions);\n const visitedPairs = new Set<string>();\n const queue: BFSNode[] = [{ state: initialState, depth: 0 }];\n let walkedEdges = 0;\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n if (current.depth >= maxDepth) continue;\n\n const edges = graph.get(current.state) ?? [];\n for (const edge of edges) {\n const pairKey = `${current.state}:${edge.event}`;\n if (visitedPairs.has(pairKey)) continue;\n visitedPairs.add(pairKey);\n\n const shouldEnqueue = await visitor(current.state, edge, current.depth);\n walkedEdges++;\n\n if (shouldEnqueue) {\n const stateVisited = [...visitedPairs].some((k) => k.startsWith(`${edge.to}:`));\n if (!stateVisited) {\n queue.push({ state: edge.to, depth: current.depth + 1 });\n }\n }\n }\n }\n\n return { visitedPairs, walkedEdges };\n}\n","/**\n * Guard Payload Builder\n *\n * Derive pass and fail payloads from guard s-expressions.\n * Extracted from orbital-verify-unified/src/analyze.ts.\n *\n * @packageDocumentation\n */\n\nimport type { GuardPayload } from './types.js';\n\n/**\n * Extracts the first segment of a payload field reference.\n * \n * Parses binding references in the format \"@payload.field\" and extracts\n * the first field name segment. Used for identifying payload fields in\n * guard conditions for test data generation.\n * \n * @param {unknown} ref - Binding reference to extract from\n * @returns {string | null} First field segment or null for non-payload references\n * \n * @example\n * extractPayloadFieldRef('@payload.item'); // returns 'item'\n * extractPayloadFieldRef('@payload.data.weight'); // returns 'data'\n * extractPayloadFieldRef('@entity.id'); // returns null\n * extractPayloadFieldRef('@user.name'); // returns null\n */\nexport function extractPayloadFieldRef(ref: unknown): string | null {\n if (typeof ref !== 'string') return null;\n const match = ref.match(/^@payload\\.([A-Za-z0-9_]+)/);\n return match ? match[1] : null;\n}\n\n/**\n * Builds test payloads that satisfy or violate guard conditions.\n * \n * Generates pass/fail test data for guard s-expressions used in state machine\n * transitions. Pass payloads satisfy the guard condition (allowing transition),\n * fail payloads violate it (blocking transition). Used for automated testing\n * and validation of state machine behavior.\n * \n * Supports operators: not-nil, nil, eq, not-eq, gt, gte, lt, lte, and, or, not\n * \n * @param {unknown} guard - Guard s-expression to analyze\n * @returns {GuardPayload} Object with pass and fail payloads\n * \n * @example\n * // Guard: ['not-nil', '@payload.completed']\n * buildGuardPayloads(['not-nil', '@payload.completed']);\n * // Returns: { pass: { completed: 'mock-test-value' }, fail: { completed: null } }\n * \n * @example\n * // Guard: ['eq', '@payload.status', 'active']\n * buildGuardPayloads(['eq', '@payload.status', 'active']);\n * // Returns: { pass: { status: 'active' }, fail: { status: 'not-active' } }\n * \n * @example\n * // Guard: ['and', ['not-nil', '@payload.id'], ['eq', '@payload.status', 'ready']]\n * buildGuardPayloads(['and', ['not-nil', '@payload.id'], ['eq', '@payload.status', 'ready']]);\n * // Returns: { pass: { id: 'mock-test-value', status: 'ready' }, fail: { id: null } }\n */\nexport function buildGuardPayloads(guard: unknown): GuardPayload {\n if (!Array.isArray(guard) || guard.length === 0) {\n return { pass: {}, fail: {} };\n }\n\n const op = String(guard[0]);\n\n if (op === 'not-nil' || op === 'not_nil') {\n const field = extractPayloadFieldRef(guard[1]);\n if (field) return { pass: { [field]: 'mock-test-value' }, fail: { [field]: null } };\n }\n\n if (op === 'nil') {\n const field = extractPayloadFieldRef(guard[1]);\n if (field) return { pass: {}, fail: { [field]: 'mock-test-value' } };\n }\n\n if (op === 'eq' || op === '==' || op === '=') {\n const field = extractPayloadFieldRef(guard[1]);\n const val = guard[2];\n if (field && val !== undefined) {\n const failVal =\n typeof val === 'number' ? val + 1\n : typeof val === 'string' ? `not-${val}`\n : null;\n return { pass: { [field]: val }, fail: { [field]: failVal } };\n }\n }\n\n if (op === 'not-eq' || op === '!=' || op === 'neq') {\n const field = extractPayloadFieldRef(guard[1]);\n const val = guard[2];\n if (field && val !== undefined) {\n const passVal =\n typeof val === 'number' ? val + 1\n : typeof val === 'string' ? `not-${val}`\n : 'other';\n return { pass: { [field]: passVal }, fail: { [field]: val } };\n }\n }\n\n if (op === 'gt' || op === '>') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n + 1 }, fail: { [field]: n - 1 } };\n }\n\n if (op === 'gte' || op === '>=') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n }, fail: { [field]: n - 1 } };\n }\n\n if (op === 'lt' || op === '<') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n - 1 }, fail: { [field]: n + 1 } };\n }\n\n if (op === 'lte' || op === '<=') {\n const field = extractPayloadFieldRef(guard[1]);\n const n = typeof guard[2] === 'number' ? guard[2] : 0;\n if (field) return { pass: { [field]: n }, fail: { [field]: n + 1 } };\n }\n\n if (op === 'and') {\n const subs = (guard.slice(1) as unknown[]).filter(Array.isArray);\n if (subs.length >= 2) {\n const s1 = buildGuardPayloads(subs[0]);\n const s2 = buildGuardPayloads(subs[1]);\n return { pass: { ...s1.pass, ...s2.pass }, fail: s1.fail };\n }\n if (subs.length === 1) return buildGuardPayloads(subs[0]);\n }\n\n if (op === 'or') {\n const subs = (guard.slice(1) as unknown[]).filter(Array.isArray);\n if (subs.length >= 2) {\n const s1 = buildGuardPayloads(subs[0]);\n const s2 = buildGuardPayloads(subs[1]);\n return { pass: s1.pass, fail: { ...s1.fail, ...s2.fail } };\n }\n if (subs.length === 1) return buildGuardPayloads(subs[0]);\n }\n\n if (op === 'not') {\n const inner = buildGuardPayloads(guard[1]);\n return { pass: inner.fail, fail: inner.pass };\n }\n\n return { pass: {}, fail: {} };\n}\n","/**\n * Replay Path Builder\n *\n * Compute the shortest path (replay steps) from an initial state\n * to every reachable state in a state machine. Used by browser\n * verification to navigate through states before running assertions.\n *\n * Extracted from orbital-verify-unified/src/analyze.ts (collectDataMutationTests).\n *\n * @packageDocumentation\n */\n\nimport type { GraphTransition, ReplayStep, PayloadFieldSchema } from './types.js';\n\n/** Entity-data sentinel payload fields: presence means transition needs a selected row */\nconst ENTITY_PAYLOAD_FIELDS = new Set(['data', 'row', 'item', 'id']);\n\n/**\n * Extended transition with render and payload info needed for replay path building.\n * Compatible with orbital-verify's UnifiedTransition.\n */\nexport interface ReplayTransition extends GraphTransition {\n hasGuard: boolean;\n guard?: unknown[];\n payloadFields: string[];\n payloadSchema: PayloadFieldSchema[];\n renderEffects: Array<{\n slot: string;\n patternType: string | null;\n }>;\n}\n\n/**\n * Builds the shortest replay paths from initial state to all reachable states.\n * \n * Computes step-by-step navigation paths for state machine testing and verification.\n * Uses breadth-first search to find shortest paths up to specified depth limit.\n * Each path contains replay steps with event, state, and payload information\n * needed to reproduce state transitions in tests.\n * \n * @param {ReplayTransition[]} transitions - Transitions with render/payload information\n * @param {string} initialState - Starting state name\n * @param {number} [maxDepth=3] - Maximum path length (default: 3)\n * @returns {Map<string, ReplayStep[]>} Map of state names to replay step arrays\n * \n * @example\n * // Build paths from 'initial' state\n * const paths = buildReplayPaths(transitions, 'initial', 5);\n * \n * // Get steps to reach 'completed' state\n * const stepsToComplete = paths.get('completed');\n * \n * // Execute replay steps\n * for (const step of stepsToComplete) {\n * await dispatchEvent(step.event, step.payload);\n * }\n */\nexport function buildReplayPaths(\n transitions: ReplayTransition[],\n initialState: string,\n maxDepth = 3\n): Map<string, ReplayStep[]> {\n type QueueNode = { state: string; path: ReplayStep[] };\n\n const queue: QueueNode[] = [{ state: initialState, path: [] }];\n const replayPaths = new Map<string, ReplayStep[]>();\n replayPaths.set(initialState, []);\n\n while (queue.length > 0) {\n const { state, path } = queue.shift()!;\n if (path.length >= maxDepth) continue;\n\n const fromHere = transitions.filter(\n (t) => t.from === state && t.event !== 'INIT',\n );\n\n for (const transition of fromHere) {\n if (replayPaths.has(transition.to)) continue;\n\n const renderEffect = transition.renderEffects.find((re) => re.patternType !== null);\n const stepNeedsEntityData =\n transition.hasGuard ||\n transition.payloadFields.some((f) => ENTITY_PAYLOAD_FIELDS.has(f));\n\n const step: ReplayStep = {\n event: transition.event,\n fromState: state,\n toState: transition.to,\n slot: renderEffect?.slot ?? 'main',\n expectedPattern: renderEffect?.patternType ?? undefined,\n needsEntityData: stepNeedsEntityData,\n payloadSchema: transition.payloadSchema.length > 0 ? transition.payloadSchema : undefined,\n };\n\n const newPath = [...path, step];\n replayPaths.set(transition.to, newPath);\n queue.push({ state: transition.to, path: newPath });\n }\n }\n\n return replayPaths;\n}\n","/**\n * Edge-Covering Walk Algorithm\n *\n * Computes an ordered sequence of events (WalkStep[]) that covers every\n * transition (edge) in a state machine graph at least once. This guarantees\n * 100% transition coverage regardless of graph topology.\n *\n * Algorithm:\n * 1. Build adjacency list and edge universe (guarded transitions produce two edges)\n * 2. Precompute BFS shortest paths between all state pairs (for repositioning)\n * 3. Greedy DFS: at each state, prefer uncovered outgoing edges\n * 4. When stuck, insert repositioning steps to nearest state with uncovered edges\n * 5. Guard-fail steps don't advance state (guard blocks transition)\n *\n * Used by StateWalkEngine in @almadar-io/verify. Both orbital-verify and\n * runtime-verify share this algorithm for consistent coverage.\n *\n * @packageDocumentation\n */\n\nimport type { EdgeWalkTransition, WalkStep, StateEdge } from './types.js';\nimport { buildGuardPayloads } from './guard-payloads.js';\n\n/**\n * Build an ordered walk that covers every edge in the state machine.\n *\n * @param transitions - All transitions in the state machine\n * @param initialState - Starting state\n * @returns Ordered walk steps covering every edge\n */\nexport function buildEdgeCoveringWalk(\n transitions: EdgeWalkTransition[],\n initialState: string,\n): WalkStep[] {\n // 1. Build adjacency list, skip wildcards and INIT\n const filtered = transitions.filter(\n (t) => t.from !== '*' && t.event !== 'INIT',\n );\n\n const graph = new Map<string, Array<{ event: string; to: string; transition: EdgeWalkTransition }>>();\n const allStates = new Set<string>();\n\n for (const t of filtered) {\n allStates.add(t.from);\n allStates.add(t.to);\n if (!graph.has(t.from)) graph.set(t.from, []);\n graph.get(t.from)!.push({ event: t.event, to: t.to, transition: t });\n }\n\n // Ensure initial state is in the set\n allStates.add(initialState);\n\n // 2. Build edge universe. Guarded transitions produce pass + fail edges.\n const uncovered = new Set<string>();\n const edgeMeta = new Map<string, { transition: EdgeWalkTransition; guardCase: 'pass' | 'fail' | null }>();\n\n for (const t of filtered) {\n if (t.hasGuard) {\n const keyPass = `${t.from}+${t.event}->${t.to}[pass]`;\n const keyFail = `${t.from}+${t.event}->${t.to}[fail]`;\n uncovered.add(keyPass);\n uncovered.add(keyFail);\n edgeMeta.set(keyPass, { transition: t, guardCase: 'pass' });\n edgeMeta.set(keyFail, { transition: t, guardCase: 'fail' });\n } else {\n const key = `${t.from}+${t.event}->${t.to}`;\n uncovered.add(key);\n edgeMeta.set(key, { transition: t, guardCase: null });\n }\n }\n\n if (uncovered.size === 0) return [];\n\n // 3. Precompute BFS shortest paths between all state pairs\n const shortestPaths = new Map<string, Map<string, Array<{ event: string; to: string }>>>();\n for (const state of allStates) {\n shortestPaths.set(state, bfsShortestPaths(state, graph));\n }\n\n // 4. Greedy walk\n const walk: WalkStep[] = [];\n let currentState = initialState;\n const maxIterations = uncovered.size * allStates.size * 2; // safety bound\n let iterations = 0;\n\n while (uncovered.size > 0 && iterations < maxIterations) {\n iterations++;\n\n // Find uncovered edges from currentState\n const outgoing = findUncoveredEdges(currentState, graph, uncovered);\n\n if (outgoing.length > 0) {\n // Pick first uncovered edge\n const pick = outgoing[0];\n const payload = buildPayloadForEdge(pick.transition, pick.guardCase);\n\n walk.push({\n from: currentState,\n event: pick.transition.event,\n to: pick.transition.to,\n guardCase: pick.guardCase,\n payload,\n isRepositioning: false,\n });\n\n uncovered.delete(pick.key);\n\n // Guard-fail doesn't advance state\n if (pick.guardCase !== 'fail') {\n currentState = pick.transition.to;\n }\n } else {\n // Stuck: find nearest state with uncovered edges\n const target = findNearestUncoveredState(currentState, graph, uncovered, shortestPaths);\n\n if (!target) {\n // No reachable state with uncovered edges. Remaining edges are unreachable.\n break;\n }\n\n // Insert repositioning steps\n const repoPath = shortestPaths.get(currentState)?.get(target);\n if (!repoPath || repoPath.length === 0) break;\n\n for (const step of repoPath) {\n walk.push({\n from: currentState,\n event: step.event,\n to: step.to,\n guardCase: null,\n payload: {},\n isRepositioning: true,\n });\n currentState = step.to;\n }\n }\n }\n\n return walk;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * BFS from a source state, returning shortest paths to all reachable states.\n * Each path is an array of {event, to} steps.\n */\nfunction bfsShortestPaths(\n source: string,\n graph: Map<string, Array<{ event: string; to: string; transition: EdgeWalkTransition }>>,\n): Map<string, Array<{ event: string; to: string }>> {\n const paths = new Map<string, Array<{ event: string; to: string }>>();\n const visited = new Set<string>([source]);\n const queue: Array<{ state: string; path: Array<{ event: string; to: string }> }> = [\n { state: source, path: [] },\n ];\n\n while (queue.length > 0) {\n const { state, path } = queue.shift()!;\n const edges = graph.get(state) ?? [];\n\n for (const edge of edges) {\n if (visited.has(edge.to)) continue;\n visited.add(edge.to);\n const newPath = [...path, { event: edge.event, to: edge.to }];\n paths.set(edge.to, newPath);\n queue.push({ state: edge.to, path: newPath });\n }\n }\n\n return paths;\n}\n\n/**\n * Find uncovered edges from a given state.\n */\nfunction findUncoveredEdges(\n state: string,\n graph: Map<string, Array<{ event: string; to: string; transition: EdgeWalkTransition }>>,\n uncovered: Set<string>,\n): Array<{ key: string; transition: EdgeWalkTransition; guardCase: 'pass' | 'fail' | null }> {\n const edges = graph.get(state) ?? [];\n const result: Array<{ key: string; transition: EdgeWalkTransition; guardCase: 'pass' | 'fail' | null }> = [];\n\n for (const edge of edges) {\n if (edge.transition.hasGuard) {\n const keyPass = `${state}+${edge.event}->${edge.to}[pass]`;\n const keyFail = `${state}+${edge.event}->${edge.to}[fail]`;\n // Prefer pass first (advances state), then fail\n if (uncovered.has(keyPass)) {\n result.push({ key: keyPass, transition: edge.transition, guardCase: 'pass' });\n }\n if (uncovered.has(keyFail)) {\n result.push({ key: keyFail, transition: edge.transition, guardCase: 'fail' });\n }\n } else {\n const key = `${state}+${edge.event}->${edge.to}`;\n if (uncovered.has(key)) {\n result.push({ key, transition: edge.transition, guardCase: null });\n }\n }\n }\n\n return result;\n}\n\n/**\n * Find the nearest state (from currentState) that has uncovered outgoing edges.\n */\nfunction findNearestUncoveredState(\n currentState: string,\n graph: Map<string, Array<{ event: string; to: string; transition: EdgeWalkTransition }>>,\n uncovered: Set<string>,\n shortestPaths: Map<string, Map<string, Array<{ event: string; to: string }>>>,\n): string | null {\n // Collect states that have uncovered edges\n const statesWithUncovered = new Set<string>();\n for (const key of uncovered) {\n // Key format: \"state+EVENT->target\" or \"state+EVENT->target[pass]\"\n const fromState = key.split('+')[0];\n statesWithUncovered.add(fromState);\n }\n\n // If current state has uncovered edges, return it (shouldn't happen, but handle it)\n if (statesWithUncovered.has(currentState)) return currentState;\n\n // Find nearest reachable state with uncovered edges\n const paths = shortestPaths.get(currentState);\n if (!paths) return null;\n\n let nearestState: string | null = null;\n let nearestDist = Infinity;\n\n for (const target of statesWithUncovered) {\n const path = paths.get(target);\n if (path && path.length < nearestDist) {\n nearestDist = path.length;\n nearestState = target;\n }\n }\n\n return nearestState;\n}\n\n/**\n * Build a payload for a given edge based on its guard case and payload schema.\n * For guarded transitions, uses guard expressions to generate pass/fail payloads.\n * For unguarded transitions with payload schemas (e.g., EDIT/VIEW with { id }),\n * generates mock values so fetch-by-ID effects can resolve entity data.\n */\nfunction buildPayloadForEdge(\n transition: EdgeWalkTransition,\n guardCase: 'pass' | 'fail' | null,\n): Record<string, unknown> {\n // Guard-based payload generation (existing behavior)\n if (transition.hasGuard && transition.guard && guardCase) {\n const payloads = buildGuardPayloads(transition.guard);\n return guardCase === 'pass' ? payloads.pass : payloads.fail;\n }\n\n // Schema-based payload generation for events that declare required fields\n // (e.g., EDIT/VIEW declare { name: \"id\", type: \"string\", required: true })\n if (transition.payloadSchema && transition.payloadSchema.length > 0) {\n const payload: Record<string, unknown> = {};\n for (const field of transition.payloadSchema) {\n // Use caller-provided mockValue if available (set from entity context)\n if (field.mockValue !== undefined) {\n payload[field.name] = field.mockValue;\n } else if (field.type === 'string') {\n payload[field.name] = `mock-${field.name}`;\n } else if (field.type === 'number') {\n payload[field.name] = 1;\n } else if (field.type === 'boolean') {\n payload[field.name] = true;\n } else {\n payload[field.name] = `mock-${field.name}`;\n }\n }\n return payload;\n }\n\n return {};\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { bv as SExpr } from '../schema-BNBpNxGb.js';
2
- export { A as AGENT_DOMAIN_CATEGORIES, e as ALLOWED_CUSTOM_COMPONENTS, f as AgentDomainCategory, g as AgentDomainCategorySchema, h as AllowedCustomComponent, i as AnimationDef, j as AnimationDefInput, k as AnimationDefSchema, b as AppSchema, l as AssetMap, m as AssetMapInput, n as AssetMapSchema, o as AssetMapping, p as AssetMappingInput, q as AssetMappingSchema, r as AtomicEffect, C as CORE_BINDINGS, s as CallServiceConfig, t as ComputedEventContract, u as ComputedEventContractSchema, v as ComputedEventListener, w as ComputedEventListenerSchema, x as CoreBinding, y as CustomPatternDefinition, z as CustomPatternDefinitionInput, B as CustomPatternDefinitionSchema, D as CustomPatternMap, F as CustomPatternMapInput, G as CustomPatternMapSchema, H as DerefEffect, I as DesignPreferences, J as DesignPreferencesInput, K as DesignPreferencesSchema, L as DesignTokens, M as DesignTokensInput, N as DesignTokensSchema, Q as DomainCategory, R as DomainCategorySchema, U as DomainContext, V as DomainContextInput, W as DomainContextSchema, X as DomainVocabulary, Y as DomainVocabularySchema, Z as ENTITY_ROLES, _ as Effect, $ as EffectInput, a0 as EffectSchema, d as Entity, E as EntityField, a1 as EntityFieldInput, a2 as EntityFieldSchema, a as EntityPersistence, a3 as EntityPersistenceSchema, a4 as EntityRef, a5 as EntityRefSchema, a6 as EntityRefStringSchema, a7 as EntityRole, a8 as EntityRoleSchema, a9 as EntitySchema, aa as EntitySemanticRole, ab as EntitySemanticRoleSchema, ac as Event, ad as EventInput, ae as EventListener, af as EventListenerSchema, ag as EventPayloadField, ah as EventPayloadFieldSchema, ai as EventSchema, aj as EventScope, ak as EventScopeSchema, al as EventSemanticRole, am as EventSemanticRoleSchema, an as EventSource, ao as EventSourceSchema, ap as Expression, aq as ExpressionInput, ar as ExpressionSchema, as as Field, at as FieldFormat, au as FieldFormatSchema, av as FieldSchema, aw as FieldType, ax as FieldTypeSchema, ay as FullOrbitalUnit, az as GAME_TYPES, aA as GameSubCategory, aB as GameSubCategorySchema, aC as GameType, aD as GameTypeSchema, aE as Guard, aF as GuardInput, aG as GuardSchema, aH as McpServiceDef, aI as McpServiceDefSchema, aJ as NodeClassification, aK as NodeClassificationSchema, ay as Orbital, aL as OrbitalConfig, aM as OrbitalConfigInput, aN as OrbitalConfigSchema, O as OrbitalDefinition, aO as OrbitalDefinitionSchema, aP as OrbitalEntity, aQ as OrbitalEntityInput, aR as OrbitalEntitySchema, aS as OrbitalInput, aT as OrbitalPage, aU as OrbitalPageInput, aV as OrbitalPageSchema, aW as OrbitalPageStrictInput, aX as OrbitalPageStrictSchema, b as OrbitalSchema, aY as OrbitalSchemaInput, aZ as OrbitalSchemaSchema, a_ as OrbitalTraitRef, a$ as OrbitalTraitRefSchema, b0 as OrbitalUnit, b1 as OrbitalUnitSchema, b2 as OrbitalZodSchema, P as Page, b3 as PageRef, b4 as PageRefObject, b5 as PageRefObjectSchema, b6 as PageRefSchema, b7 as PageRefStringSchema, b8 as PageSchema, b9 as PageTraitRef, ba as PageTraitRefSchema, bb as ParsedBinding, bc as PayloadField, bd as PayloadFieldSchema, be as PresentationType, bf as RefEffect, bg as RelatedLink, bh as RelatedLinkSchema, bi as RelationConfig, bj as RelationConfigSchema, bk as RenderUIConfig, bl as RequiredField, bm as RequiredFieldSchema, bn as ResolvedAsset, bo as ResolvedAssetInput, bp as ResolvedAssetSchema, bq as RestAuthConfig, br as RestAuthConfigSchema, bs as RestServiceDef, bt as RestServiceDefSchema, bu as SERVICE_TYPES, bw as SExprAtom, bx as SExprAtomSchema, by as SExprInput, bz as SExprSchema, bA as SemanticAssetRef, bB as SemanticAssetRefInput, bC as SemanticAssetRefSchema, bD as ServiceDefinition, bE as ServiceDefinitionSchema, bF as ServiceRef, bG as ServiceRefSchema, bH as ServiceRefStringSchema, bI as ServiceType, bJ as ServiceTypeSchema, bK as SocketEvents, bL as SocketEventsSchema, bM as SocketServiceDef, bN as SocketServiceDefSchema, S as State, bO as StateInput, bP as StateMachine, bQ as StateMachineInput, bR as StateMachineSchema, bS as StateSchema, bT as StateSemanticRole, bU as StateSemanticRoleSchema, bV as SuggestedGuard, bW as SuggestedGuardSchema, bX as SwapEffect, bY as ThemeDefinition, bZ as ThemeDefinitionSchema, b_ as ThemeRef, b$ as ThemeRefSchema, c0 as ThemeRefStringSchema, c1 as ThemeTokens, c2 as ThemeTokensSchema, c3 as ThemeVariant, c4 as ThemeVariantSchema, c as Trait, c5 as TraitCategory, c6 as TraitCategorySchema, c7 as TraitDataEntity, c8 as TraitDataEntitySchema, c9 as TraitEntityField, ca as TraitEntityFieldSchema, T as TraitEventContract, cb as TraitEventContractSchema, cc as TraitEventListener, cd as TraitEventListenerSchema, ce as TraitInput, cf as TraitRef, cg as TraitRefSchema, ch as TraitReference, ci as TraitReferenceInput, cj as TraitReferenceSchema, ck as TraitSchema, cl as TraitTick, cm as TraitTickSchema, cn as TraitUIBinding, co as Transition, cp as TransitionInput, cq as TransitionSchema, cr as UISlot, cs as UISlotSchema, ct as UI_SLOTS, cu as UXHints, cv as UXHintsSchema, cw as UseDeclaration, cx as UseDeclarationSchema, cy as UserPersona, cz as UserPersonaInput, cA as UserPersonaSchema, cB as VISUAL_STYLES, cC as ViewType, cD as ViewTypeSchema, cE as VisualStyle, cF as VisualStyleSchema, cG as WatchEffect, cH as WatchOptions, cI as atomic, cJ as callService, cK as collectBindings, cL as createAssetKey, cM as deref, cN as deriveCollection, cO as despawn, cP as doEffects, cQ as emit, cR as findService, cS as getArgs, cT as getDefaultAnimationsForRole, cU as getOperator, cV as getServiceNames, cW as getTraitConfig, cX as getTraitName, cY as hasService, cZ as isBinding, c_ as isCircuitEvent, c$ as isEffect, d0 as isEntityReference, d1 as isImportedTraitRef, d2 as isInlineTrait, d3 as isMcpService, d4 as isOrbitalDefinition, d5 as isPageReference, d6 as isPageReferenceObject, d7 as isPageReferenceString, d8 as isRestService, d9 as isRuntimeEntity, da as isSExpr, db as isSExprAtom, dc as isSExprCall, dd as isSExprEffect, de as isServiceReference, df as isSingletonEntity, dg as isSocketService, dh as isThemeReference, di as isValidBinding, dj as navigate, dk as normalizeTraitRef, dl as notify, dm as parseAssetKey, dn as parseBinding, dp as parseEntityRef, dq as parseImportedTraitRef, dr as parseOrbitalSchema, ds as parsePageRef, dt as parseServiceRef, du as persist, dv as ref, dw as renderUI, dx as safeParseOrbitalSchema, dy as set, dz as sexpr, dA as spawn, dB as swap, dC as validateAssetAnimations, dD as walkSExpr, dE as watch } from '../schema-BNBpNxGb.js';
1
+ import { bv as SExpr } from '../schema-B2HUtPrQ.js';
2
+ export { A as AGENT_DOMAIN_CATEGORIES, e as ALLOWED_CUSTOM_COMPONENTS, f as AgentDomainCategory, g as AgentDomainCategorySchema, h as AllowedCustomComponent, i as AnimationDef, j as AnimationDefInput, k as AnimationDefSchema, b as AppSchema, l as AssetMap, m as AssetMapInput, n as AssetMapSchema, o as AssetMapping, p as AssetMappingInput, q as AssetMappingSchema, r as AtomicEffect, C as CORE_BINDINGS, s as CallServiceConfig, t as ComputedEventContract, u as ComputedEventContractSchema, v as ComputedEventListener, w as ComputedEventListenerSchema, x as CoreBinding, y as CustomPatternDefinition, z as CustomPatternDefinitionInput, B as CustomPatternDefinitionSchema, D as CustomPatternMap, F as CustomPatternMapInput, G as CustomPatternMapSchema, H as DerefEffect, I as DesignPreferences, J as DesignPreferencesInput, K as DesignPreferencesSchema, L as DesignTokens, M as DesignTokensInput, N as DesignTokensSchema, Q as DomainCategory, R as DomainCategorySchema, U as DomainContext, V as DomainContextInput, W as DomainContextSchema, X as DomainVocabulary, Y as DomainVocabularySchema, Z as ENTITY_ROLES, _ as Effect, $ as EffectInput, a0 as EffectSchema, d as Entity, E as EntityField, a1 as EntityFieldInput, a2 as EntityFieldSchema, a as EntityPersistence, a3 as EntityPersistenceSchema, a4 as EntityRef, a5 as EntityRefSchema, a6 as EntityRefStringSchema, a7 as EntityRole, a8 as EntityRoleSchema, a9 as EntitySchema, aa as EntitySemanticRole, ab as EntitySemanticRoleSchema, ac as Event, ad as EventInput, ae as EventListener, af as EventListenerSchema, ag as EventPayloadField, ah as EventPayloadFieldSchema, ai as EventSchema, aj as EventScope, ak as EventScopeSchema, al as EventSemanticRole, am as EventSemanticRoleSchema, an as EventSource, ao as EventSourceSchema, ap as Expression, aq as ExpressionInput, ar as ExpressionSchema, as as Field, at as FieldFormat, au as FieldFormatSchema, av as FieldSchema, aw as FieldType, ax as FieldTypeSchema, ay as FullOrbitalUnit, az as GAME_TYPES, aA as GameSubCategory, aB as GameSubCategorySchema, aC as GameType, aD as GameTypeSchema, aE as Guard, aF as GuardInput, aG as GuardSchema, aH as McpServiceDef, aI as McpServiceDefSchema, aJ as NodeClassification, aK as NodeClassificationSchema, ay as Orbital, aL as OrbitalConfig, aM as OrbitalConfigInput, aN as OrbitalConfigSchema, O as OrbitalDefinition, aO as OrbitalDefinitionSchema, aP as OrbitalEntity, aQ as OrbitalEntityInput, aR as OrbitalEntitySchema, aS as OrbitalInput, aT as OrbitalPage, aU as OrbitalPageInput, aV as OrbitalPageSchema, aW as OrbitalPageStrictInput, aX as OrbitalPageStrictSchema, b as OrbitalSchema, aY as OrbitalSchemaInput, aZ as OrbitalSchemaSchema, a_ as OrbitalTraitRef, a$ as OrbitalTraitRefSchema, b0 as OrbitalUnit, b1 as OrbitalUnitSchema, b2 as OrbitalZodSchema, P as Page, b3 as PageRef, b4 as PageRefObject, b5 as PageRefObjectSchema, b6 as PageRefSchema, b7 as PageRefStringSchema, b8 as PageSchema, b9 as PageTraitRef, ba as PageTraitRefSchema, bb as ParsedBinding, bc as PayloadField, bd as PayloadFieldSchema, be as PresentationType, bf as RefEffect, bg as RelatedLink, bh as RelatedLinkSchema, bi as RelationConfig, bj as RelationConfigSchema, bk as RenderUIConfig, bl as RequiredField, bm as RequiredFieldSchema, bn as ResolvedAsset, bo as ResolvedAssetInput, bp as ResolvedAssetSchema, bq as RestAuthConfig, br as RestAuthConfigSchema, bs as RestServiceDef, bt as RestServiceDefSchema, bu as SERVICE_TYPES, bw as SExprAtom, bx as SExprAtomSchema, by as SExprInput, bz as SExprSchema, bA as SemanticAssetRef, bB as SemanticAssetRefInput, bC as SemanticAssetRefSchema, bD as ServiceDefinition, bE as ServiceDefinitionSchema, bF as ServiceRef, bG as ServiceRefSchema, bH as ServiceRefStringSchema, bI as ServiceType, bJ as ServiceTypeSchema, bK as SocketEvents, bL as SocketEventsSchema, bM as SocketServiceDef, bN as SocketServiceDefSchema, S as State, bO as StateInput, bP as StateMachine, bQ as StateMachineInput, bR as StateMachineSchema, bS as StateSchema, bT as StateSemanticRole, bU as StateSemanticRoleSchema, bV as SuggestedGuard, bW as SuggestedGuardSchema, bX as SwapEffect, bY as ThemeDefinition, bZ as ThemeDefinitionSchema, b_ as ThemeRef, b$ as ThemeRefSchema, c0 as ThemeRefStringSchema, c1 as ThemeTokens, c2 as ThemeTokensSchema, c3 as ThemeVariant, c4 as ThemeVariantSchema, c as Trait, c5 as TraitCategory, c6 as TraitCategorySchema, c7 as TraitDataEntity, c8 as TraitDataEntitySchema, c9 as TraitEntityField, ca as TraitEntityFieldSchema, T as TraitEventContract, cb as TraitEventContractSchema, cc as TraitEventListener, cd as TraitEventListenerSchema, ce as TraitInput, cf as TraitRef, cg as TraitRefSchema, ch as TraitReference, ci as TraitReferenceInput, cj as TraitReferenceSchema, ck as TraitSchema, cl as TraitTick, cm as TraitTickSchema, cn as TraitUIBinding, co as Transition, cp as TransitionInput, cq as TransitionSchema, cr as UISlot, cs as UISlotSchema, ct as UI_SLOTS, cu as UXHints, cv as UXHintsSchema, cw as UseDeclaration, cx as UseDeclarationSchema, cy as UserPersona, cz as UserPersonaInput, cA as UserPersonaSchema, cB as VISUAL_STYLES, cC as ViewType, cD as ViewTypeSchema, cE as VisualStyle, cF as VisualStyleSchema, cG as WatchEffect, cH as WatchOptions, cI as atomic, cJ as callService, cK as collectBindings, cL as createAssetKey, cM as deref, cN as deriveCollection, cO as despawn, cP as doEffects, cQ as emit, cR as findService, cS as getArgs, cT as getDefaultAnimationsForRole, cU as getOperator, cV as getServiceNames, cW as getTraitConfig, cX as getTraitName, cY as hasService, cZ as isBinding, c_ as isCircuitEvent, c$ as isEffect, d0 as isEntityReference, d1 as isImportedTraitRef, d2 as isInlineTrait, d3 as isMcpService, d4 as isOrbitalDefinition, d5 as isPageReference, d6 as isPageReferenceObject, d7 as isPageReferenceString, d8 as isRestService, d9 as isRuntimeEntity, da as isSExpr, db as isSExprAtom, dc as isSExprCall, dd as isSExprEffect, de as isServiceReference, df as isSingletonEntity, dg as isSocketService, dh as isThemeReference, di as isValidBinding, dj as navigate, dk as normalizeTraitRef, dl as notify, dm as parseAssetKey, dn as parseBinding, dp as parseEntityRef, dq as parseImportedTraitRef, dr as parseOrbitalSchema, ds as parsePageRef, dt as parseServiceRef, du as persist, dv as ref, dw as renderUI, dx as safeParseOrbitalSchema, dy as set, dz as sexpr, dA as spawn, dB as swap, dC as validateAssetAnimations, dD as walkSExpr, dE as watch } from '../schema-B2HUtPrQ.js';
3
3
  import { z } from 'zod';
4
4
  export { CATEGORIES, CategoryMeta, OPERATORS, OPERATORS_SCHEMA, OPERATOR_NAMES, OperatorCategory, OperatorMeta, OperatorStats, OperatorsSchema, TargetPlatform, getOperatorMeta, getOperatorStats, getOperatorsByCategory, getOperatorsForTarget, isEffectOperator, isGuardOperator, isKnownOperator, validateOperatorArity } from '@almadar/operators';
5
5
  export { PATTERN_TYPES, PatternConfig, PatternType, isValidPatternType } from '@almadar/patterns';
@@ -198,17 +198,17 @@ declare const InteractionModelSchema: z.ZodObject<{
198
198
  bulkActions: z.ZodOptional<z.ZodBoolean>;
199
199
  realtime: z.ZodOptional<z.ZodBoolean>;
200
200
  }, "strip", z.ZodTypeAny, {
201
- createFlow: "modal" | "inline" | "page" | "none";
202
- editFlow: "modal" | "inline" | "page" | "none";
203
- viewFlow: "modal" | "drawer" | "inline" | "page" | "none";
201
+ createFlow: "modal" | "page" | "inline" | "none";
202
+ editFlow: "modal" | "page" | "inline" | "none";
203
+ viewFlow: "modal" | "drawer" | "page" | "inline" | "none";
204
204
  deleteFlow: "none" | "confirm" | "instant";
205
205
  listInteraction?: "click-to-view" | "click-to-edit" | "inline-edit" | undefined;
206
206
  bulkActions?: boolean | undefined;
207
207
  realtime?: boolean | undefined;
208
208
  }, {
209
- createFlow: "modal" | "inline" | "page" | "none";
210
- editFlow: "modal" | "inline" | "page" | "none";
211
- viewFlow: "modal" | "drawer" | "inline" | "page" | "none";
209
+ createFlow: "modal" | "page" | "inline" | "none";
210
+ editFlow: "modal" | "page" | "inline" | "none";
211
+ viewFlow: "modal" | "drawer" | "page" | "inline" | "none";
212
212
  deleteFlow: "none" | "confirm" | "instant";
213
213
  listInteraction?: "click-to-view" | "click-to-edit" | "inline-edit" | undefined;
214
214
  bulkActions?: boolean | undefined;