@almadar/core 2.9.0 → 2.12.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 { bD as SExpr } from '../schema-D96fyp1B.js';
2
+ export { A as AGENT_DOMAIN_CATEGORIES, e as ALLOWED_CUSTOM_COMPONENTS, f as AgentDomainCategory, g as AgentDomainCategorySchema, h as AgentEffect, i as AllowedCustomComponent, j as AnimationDef, k as AnimationDefInput, l as AnimationDefSchema, b as AppSchema, m as AssetMap, n as AssetMapInput, o as AssetMapSchema, p as AssetMapping, q as AssetMappingInput, r as AssetMappingSchema, s as AtomicEffect, C as CORE_BINDINGS, t as CallServiceConfig, u as ComputedEventContract, v as ComputedEventContractSchema, w as ComputedEventListener, x as ComputedEventListenerSchema, y as CoreBinding, z as CustomPatternDefinition, B as CustomPatternDefinitionInput, D as CustomPatternDefinitionSchema, F as CustomPatternMap, G as CustomPatternMapInput, H as CustomPatternMapSchema, I as DerefEffect, J as DesignPreferences, K as DesignPreferencesInput, L as DesignPreferencesSchema, M as DesignTokens, N as DesignTokensInput, Q as DesignTokensSchema, R as DomainCategory, U as DomainCategorySchema, V as DomainContext, W as DomainContextInput, X as DomainContextSchema, Y as DomainVocabulary, Z as DomainVocabularySchema, _ as ENTITY_ROLES, $ as Effect, a0 as EffectInput, a1 as EffectSchema, d as Entity, a2 as EntityData, E as EntityField, a3 as EntityFieldInput, a4 as EntityFieldSchema, a as EntityPersistence, a5 as EntityPersistenceSchema, a6 as EntityRef, a7 as EntityRefSchema, a8 as EntityRefStringSchema, a9 as EntityRole, aa as EntityRoleSchema, ab as EntityRow, ac as EntitySchema, ad as EntitySemanticRole, ae as EntitySemanticRoleSchema, af as EvalContext, ag as Event, ah as EventInput, ai as EventListener, aj as EventListenerSchema, ak as EventPayload, al as EventPayloadField, am as EventPayloadFieldSchema, an as EventSchema, ao as EventScope, ap as EventScopeSchema, aq as EventSemanticRole, ar as EventSemanticRoleSchema, as as EventSource, at as EventSourceSchema, au as Expression, av as ExpressionInput, aw as ExpressionSchema, ax as Field, ay as FieldFormat, az as FieldFormatSchema, aA as FieldSchema, aB as FieldType, aC as FieldTypeSchema, aD as FieldValue, aE as FullOrbitalUnit, aF as GAME_TYPES, aG as GameSubCategory, aH as GameSubCategorySchema, aI as GameType, aJ as GameTypeSchema, aK as Guard, aL as GuardInput, aM as GuardSchema, aN as LogMeta, aO as McpServiceDef, aP as McpServiceDefSchema, aQ as NodeClassification, aR as NodeClassificationSchema, aE as Orbital, aS as OrbitalConfig, aT as OrbitalConfigInput, aU as OrbitalConfigSchema, O as OrbitalDefinition, aV as OrbitalDefinitionSchema, aW as OrbitalEntity, aX as OrbitalEntityInput, aY as OrbitalEntitySchema, aZ as OrbitalInput, a_ as OrbitalPage, a$ as OrbitalPageInput, b0 as OrbitalPageSchema, b1 as OrbitalPageStrictInput, b2 as OrbitalPageStrictSchema, b as OrbitalSchema, b3 as OrbitalSchemaInput, b4 as OrbitalSchemaSchema, b5 as OrbitalTraitRef, b6 as OrbitalTraitRefSchema, b7 as OrbitalUnit, b8 as OrbitalUnitSchema, b9 as OrbitalZodSchema, P as Page, ba as PageRef, bb as PageRefObject, bc as PageRefObjectSchema, bd as PageRefSchema, be as PageRefStringSchema, bf as PageSchema, bg as PageTraitRef, bh as PageTraitRefSchema, bi as ParsedBinding, bj as PayloadField, bk as PayloadFieldSchema, bl as PresentationType, bm as RefEffect, bn as RelatedLink, bo as RelatedLinkSchema, bp as RelationConfig, bq as RelationConfigSchema, br as RenderUIConfig, bs as RenderUINode, bt as RequiredField, bu as RequiredFieldSchema, bv as ResolvedAsset, bw as ResolvedAssetInput, bx as ResolvedAssetSchema, by as RestAuthConfig, bz as RestAuthConfigSchema, bA as RestServiceDef, bB as RestServiceDefSchema, bC as SERVICE_TYPES, bE as SExprAtom, bF as SExprAtomSchema, bG as SExprInput, bH as SExprSchema, bI as SemanticAssetRef, bJ as SemanticAssetRefInput, bK as SemanticAssetRefSchema, bL as ServiceDefinition, bM as ServiceDefinitionSchema, bN as ServiceParams, bO as ServiceRef, bP as ServiceRefSchema, bQ as ServiceRefStringSchema, bR as ServiceType, bS as ServiceTypeSchema, bT as SocketEvents, bU as SocketEventsSchema, bV as SocketServiceDef, bW as SocketServiceDefSchema, S as State, bX as StateInput, bY as StateMachine, bZ as StateMachineInput, b_ as StateMachineSchema, b$ as StateSchema, c0 as StateSemanticRole, c1 as StateSemanticRoleSchema, c2 as SuggestedGuard, c3 as SuggestedGuardSchema, c4 as SwapEffect, c5 as ThemeDefinition, c6 as ThemeDefinitionSchema, c7 as ThemeRef, c8 as ThemeRefSchema, c9 as ThemeRefStringSchema, ca as ThemeTokens, cb as ThemeTokensSchema, cc as ThemeVariant, cd as ThemeVariantSchema, c as Trait, ce as TraitCategory, cf as TraitCategorySchema, cg as TraitDataEntity, ch as TraitDataEntitySchema, ci as TraitEntityField, cj as TraitEntityFieldSchema, T as TraitEventContract, ck as TraitEventContractSchema, cl as TraitEventListener, cm as TraitEventListenerSchema, cn as TraitInput, co as TraitRef, cp as TraitRefSchema, cq as TraitReference, cr as TraitReferenceInput, cs as TraitReferenceSchema, ct as TraitSchema, cu as TraitTick, cv as TraitTickSchema, cw as TraitUIBinding, cx as Transition, cy as TransitionInput, cz as TransitionSchema, cA as UISlot, cB as UISlotSchema, cC as UI_SLOTS, cD as UXHints, cE as UXHintsSchema, cF as UseDeclaration, cG as UseDeclarationSchema, cH as UserPersona, cI as UserPersonaInput, cJ as UserPersonaSchema, cK as VISUAL_STYLES, cL as ViewType, cM as ViewTypeSchema, cN as VisualStyle, cO as VisualStyleSchema, cP as WatchEffect, cQ as WatchOptions, cR as atomic, cS as callService, cT as collectBindings, cU as createAssetKey, cV as deref, cW as deriveCollection, cX as despawn, cY as doEffects, cZ as emit, c_ as findService, c$ as getArgs, d0 as getDefaultAnimationsForRole, d1 as getOperator, d2 as getServiceNames, d3 as getTraitConfig, d4 as getTraitName, d5 as hasService, d6 as isBinding, d7 as isCircuitEvent, d8 as isEffect, d9 as isEntityReference, da as isImportedTraitRef, db as isInlineTrait, dc as isMcpService, dd as isOrbitalDefinition, de as isPageReference, df as isPageReferenceObject, dg as isPageReferenceString, dh as isRestService, di as isRuntimeEntity, dj as isSExpr, dk as isSExprAtom, dl as isSExprCall, dm as isSExprEffect, dn as isServiceReference, dp as isSingletonEntity, dq as isSocketService, dr as isThemeReference, ds as isValidBinding, dt as navigate, du as normalizeTraitRef, dv as notify, dw as parseAssetKey, dx as parseBinding, dy as parseEntityRef, dz as parseImportedTraitRef, dA as parseOrbitalSchema, dB as parsePageRef, dC as parseServiceRef, dD as persist, dE as ref, dF as renderUI, dG as safeParseOrbitalSchema, dH as set, dI as sexpr, dJ as spawn, dK as swap, dL as validateAssetAnimations, dM as walkSExpr, dN as watch } from '../schema-D96fyp1B.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';
@@ -136,6 +136,113 @@ declare function validateBindingInContext(binding: {
136
136
  */
137
137
  declare function getBindingExamples(context: BindingContext): string[];
138
138
 
139
+ /**
140
+ * Agent Types
141
+ *
142
+ * Defines the AgentContext interface and related types for the agent/* operator namespace.
143
+ * These types are the contract between operators (language) and implementation (runtime).
144
+ *
145
+ * @packageDocumentation
146
+ */
147
+ /**
148
+ * Categories for agent memories.
149
+ */
150
+ type AgentMemoryCategory = 'preference' | 'correction' | 'pattern-affinity' | 'entity-template' | 'error-resolution';
151
+ /**
152
+ * A single memory record stored by the agent.
153
+ */
154
+ interface AgentMemoryRecord {
155
+ /** Unique memory identifier */
156
+ id: string;
157
+ /** Memory content (natural language) */
158
+ content: string;
159
+ /** Memory category */
160
+ category: AgentMemoryCategory;
161
+ /** Strength value (0.0-1.0), decays over time unless pinned */
162
+ strength: number;
163
+ /** Whether this memory is pinned (immune to decay) */
164
+ pinned: boolean;
165
+ /** Memory scope */
166
+ scope: 'global' | 'project';
167
+ /** ISO timestamp of last access */
168
+ lastAccessedAt: string;
169
+ /** ISO timestamp of creation */
170
+ createdAt: string;
171
+ }
172
+ /**
173
+ * Strategy for context compaction.
174
+ */
175
+ type AgentCompactStrategy = 'hybrid' | 'summarize' | 'truncate' | 'extract';
176
+ /**
177
+ * Result of a context compaction operation.
178
+ */
179
+ interface AgentCompactResult {
180
+ /** Token count before compaction */
181
+ before: number;
182
+ /** Token count after compaction */
183
+ after: number;
184
+ /** Strategy used */
185
+ strategy: AgentCompactStrategy;
186
+ /** Optional summary generated during compaction */
187
+ summary?: string;
188
+ }
189
+ /**
190
+ * Options for agent/generate calls.
191
+ */
192
+ interface AgentGenerateOptions {
193
+ /** LLM provider override */
194
+ provider?: string;
195
+ /** Model override */
196
+ model?: string;
197
+ /** Maximum tokens to generate */
198
+ maxTokens?: number;
199
+ }
200
+ /**
201
+ * Result from agent/search-code.
202
+ */
203
+ interface AgentCodeSearchResult {
204
+ /** Repository name (owner/repo) */
205
+ repo: string;
206
+ /** File path within the repository */
207
+ path: string;
208
+ /** URL to the file */
209
+ url: string;
210
+ }
211
+ /**
212
+ * AgentContext is the runtime contract for agent/* operators.
213
+ *
214
+ * The evaluator dispatches agent/* operators to methods on this interface.
215
+ * Pure methods (usable in guards) return synchronously.
216
+ * Effect methods return Promises.
217
+ *
218
+ * When ctx.agent is undefined, operators return safe defaults ([], 0, false, "").
219
+ * Implementations live in @almadar-io/agent-runtime (Phase 2B).
220
+ */
221
+ interface AgentContext {
222
+ recall(query: string, limit?: number): AgentMemoryRecord[];
223
+ memories(category?: AgentMemoryCategory): AgentMemoryRecord[];
224
+ memoryStrength(id: string): number;
225
+ isPinned(id: string): boolean;
226
+ memorize(content: string, category: AgentMemoryCategory, scope?: 'global' | 'project'): Promise<string>;
227
+ forget(id: string): Promise<void>;
228
+ pin(id: string): Promise<void>;
229
+ reinforce(id: string): Promise<void>;
230
+ decay(): Promise<number>;
231
+ provider(): string;
232
+ model(): string;
233
+ generate(prompt: string, options?: AgentGenerateOptions): Promise<string>;
234
+ switchProvider(provider: string, model?: string): void;
235
+ tools(): string[];
236
+ invoke(toolName: string, args: Record<string, unknown>): Promise<unknown>;
237
+ tokenCount(): number;
238
+ contextUsage(): number;
239
+ compact(strategy?: AgentCompactStrategy): Promise<AgentCompactResult>;
240
+ sessionId(): string;
241
+ fork(label?: string): Promise<string>;
242
+ label(text: string): void;
243
+ searchCode(query: string, language?: string): Promise<AgentCodeSearchResult[]>;
244
+ }
245
+
139
246
  /**
140
247
  * Interaction Model Types
141
248
  *
@@ -198,17 +305,17 @@ declare const InteractionModelSchema: z.ZodObject<{
198
305
  bulkActions: z.ZodOptional<z.ZodBoolean>;
199
306
  realtime: z.ZodOptional<z.ZodBoolean>;
200
307
  }, "strip", z.ZodTypeAny, {
201
- createFlow: "modal" | "inline" | "page" | "none";
202
- editFlow: "modal" | "inline" | "page" | "none";
203
- viewFlow: "modal" | "drawer" | "inline" | "page" | "none";
308
+ createFlow: "modal" | "page" | "inline" | "none";
309
+ editFlow: "modal" | "page" | "inline" | "none";
310
+ viewFlow: "modal" | "drawer" | "page" | "inline" | "none";
204
311
  deleteFlow: "none" | "confirm" | "instant";
205
312
  listInteraction?: "click-to-view" | "click-to-edit" | "inline-edit" | undefined;
206
313
  bulkActions?: boolean | undefined;
207
314
  realtime?: boolean | undefined;
208
315
  }, {
209
- createFlow: "modal" | "inline" | "page" | "none";
210
- editFlow: "modal" | "inline" | "page" | "none";
211
- viewFlow: "modal" | "drawer" | "inline" | "page" | "none";
316
+ createFlow: "modal" | "page" | "inline" | "none";
317
+ editFlow: "modal" | "page" | "inline" | "none";
318
+ viewFlow: "modal" | "drawer" | "page" | "inline" | "none";
212
319
  deleteFlow: "none" | "confirm" | "instant";
213
320
  listInteraction?: "click-to-view" | "click-to-edit" | "inline-edit" | undefined;
214
321
  bulkActions?: boolean | undefined;
@@ -795,7 +902,7 @@ interface ResolvedTrait {
795
902
  /** Where this trait came from */
796
903
  source: 'schema' | 'library' | 'inline';
797
904
  /** Category for organizing traits */
798
- category?: 'lifecycle' | 'temporal' | 'validation' | 'notification' | 'integration' | 'interaction' | 'game-core' | 'game-character' | 'game-ai' | 'game-combat' | 'game-items' | 'game-cards' | 'game-board' | 'game-puzzle';
905
+ category?: 'lifecycle' | 'temporal' | 'validation' | 'notification' | 'integration' | 'interaction' | 'agent' | 'game-core' | 'game-character' | 'game-ai' | 'game-combat' | 'game-items' | 'game-cards' | 'game-board' | 'game-puzzle';
799
906
  states: ResolvedTraitState[];
800
907
  events: ResolvedTraitEvent[];
801
908
  transitions: ResolvedTraitTransition[];
@@ -941,4 +1048,4 @@ declare function createResolvedField(field: {
941
1048
  */
942
1049
  declare function isResolvedIR(ir: unknown): ir is ResolvedIR;
943
1050
 
944
- export { type AppSummary, BINDING_CONTEXT_RULES, BINDING_DOCS, type BindingContext, BindingSchema, type CategorizedRemovals, type ChangeAuthor, type ChangeSetDocument, type ChangeSummary, type CreateFlow, DEFAULT_INTERACTION_MODELS, type DeleteFlow, type EditFlow, type GitHubLink, type HistoryMeta, type InteractionModel, type InteractionModelInput, InteractionModelSchema, type LazyService, type ListInteraction, type OperatorName, type PageContentReduction, PatternTypeSchema, type PersistActionName, type ResolvedEntity, type ResolvedEntityBinding, type ResolvedField, type ResolvedIR, type ResolvedNavigation, type ResolvedPage, type ResolvedPattern, type ResolvedSection, type ResolvedSectionEvent, type ResolvedTrait, type ResolvedTraitBinding, type ResolvedTraitDataEntity, type ResolvedTraitEvent, type ResolvedTraitGuard, type ResolvedTraitListener, type ResolvedTraitState, type ResolvedTraitTick, type ResolvedTraitTransition, type ResolvedTraitUIBinding, SExpr, type SaveOptions, type SaveResult, type SchemaChange, type ServiceAction, type ServiceActionName, type ServiceContract, type ServiceEvents, type SnapshotDocument, type StatsView, type StoreContract, type StoreFilter, type StoreFilterOp, type TransitionFrom, type ValidationDocument, type ValidationIssue, type ValidationMeta, type ValidationResults, type ViewFlow, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, getAllOperators, getAllPatternTypes, getBindingExamples, getInteractionModelForDomain, inferTsType, isResolvedIR, validateBindingInContext };
1051
+ export { type AgentCodeSearchResult, type AgentCompactResult, type AgentCompactStrategy, type AgentContext, type AgentGenerateOptions, type AgentMemoryCategory, type AgentMemoryRecord, type AppSummary, BINDING_CONTEXT_RULES, BINDING_DOCS, type BindingContext, BindingSchema, type CategorizedRemovals, type ChangeAuthor, type ChangeSetDocument, type ChangeSummary, type CreateFlow, DEFAULT_INTERACTION_MODELS, type DeleteFlow, type EditFlow, type GitHubLink, type HistoryMeta, type InteractionModel, type InteractionModelInput, InteractionModelSchema, type LazyService, type ListInteraction, type OperatorName, type PageContentReduction, PatternTypeSchema, type PersistActionName, type ResolvedEntity, type ResolvedEntityBinding, type ResolvedField, type ResolvedIR, type ResolvedNavigation, type ResolvedPage, type ResolvedPattern, type ResolvedSection, type ResolvedSectionEvent, type ResolvedTrait, type ResolvedTraitBinding, type ResolvedTraitDataEntity, type ResolvedTraitEvent, type ResolvedTraitGuard, type ResolvedTraitListener, type ResolvedTraitState, type ResolvedTraitTick, type ResolvedTraitTransition, type ResolvedTraitUIBinding, SExpr, type SaveOptions, type SaveResult, type SchemaChange, type ServiceAction, type ServiceActionName, type ServiceContract, type ServiceEvents, type SnapshotDocument, type StatsView, type StoreContract, type StoreFilter, type StoreFilterOp, type TransitionFrom, type ValidationDocument, type ValidationIssue, type ValidationMeta, type ValidationResults, type ViewFlow, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, getAllOperators, getAllPatternTypes, getBindingExamples, getInteractionModelForDomain, inferTsType, isResolvedIR, validateBindingInContext };
@@ -174,7 +174,8 @@ var EntityPersistenceSchema = z.enum([
174
174
  "persistent",
175
175
  "runtime",
176
176
  "singleton",
177
- "instance"
177
+ "instance",
178
+ "local"
178
179
  ]);
179
180
  var OrbitalEntitySchema = z.object({
180
181
  name: z.string().min(1, "Entity name is required"),
@@ -463,6 +464,7 @@ var TraitCategorySchema = z.enum([
463
464
  "notification",
464
465
  "integration",
465
466
  "interaction",
467
+ "agent",
466
468
  "game-core",
467
469
  "game-character",
468
470
  "game-ai",