@llui/mcp 0.0.24 → 0.0.27

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.
@@ -1 +1 @@
1
- {"version":3,"file":"debug-api.js","sourceRoot":"","sources":["../../src/tools/debug-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAsB;IAC1D,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,wFAAwF;QAC1F,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,mCAAmC;iBACjD;aACF;SACF;KACF,EACD,WAAW,EACX,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAM,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,CACtD,CAAA;IAED,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,iIAAiI;QACnI,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,mDAAmD;iBACjE;aACF;YACD,QAAQ,EAAE,CAAC,KAAK,CAAC;SAClB;KACF,EACD,WAAW,EACX,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAClB,MAAM,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,KAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,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AC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;oBAAE,OAAO,KAAK,CAAA;YAC5C,CAAC;YACD,IAAI,CAAC,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC/B,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,CAA8B,EAAE,IAAI,KAAK,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;oBACnF,OAAO,KAAK,CAAA;gBACd,CAAC;YACH,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;IACJ,CAAC,CACF,CAAA;IAED,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,8VAA8V;QAChW,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;YACxC,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF,EACD,WAAW,EACX,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAM,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAChE,CAAA;AACH,CAAC","sourcesContent":["import { existsSync } from 'node:fs'\nimport type { ToolRegistry } from '../tool-registry.js'\nimport { generateReplayTest } from './replay-test-generator.js'\nimport { domDiff, diffState } from '../util/diff.js'\n\n/**\n * Register the 23 debug-API-backed tools. Every handler here routes through\n * `ctx.relay!.call(method, args)` — which transparently dispatches to either\n * an in-process `LluiDebugAPI` or the WebSocket bridge, depending on how the\n * transport was wired.\n */\nexport function registerDebugApiTools(registry: ToolRegistry): void {\n registry.register(\n {\n name: 'llui_get_state',\n description:\n 'Get the current state of the LLui component. Returns a JSON-serializable state object.',\n inputSchema: {\n type: 'object',\n properties: {\n component: {\n type: 'string',\n description: 'Component name (defaults to root)',\n },\n },\n },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getState', []),\n )\n\n registry.register(\n {\n name: 'llui_send_message',\n description:\n 'Send a message to the component and return the new state and effects. Validates the message first. Calls flush() automatically.',\n inputSchema: {\n type: 'object',\n properties: {\n msg: {\n type: 'object',\n description: 'The message to send (must be a valid Msg variant)',\n },\n },\n required: ['msg'],\n },\n },\n 'debug-api',\n async (args, ctx) => {\n const errors = (await ctx.relay!.call('validateMessage', [args.msg])) as unknown[] | null\n if (errors) return { errors, sent: false }\n await ctx.relay!.call('send', [args.msg])\n await ctx.relay!.call('flush', [])\n return { state: await ctx.relay!.call('getState', []), sent: true }\n },\n )\n\n registry.register(\n {\n name: 'llui_eval_update',\n description:\n 'Dry-run: call update(state, msg) without applying. Returns what the new state and effects would be without modifying the running app.',\n inputSchema: {\n type: 'object',\n properties: {\n msg: {\n type: 'object',\n description: 'The hypothetical message to evaluate',\n },\n },\n required: ['msg'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('evalUpdate', [args.msg]),\n )\n\n registry.register(\n {\n name: 'llui_validate_message',\n description:\n 'Validate a message against the component Msg type. Returns errors or null if valid.',\n inputSchema: {\n type: 'object',\n properties: {\n msg: {\n type: 'object',\n description: 'The message to validate',\n },\n },\n required: ['msg'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('validateMessage', [args.msg]),\n )\n\n registry.register(\n {\n name: 'llui_get_message_history',\n description:\n 'Get the chronological message history with state transitions, effects, and dirty masks. Supports pagination via `since` (exclusive, return entries with index > since) and `limit` (return at most N most-recent entries). Use both together for tail-fetching.',\n inputSchema: {\n type: 'object',\n properties: {\n since: {\n type: 'number',\n description: 'Return entries with index strictly greater than this.',\n },\n limit: {\n type: 'number',\n description: 'Max entries to return (the N most recent).',\n },\n },\n },\n },\n 'debug-api',\n async (args, ctx) => {\n const opts: { since?: number; limit?: number } = {}\n if (typeof args.since === 'number') opts.since = args.since\n if (typeof args.limit === 'number') opts.limit = args.limit\n return ctx.relay!.call('getMessageHistory', [opts])\n },\n )\n\n registry.register(\n {\n name: 'llui_export_trace',\n description: 'Export the current session as a replayable LluiTrace JSON.',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('exportTrace', []),\n )\n\n registry.register(\n {\n name: 'llui_get_bindings',\n description:\n 'Get all active reactive bindings with their masks, last values, and DOM targets.',\n inputSchema: {\n type: 'object',\n properties: {\n filter: {\n type: 'string',\n description: 'Filter by DOM selector or mask value',\n },\n },\n },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getBindings', []),\n )\n\n registry.register(\n {\n name: 'llui_why_did_update',\n description:\n 'Explain why a specific binding re-evaluated: which mask bits were dirty, what the accessor returned, what the previous value was.',\n inputSchema: {\n type: 'object',\n properties: {\n bindingIndex: {\n type: 'number',\n description: 'The binding index to inspect',\n },\n },\n required: ['bindingIndex'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('whyDidUpdate', [args.bindingIndex as number]),\n )\n\n registry.register(\n {\n name: 'llui_search_state',\n description:\n 'Search current state using a dot-separated path query. E.g., \"cart.items\" returns the items array.',\n inputSchema: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n description: 'Dot-separated path to search. E.g., \"user.name\", \"items\"',\n },\n },\n required: ['query'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('searchState', [args.query as string]),\n )\n\n registry.register(\n {\n name: 'llui_clear_log',\n description: 'Clear the message and effects history.',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n },\n 'debug-api',\n async (_args, ctx) => {\n await ctx.relay!.call('clearLog', [])\n return { cleared: true }\n },\n )\n\n registry.register(\n {\n name: 'llui_list_messages',\n description:\n 'List all message variants the component accepts, with their field types. Returns { discriminant, variants: { [name]: { [field]: typeDescriptor } } }. Use this to discover what messages can be sent without reading source code.',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getMessageSchema', []),\n )\n\n registry.register(\n {\n name: 'llui_decode_mask',\n description:\n \"Decode a dirty-mask value from llui_get_message_history (the 'dirtyMask' field) into the list of top-level state fields that changed. Requires 'mask' param.\",\n inputSchema: {\n type: 'object',\n properties: {\n mask: { type: 'number', description: 'The dirtyMask value to decode' },\n },\n required: ['mask'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('decodeMask', [args.mask as number]),\n )\n\n registry.register(\n {\n name: 'llui_mask_legend',\n description:\n 'Return the compiler-generated bit→field map for this component. Example: { todos: 1, filter: 2, nextId: 4 } means bit 0 represents `todos`, etc.',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getMaskLegend', []),\n )\n\n registry.register(\n {\n name: 'llui_component_info',\n description:\n 'Get component name and source location (file + line) of the component() declaration. Lets you find where to read or edit the component.',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getComponentInfo', []),\n )\n\n registry.register(\n {\n name: 'llui_describe_state',\n description:\n \"Return the State type's shape (not its value). Fields map to type descriptors: 'string', 'number', 'boolean', {kind:'enum',values:[...]}, {kind:'array',of:...}, {kind:'object',fields:...}, {kind:'optional',of:...}. Use this to know what fields exist and their types even when currently undefined.\",\n inputSchema: {\n type: 'object',\n properties: {},\n },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getStateSchema', []),\n )\n\n registry.register(\n {\n name: 'llui_list_effects',\n description:\n 'List all effect variants the component emits, with their field types (same format as llui_list_messages). Returns null if no Effect type is declared.',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getEffectSchema', []),\n )\n\n registry.register(\n {\n name: 'llui_trace_element',\n description:\n \"Find all bindings targeting a DOM element matched by a CSS selector. Returns { bindingIndex, kind, key, mask, lastValue, relation }[] so you can answer 'why is this element wrong?' — combine with llui_why_did_update(bindingIndex) for a full narrative.\",\n inputSchema: {\n type: 'object',\n properties: {\n selector: {\n type: 'string',\n description: 'CSS selector (e.g. `.todo.active`, `#submit`)',\n },\n },\n required: ['selector'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('getBindingsFor', [args.selector as string]),\n )\n\n registry.register(\n {\n name: 'llui_snapshot_state',\n description:\n 'Capture the current state (deep clone). Returns the snapshot — store it, then call llui_restore_state later to roll back. Useful for safely exploring transitions during a debugging session.',\n inputSchema: { type: 'object', properties: {} },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('snapshotState', []),\n )\n\n registry.register(\n {\n name: 'llui_restore_state',\n description:\n 'Overwrite the current state with a previously-captured snapshot. Triggers a full re-render (FULL_MASK). Bypasses update() — snap must already be a valid state value.',\n inputSchema: {\n type: 'object',\n properties: {\n snapshot: {\n description: 'The state object returned by llui_snapshot_state.',\n },\n },\n required: ['snapshot'],\n },\n },\n 'debug-api',\n async (args, ctx) => {\n await ctx.relay!.call('restoreState', [args.snapshot])\n return { restored: true, state: await ctx.relay!.call('getState', []) }\n },\n )\n\n registry.register(\n {\n name: 'llui_list_components',\n description:\n 'List all currently-mounted LLui components + which one is active (being targeted by subsequent tool calls). Multi-mount apps show one entry per mount.',\n inputSchema: { type: 'object', properties: {} },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('__listComponents', []),\n )\n\n registry.register(\n {\n name: 'llui_select_component',\n description:\n 'Switch the active component (the one all other tool calls target). Use a key from llui_list_components.',\n inputSchema: {\n type: 'object',\n properties: {\n key: {\n type: 'string',\n description: 'Component key as returned by llui_list_components',\n },\n },\n required: ['key'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('__selectComponent', [args.key]),\n )\n\n registry.register(\n {\n name: 'llui_replay_trace',\n description:\n 'Generate a ready-to-run vitest file that replays the current message history via `replayTrace()` from @llui/test. The output is a complete test file with the trace inlined — paste it into packages/<pkg>/test/ to reproduce the exact sequence of messages the component saw in this session. Use this to capture a debugging session as a regression test.',\n inputSchema: {\n type: 'object',\n properties: {\n importPath: {\n type: 'string',\n description:\n \"Where to import the component def from in the generated test (default: '../src/index'). Example: '../src/todo-app'.\",\n },\n exportName: {\n type: 'string',\n description:\n \"Named export that holds the component def (default: the component's name).\",\n },\n },\n },\n },\n 'debug-api',\n async (args, ctx) => {\n const trace = (await ctx.relay!.call('exportTrace', [])) as {\n component: string\n entries: Array<{ msg: unknown; expectedState: unknown; expectedEffects: unknown[] }>\n }\n const importPath = (args.importPath as string | undefined) ?? '../src/index'\n const exportName = (args.exportName as string | undefined) ?? trace.component\n return {\n filename: `${trace.component.toLowerCase()}-replay.test.ts`,\n code: generateReplayTest(trace, importPath, exportName),\n entryCount: trace.entries.length,\n }\n },\n )\n\n registry.register(\n {\n name: 'llui_inspect_element',\n description:\n 'Get a rich report for a DOM element: tag, attributes, classes, data-*, text, bounding box, a computed-style subset (display/visibility/position/dimensions), and the bindings targeting this node. Pass a CSS selector. Returns null if no element matches.',\n inputSchema: {\n type: 'object',\n properties: { selector: { type: 'string', description: 'CSS selector' } },\n required: ['selector'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('inspectElement', [args.selector as string]),\n )\n\n registry.register(\n {\n name: 'llui_get_rendered_html',\n description:\n \"Get the outerHTML of the mounted component or a specific element. Pass 'selector' for a specific node (defaults to the mount root). Pass 'maxLength' to truncate output.\",\n inputSchema: {\n type: 'object',\n properties: {\n selector: { type: 'string' },\n maxLength: { type: 'number' },\n },\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('getRenderedHtml', [args.selector, args.maxLength]),\n )\n\n registry.register(\n {\n name: 'llui_dispatch_event',\n description:\n \"Synthesize and dispatch a browser event at a DOM element. Returns the history indices of any Msgs the handler produced plus the resulting state. 'type' is the event name (e.g. 'click', 'input', 'keydown'). 'init' is an EventInit object (e.g. { key: 'Enter' } for keydown).\",\n inputSchema: {\n type: 'object',\n properties: {\n selector: { type: 'string' },\n type: { type: 'string' },\n init: { type: 'object' },\n },\n required: ['selector', 'type'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('dispatchDomEvent', [args.selector, args.type, args.init]),\n )\n\n registry.register(\n {\n name: 'llui_dom_diff',\n description:\n 'Compare expected HTML against the currently rendered HTML (from selector, or the mount root). Returns { match, differences }. Pass ignoreWhitespace=true to normalize whitespace.',\n inputSchema: {\n type: 'object',\n properties: {\n expected: { type: 'string' },\n selector: { type: 'string' },\n ignoreWhitespace: { type: 'boolean' },\n },\n required: ['expected'],\n },\n },\n 'debug-api',\n async (args, ctx) => {\n const actual = (await ctx.relay!.call('getRenderedHtml', [args.selector])) as string\n return domDiff(String(args.expected), actual, {\n ignoreWhitespace: Boolean(args.ignoreWhitespace),\n })\n },\n )\n\n registry.register(\n {\n name: 'llui_get_focus',\n description:\n 'Return info about the currently focused element: { selector (if it has an id), tagName, selectionStart, selectionEnd }. Useful for catching \"focus lost on re-render\" bugs.',\n inputSchema: { type: 'object', properties: {} },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getFocus', []),\n )\n\n registry.register(\n {\n name: 'llui_lint',\n description:\n \"Lint LLui source code against ESLint LLui rules. Returns violations grouped by rule. Pass 'path' (absolute file path on the dev machine).\",\n inputSchema: {\n type: 'object',\n properties: {\n path: {\n type: 'string',\n description: 'Absolute file path to read and lint.',\n },\n },\n required: ['path'],\n },\n },\n 'debug-api',\n async (args, _ctx) => {\n const pathArg = args.path as string\n\n if (!pathArg.endsWith('.ts') && !pathArg.endsWith('.tsx')) {\n throw new Error(`llui_lint: only .ts/.tsx files are supported, got: ${pathArg}`)\n }\n if (!existsSync(pathArg)) {\n throw new Error(`llui_lint: file not found: ${pathArg}`)\n }\n\n const { execSync } = await import('node:child_process')\n try {\n const output = execSync(`pnpm exec eslint --format json \"${pathArg}\"`, { encoding: 'utf8' })\n const results = JSON.parse(output)\n const violations = results[0]?.messages || []\n return {\n file: pathArg,\n score: Math.max(0, 20 - violations.length),\n violations,\n summary: `${violations.length} violation(s)`,\n }\n } catch (err: unknown) {\n const e = err as { stdout?: string; message?: string }\n if (e.stdout) {\n try {\n const results = JSON.parse(e.stdout)\n const violations = results[0]?.messages || []\n return {\n file: pathArg,\n score: Math.max(0, 20 - violations.length),\n violations,\n summary: `${violations.length} violation(s)`,\n }\n } catch {\n // fall through to throw below\n }\n }\n throw new Error(`ESLint failed: ${e.message}`, { cause: err })\n }\n },\n )\n\n registry.register(\n {\n name: 'llui_force_rerender',\n description:\n \"Re-evaluate every binding's accessor against the current state, apply changed values to the DOM, and return the indices of bindings that changed. If a binding's DOM value corrects itself after this call but not after a real message, the mask for that binding is wrong.\",\n inputSchema: { type: 'object', properties: {} },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('forceRerender', []),\n )\n\n registry.register(\n {\n name: 'llui_each_diff',\n description:\n \"Per-each-site reconciliation diffs (added/removed/moved/reused keys) from the dev-time diff log. Pass 'sinceIndex' to filter to entries after a specific message history index.\",\n inputSchema: {\n type: 'object',\n properties: { sinceIndex: { type: 'number' } },\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('getEachDiff', [args.sinceIndex]),\n )\n\n registry.register(\n {\n name: 'llui_scope_tree',\n description:\n \"Walk the scope tree starting at the component root (or a specific scopeId). Returns a LifetimeNode tree with kind (root/show/each/branch/child/portal/foreign) and children. Pass 'depth' to limit traversal, 'scopeId' to start elsewhere.\",\n inputSchema: {\n type: 'object',\n properties: {\n depth: { type: 'number' },\n scopeId: { type: 'string' },\n },\n },\n },\n 'debug-api',\n async (args, ctx) =>\n ctx.relay!.call('getScopeTree', [{ depth: args.depth, scopeId: args.scopeId }]),\n )\n\n registry.register(\n {\n name: 'llui_disposer_log',\n description:\n \"Recent onDispose firings with scope id and cause. Pass 'limit' to cap results to the N most recent entries. Catches 'leak on branch swap' class bugs.\",\n inputSchema: {\n type: 'object',\n properties: { limit: { type: 'number' } },\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('getDisposerLog', [args.limit]),\n )\n\n registry.register(\n {\n name: 'llui_list_dead_bindings',\n description:\n \"Bindings that are inactive (scope disposed) OR never matched a dirty mask OR never changed value. Useful for finding wasted work and 'this never updates' bugs. Returns the subset of get_bindings with an annotation on why it's flagged.\",\n inputSchema: { type: 'object', properties: {} },\n },\n 'debug-api',\n async (_args, ctx) => {\n const bindings = (await ctx.relay!.call('getBindings', [])) as Array<{\n index: number\n mask: number\n lastValue: unknown\n kind: string\n key: string | undefined\n dead: boolean\n perItem: boolean\n }>\n return bindings\n .filter((b) => b.dead || b.lastValue === undefined)\n .map((b) => ({\n ...b,\n reason: b.dead ? 'scope_disposed' : 'never_changed',\n }))\n },\n )\n\n registry.register(\n {\n name: 'llui_binding_graph',\n description:\n 'Edge list: state path → binding indices that depend on it. Inverts the compiler-emitted mask legend to show, for each top-level state field, which bindings will re-evaluate when it changes.',\n inputSchema: { type: 'object', properties: {} },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getBindingGraph', []),\n )\n\n registry.register(\n {\n name: 'llui_mock_effect',\n description:\n \"Register a mock for an effect matching 'match' ({ type?, payloadPath?, payloadEquals? }). The next matching effect resolves with 'response' instead of running. Mocks are one-shot; pass { persist: true } to keep across matches. Returns { mockId } for later reference.\",\n inputSchema: {\n type: 'object',\n properties: {\n match: { type: 'object' },\n response: {},\n opts: { type: 'object' },\n },\n required: ['match', 'response'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('mockEffect', [args.match, args.response, args.opts]),\n )\n\n registry.register(\n {\n name: 'llui_resolve_effect',\n description:\n \"Manually resolve a pending effect with a given response. The effect's onSuccess callback (if any) runs as if it had actually resolved. Pass effectId from llui_pending_effects.\",\n inputSchema: {\n type: 'object',\n properties: {\n effectId: { type: 'string' },\n response: {},\n },\n required: ['effectId', 'response'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('resolveEffect', [args.effectId, args.response]),\n )\n\n registry.register(\n {\n name: 'llui_pending_effects',\n description:\n \"Current queued and in-flight effects. Each entry has { id, type, dispatchedAt, status, payload }. Use 'id' with llui_resolve_effect to manually resolve one.\",\n inputSchema: { type: 'object', properties: {} },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getPendingEffects', []),\n )\n\n registry.register(\n {\n name: 'llui_effect_timeline',\n description:\n \"Phased log of effect events: dispatched -> in-flight -> resolved/cancelled/resolved-mocked. Each entry has { effectId, type, phase, timestamp, durationMs? }. Pass 'limit' to cap the tail.\",\n inputSchema: {\n type: 'object',\n properties: { limit: { type: 'number' } },\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('getEffectTimeline', [args.limit]),\n )\n\n registry.register(\n {\n name: 'llui_step_back',\n description:\n \"Rewind state by replaying from init() with the last N messages excluded. 'mode' is 'pure' (default; suppresses effects) or 'live' (re-fires effects from replay). Returns the new state and rewindDepth.\",\n inputSchema: {\n type: 'object',\n properties: {\n n: { type: 'number' },\n mode: { type: 'string', enum: ['pure', 'live'] },\n },\n },\n },\n 'debug-api',\n async (args, ctx) => {\n const n = typeof args.n === 'number' ? args.n : 1\n const mode = args.mode === 'live' ? 'live' : 'pure'\n return ctx.relay!.call('stepBack', [n, mode])\n },\n )\n\n registry.register(\n {\n name: 'llui_coverage',\n description:\n \"Per-Msg-variant coverage for the current session: { fired: { variant: { count, lastIndex } }, neverFired: [variants] }. Shows which message types have run and which haven't — useful for finding untested paths.\",\n inputSchema: { type: 'object', properties: {} },\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getCoverage', []),\n )\n\n registry.register(\n {\n name: 'llui_diff_state',\n description:\n \"Structured JSON diff between two state values. Pass 'a' and 'b' — plain objects. Returns { added, removed, changed }.\",\n inputSchema: {\n type: 'object',\n properties: {\n a: {},\n b: {},\n },\n required: ['a', 'b'],\n },\n },\n 'debug-api',\n async (args) => diffState(args.a, args.b),\n )\n\n registry.register(\n {\n name: 'llui_assert',\n description:\n \"Evaluate a predicate against current state. Pass 'path' (dot-separated), 'op' (eq/neq/exists/gt/lt/in), and 'value'. Returns { pass, actual, expected, op }.\",\n inputSchema: {\n type: 'object',\n properties: {\n path: { type: 'string' },\n op: { type: 'string', enum: ['eq', 'neq', 'exists', 'gt', 'lt', 'in'] },\n value: {},\n },\n required: ['path', 'op'],\n },\n },\n 'debug-api',\n async (args, ctx) => {\n const actual = await ctx.relay!.call('searchState', [args.path])\n const op = args.op as string\n const expected = args.value\n let pass = false\n switch (op) {\n case 'eq':\n pass = Object.is(actual, expected)\n break\n case 'neq':\n pass = !Object.is(actual, expected)\n break\n case 'exists':\n pass = actual !== undefined\n break\n case 'gt':\n pass = typeof actual === 'number' && typeof expected === 'number' && actual > expected\n break\n case 'lt':\n pass = typeof actual === 'number' && typeof expected === 'number' && actual < expected\n break\n case 'in':\n pass = Array.isArray(expected) && expected.includes(actual)\n break\n }\n return { pass, actual, expected, op }\n },\n )\n\n registry.register(\n {\n name: 'llui_search_history',\n description:\n \"Filtered message history. Pass 'filter' with { type?, statePath?, effectType?, fromIndex?, toIndex? }. Entries match if all present fields match — type is the Msg discriminant, statePath is a dot path whose value differs pre->post, effectType is a type present in the effects array.\",\n inputSchema: {\n type: 'object',\n properties: {\n filter: {\n type: 'object',\n properties: {\n type: { type: 'string' },\n statePath: { type: 'string' },\n effectType: { type: 'string' },\n fromIndex: { type: 'number' },\n toIndex: { type: 'number' },\n },\n },\n },\n required: ['filter'],\n },\n },\n 'debug-api',\n async (args, ctx) => {\n type HRecord = {\n index: number\n timestamp: number\n msg: unknown\n stateBefore: unknown\n stateAfter: unknown\n effects: unknown[]\n dirtyMask: number\n }\n const history = (await ctx.relay!.call('getMessageHistory', [{}])) as HRecord[]\n const f = (args.filter ?? {}) as {\n type?: string\n statePath?: string\n effectType?: string\n fromIndex?: number\n toIndex?: number\n }\n function pathValue(obj: unknown, path: string): unknown {\n const parts = path.split('.')\n let v: unknown = obj\n for (const p of parts) {\n if (v == null || typeof v !== 'object') return undefined\n v = (v as Record<string, unknown>)[p]\n }\n return v\n }\n return history.filter((r) => {\n if (f.fromIndex !== undefined && r.index < f.fromIndex) return false\n if (f.toIndex !== undefined && r.index > f.toIndex) return false\n if (f.type !== undefined) {\n const t = (r.msg as { type?: string } | null)?.type\n if (t !== f.type) return false\n }\n if (f.statePath !== undefined) {\n const before = pathValue(r.stateBefore, f.statePath)\n const after = pathValue(r.stateAfter, f.statePath)\n if (Object.is(before, after)) return false\n }\n if (f.effectType !== undefined) {\n if (!r.effects.some((e) => (e as { type?: string } | null)?.type === f.effectType)) {\n return false\n }\n }\n return true\n })\n },\n )\n\n registry.register(\n {\n name: 'llui_eval',\n description:\n \"Arbitrary JavaScript in the page context via the debug relay. Returns { result, sideEffects }. 'result' is the expression's return value or { error }. 'sideEffects' makes any state changes, new history entries, new pending effects, and dirty bindings visible. Phase 1 does not support async expressions; expose async results via globalThis instead.\",\n inputSchema: {\n type: 'object',\n properties: { code: { type: 'string' } },\n required: ['code'],\n },\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('evalInPage', [args.code]),\n )\n}\n"]}
1
+ {"version":3,"file":"debug-api.js","sourceRoot":"","sources":["../../src/tools/debug-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAsB;IAC1D,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,wFAAwF;QAC1F,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;YACf,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QA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AI,KAAK,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;oBACnF,OAAO,KAAK,CAAA;gBACd,CAAC;YACH,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;IACJ,CAAC,CACF,CAAA;IAED,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,8VAA8V;QAChW,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;KACvC,EACD,WAAW,EACX,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAM,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAChE,CAAA;AACH,CAAC","sourcesContent":["import { existsSync } from 'node:fs'\nimport { z } from 'zod'\nimport type { ToolRegistry } from '../tool-registry.js'\nimport { generateReplayTest } from './replay-test-generator.js'\nimport { domDiff, diffState } from '../util/diff.js'\n\n/**\n * Register the 33 debug-API-backed tools. Every handler routes through\n * `ctx.relay!.call(method, args)` — which transparently dispatches to\n * either an in-process `LluiDebugAPI` or the WebSocket bridge,\n * depending on how the transport was wired.\n *\n * Zod schemas drive both runtime input validation (the registry's\n * `dispatch()` calls `schema.safeParse()` before invoking the handler)\n * and the JSON Schema published in `tools/list` (derived once at\n * registration time). Handlers receive parsed/typed arguments.\n */\nexport function registerDebugApiTools(registry: ToolRegistry): void {\n registry.register(\n {\n name: 'llui_get_state',\n description:\n 'Get the current state of the LLui component. Returns a JSON-serializable state object.',\n schema: z.object({\n component: z.string().optional().describe('Component name (defaults to root)'),\n }),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getState', []),\n )\n\n registry.register(\n {\n name: 'llui_send_message',\n description:\n 'Send a message to the component and return the new state and effects. Validates the message first. Calls flush() automatically.',\n schema: z.object({\n msg: z\n .object({})\n .passthrough()\n .describe('The message to send (must be a valid Msg variant)'),\n }),\n },\n 'debug-api',\n async (args, ctx) => {\n const errors = (await ctx.relay!.call('validateMessage', [args.msg])) as unknown[] | null\n if (errors) return { errors, sent: false }\n await ctx.relay!.call('send', [args.msg])\n await ctx.relay!.call('flush', [])\n return { state: await ctx.relay!.call('getState', []), sent: true }\n },\n )\n\n registry.register(\n {\n name: 'llui_eval_update',\n description:\n 'Dry-run: call update(state, msg) without applying. Returns what the new state and effects would be without modifying the running app.',\n schema: z.object({\n msg: z.object({}).passthrough().describe('The hypothetical message to evaluate'),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('evalUpdate', [args.msg]),\n )\n\n registry.register(\n {\n name: 'llui_validate_message',\n description:\n 'Validate a message against the component Msg type. Returns errors or null if valid.',\n schema: z.object({\n msg: z.object({}).passthrough().describe('The message to validate'),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('validateMessage', [args.msg]),\n )\n\n registry.register(\n {\n name: 'llui_get_message_history',\n description:\n 'Get the chronological message history with state transitions, effects, and dirty masks. Supports pagination via `since` (exclusive, return entries with index > since) and `limit` (return at most N most-recent entries). Use both together for tail-fetching.',\n schema: z.object({\n since: z\n .number()\n .optional()\n .describe('Return entries with index strictly greater than this.'),\n limit: z.number().optional().describe('Max entries to return (the N most recent).'),\n }),\n },\n 'debug-api',\n async (args, ctx) => {\n const opts: { since?: number; limit?: number } = {}\n if (typeof args.since === 'number') opts.since = args.since\n if (typeof args.limit === 'number') opts.limit = args.limit\n return ctx.relay!.call('getMessageHistory', [opts])\n },\n )\n\n registry.register(\n {\n name: 'llui_export_trace',\n description: 'Export the current session as a replayable LluiTrace JSON.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('exportTrace', []),\n )\n\n registry.register(\n {\n name: 'llui_get_bindings',\n description:\n 'Get all active reactive bindings with their masks, last values, and DOM targets.',\n schema: z.object({\n filter: z.string().optional().describe('Filter by DOM selector or mask value'),\n }),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getBindings', []),\n )\n\n registry.register(\n {\n name: 'llui_why_did_update',\n description:\n 'Explain why a specific binding re-evaluated: which mask bits were dirty, what the accessor returned, what the previous value was.',\n schema: z.object({\n bindingIndex: z.number().describe('The binding index to inspect'),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('whyDidUpdate', [args.bindingIndex]),\n )\n\n registry.register(\n {\n name: 'llui_search_state',\n description:\n 'Search current state using a dot-separated path query. E.g., \"cart.items\" returns the items array.',\n schema: z.object({\n query: z.string().describe('Dot-separated path to search. E.g., \"user.name\", \"items\"'),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('searchState', [args.query]),\n )\n\n registry.register(\n {\n name: 'llui_clear_log',\n description: 'Clear the message and effects history.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => {\n await ctx.relay!.call('clearLog', [])\n return { cleared: true }\n },\n )\n\n registry.register(\n {\n name: 'llui_list_messages',\n description:\n 'List all message variants the component accepts, with their field types. Returns { discriminant, variants: { [name]: { [field]: typeDescriptor } } }. Use this to discover what messages can be sent without reading source code.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getMessageSchema', []),\n )\n\n registry.register(\n {\n name: 'llui_decode_mask',\n description:\n \"Decode a dirty-mask value from llui_get_message_history (the 'dirtyMask' field) into the list of top-level state fields that changed. Requires 'mask' param.\",\n schema: z.object({\n mask: z.number().describe('The dirtyMask value to decode'),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('decodeMask', [args.mask]),\n )\n\n registry.register(\n {\n name: 'llui_mask_legend',\n description:\n 'Return the compiler-generated bit→field map for this component. Example: { todos: 1, filter: 2, nextId: 4 } means bit 0 represents `todos`, etc.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getMaskLegend', []),\n )\n\n registry.register(\n {\n name: 'llui_component_info',\n description:\n 'Get component name and source location (file + line) of the component() declaration. Lets you find where to read or edit the component.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getComponentInfo', []),\n )\n\n registry.register(\n {\n name: 'llui_describe_state',\n description:\n \"Return the State type's shape (not its value). Fields map to type descriptors: 'string', 'number', 'boolean', {kind:'enum',values:[...]}, {kind:'array',of:...}, {kind:'object',fields:...}, {kind:'optional',of:...}. Use this to know what fields exist and their types even when currently undefined.\",\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getStateSchema', []),\n )\n\n registry.register(\n {\n name: 'llui_list_effects',\n description:\n 'List all effect variants the component emits, with their field types (same format as llui_list_messages). Returns null if no Effect type is declared.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getEffectSchema', []),\n )\n\n registry.register(\n {\n name: 'llui_trace_element',\n description:\n \"Find all bindings targeting a DOM element matched by a CSS selector. Returns { bindingIndex, kind, key, mask, lastValue, relation }[] so you can answer 'why is this element wrong?' — combine with llui_why_did_update(bindingIndex) for a full narrative.\",\n schema: z.object({\n selector: z.string().describe('CSS selector (e.g. `.todo.active`, `#submit`)'),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('getBindingsFor', [args.selector]),\n )\n\n registry.register(\n {\n name: 'llui_snapshot_state',\n description:\n 'Capture the current state (deep clone). Returns the snapshot — store it, then call llui_restore_state later to roll back. Useful for safely exploring transitions during a debugging session.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('snapshotState', []),\n )\n\n registry.register(\n {\n name: 'llui_restore_state',\n description:\n 'Overwrite the current state with a previously-captured snapshot. Triggers a full re-render (FULL_MASK). Bypasses update() — snap must already be a valid state value.',\n schema: z.object({\n snapshot: z.unknown().describe('The state object returned by llui_snapshot_state.'),\n }),\n },\n 'debug-api',\n async (args, ctx) => {\n await ctx.relay!.call('restoreState', [args.snapshot])\n return { restored: true, state: await ctx.relay!.call('getState', []) }\n },\n )\n\n registry.register(\n {\n name: 'llui_list_components',\n description:\n 'List all currently-mounted LLui components + which one is active (being targeted by subsequent tool calls). Multi-mount apps show one entry per mount.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('__listComponents', []),\n )\n\n registry.register(\n {\n name: 'llui_select_component',\n description:\n 'Switch the active component (the one all other tool calls target). Use a key from llui_list_components.',\n schema: z.object({\n key: z.string().describe('Component key as returned by llui_list_components'),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('__selectComponent', [args.key]),\n )\n\n registry.register(\n {\n name: 'llui_replay_trace',\n description:\n 'Generate a ready-to-run vitest file that replays the current message history via `replayTrace()` from @llui/test. The output is a complete test file with the trace inlined — paste it into packages/<pkg>/test/ to reproduce the exact sequence of messages the component saw in this session. Use this to capture a debugging session as a regression test.',\n schema: z.object({\n importPath: z\n .string()\n .optional()\n .describe(\n \"Where to import the component def from in the generated test (default: '../src/index'). Example: '../src/todo-app'.\",\n ),\n exportName: z\n .string()\n .optional()\n .describe(\"Named export that holds the component def (default: the component's name).\"),\n }),\n },\n 'debug-api',\n async (args, ctx) => {\n const trace = (await ctx.relay!.call('exportTrace', [])) as {\n component: string\n entries: Array<{ msg: unknown; expectedState: unknown; expectedEffects: unknown[] }>\n }\n const importPath = args.importPath ?? '../src/index'\n const exportName = args.exportName ?? trace.component\n return {\n filename: `${trace.component.toLowerCase()}-replay.test.ts`,\n code: generateReplayTest(trace, importPath, exportName),\n entryCount: trace.entries.length,\n }\n },\n )\n\n registry.register(\n {\n name: 'llui_inspect_element',\n description:\n 'Get a rich report for a DOM element: tag, attributes, classes, data-*, text, bounding box, a computed-style subset (display/visibility/position/dimensions), and the bindings targeting this node. Pass a CSS selector. Returns null if no element matches.',\n schema: z.object({ selector: z.string().describe('CSS selector') }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('inspectElement', [args.selector]),\n )\n\n registry.register(\n {\n name: 'llui_get_rendered_html',\n description:\n \"Get the outerHTML of the mounted component or a specific element. Pass 'selector' for a specific node (defaults to the mount root). Pass 'maxLength' to truncate output.\",\n schema: z.object({\n selector: z.string().optional(),\n maxLength: z.number().optional(),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('getRenderedHtml', [args.selector, args.maxLength]),\n )\n\n registry.register(\n {\n name: 'llui_dispatch_event',\n description:\n \"Synthesize and dispatch a browser event at a DOM element. Returns the history indices of any Msgs the handler produced plus the resulting state. 'type' is the event name (e.g. 'click', 'input', 'keydown'). 'init' is an EventInit object (e.g. { key: 'Enter' } for keydown).\",\n schema: z.object({\n selector: z.string(),\n type: z.string(),\n init: z.record(z.string(), z.unknown()).optional(),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('dispatchDomEvent', [args.selector, args.type, args.init]),\n )\n\n registry.register(\n {\n name: 'llui_dom_diff',\n description:\n 'Compare expected HTML against the currently rendered HTML (from selector, or the mount root). Returns { match, differences }. Pass ignoreWhitespace=true to normalize whitespace.',\n schema: z.object({\n expected: z.string(),\n selector: z.string().optional(),\n ignoreWhitespace: z.boolean().optional(),\n }),\n },\n 'debug-api',\n async (args, ctx) => {\n const actual = (await ctx.relay!.call('getRenderedHtml', [args.selector])) as string\n return domDiff(args.expected, actual, {\n ignoreWhitespace: Boolean(args.ignoreWhitespace),\n })\n },\n )\n\n registry.register(\n {\n name: 'llui_get_focus',\n description:\n 'Return info about the currently focused element: { selector (if it has an id), tagName, selectionStart, selectionEnd }. Useful for catching \"focus lost on re-render\" bugs.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getFocus', []),\n )\n\n registry.register(\n {\n name: 'llui_lint',\n description:\n \"Lint LLui source code against ESLint LLui rules. Returns violations grouped by rule. Pass 'path' (absolute file path on the dev machine).\",\n schema: z.object({\n path: z.string().describe('Absolute file path to read and lint.'),\n }),\n },\n 'debug-api',\n async (args, _ctx) => {\n if (!args.path.endsWith('.ts') && !args.path.endsWith('.tsx')) {\n throw new Error(`llui_lint: only .ts/.tsx files are supported, got: ${args.path}`)\n }\n if (!existsSync(args.path)) {\n throw new Error(`llui_lint: file not found: ${args.path}`)\n }\n\n const { execSync } = await import('node:child_process')\n try {\n const output = execSync(`pnpm exec eslint --format json \"${args.path}\"`, {\n encoding: 'utf8',\n })\n const results = JSON.parse(output)\n const violations = results[0]?.messages || []\n return {\n file: args.path,\n score: Math.max(0, 20 - violations.length),\n violations,\n summary: `${violations.length} violation(s)`,\n }\n } catch (err: unknown) {\n const e = err as { stdout?: string; message?: string }\n if (e.stdout) {\n try {\n const results = JSON.parse(e.stdout)\n const violations = results[0]?.messages || []\n return {\n file: args.path,\n score: Math.max(0, 20 - violations.length),\n violations,\n summary: `${violations.length} violation(s)`,\n }\n } catch {\n // fall through to throw below\n }\n }\n throw new Error(`ESLint failed: ${e.message}`, { cause: err })\n }\n },\n )\n\n registry.register(\n {\n name: 'llui_force_rerender',\n description:\n \"Re-evaluate every binding's accessor against the current state, apply changed values to the DOM, and return the indices of bindings that changed. If a binding's DOM value corrects itself after this call but not after a real message, the mask for that binding is wrong.\",\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('forceRerender', []),\n )\n\n registry.register(\n {\n name: 'llui_each_diff',\n description:\n \"Per-each-site reconciliation diffs (added/removed/moved/reused keys) from the dev-time diff log. Pass 'sinceIndex' to filter to entries after a specific message history index.\",\n schema: z.object({ sinceIndex: z.number().optional() }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('getEachDiff', [args.sinceIndex]),\n )\n\n registry.register(\n {\n name: 'llui_scope_tree',\n description:\n \"Walk the scope tree starting at the component root (or a specific scopeId). Returns a LifetimeNode tree with kind (root/show/each/branch/child/portal/foreign) and children. Pass 'depth' to limit traversal, 'scopeId' to start elsewhere.\",\n schema: z.object({\n depth: z.number().optional(),\n scopeId: z.string().optional(),\n }),\n },\n 'debug-api',\n async (args, ctx) =>\n ctx.relay!.call('getScopeTree', [{ depth: args.depth, scopeId: args.scopeId }]),\n )\n\n registry.register(\n {\n name: 'llui_disposer_log',\n description:\n \"Recent onDispose firings with scope id and cause. Pass 'limit' to cap results to the N most recent entries. Catches 'leak on branch swap' class bugs.\",\n schema: z.object({ limit: z.number().optional() }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('getDisposerLog', [args.limit]),\n )\n\n registry.register(\n {\n name: 'llui_list_dead_bindings',\n description:\n \"Bindings that are inactive (scope disposed) OR never matched a dirty mask OR never changed value. Useful for finding wasted work and 'this never updates' bugs. Returns the subset of get_bindings with an annotation on why it's flagged.\",\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => {\n const bindings = (await ctx.relay!.call('getBindings', [])) as Array<{\n index: number\n mask: number\n lastValue: unknown\n kind: string\n key: string | undefined\n dead: boolean\n perItem: boolean\n }>\n return bindings\n .filter((b) => b.dead || b.lastValue === undefined)\n .map((b) => ({\n ...b,\n reason: b.dead ? 'scope_disposed' : 'never_changed',\n }))\n },\n )\n\n registry.register(\n {\n name: 'llui_binding_graph',\n description:\n 'Edge list: state path → binding indices that depend on it. Inverts the compiler-emitted mask legend to show, for each top-level state field, which bindings will re-evaluate when it changes.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getBindingGraph', []),\n )\n\n registry.register(\n {\n name: 'llui_mock_effect',\n description:\n \"Register a mock for an effect matching 'match' ({ type?, payloadPath?, payloadEquals? }). The next matching effect resolves with 'response' instead of running. Mocks are one-shot; pass { persist: true } to keep across matches. Returns { mockId } for later reference.\",\n schema: z.object({\n match: z.record(z.string(), z.unknown()),\n response: z.unknown(),\n opts: z.record(z.string(), z.unknown()).optional(),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('mockEffect', [args.match, args.response, args.opts]),\n )\n\n registry.register(\n {\n name: 'llui_resolve_effect',\n description:\n \"Manually resolve a pending effect with a given response. The effect's onSuccess callback (if any) runs as if it had actually resolved. Pass effectId from llui_pending_effects.\",\n schema: z.object({\n effectId: z.string(),\n response: z.unknown(),\n }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('resolveEffect', [args.effectId, args.response]),\n )\n\n registry.register(\n {\n name: 'llui_pending_effects',\n description:\n \"Current queued and in-flight effects. Each entry has { id, type, dispatchedAt, status, payload }. Use 'id' with llui_resolve_effect to manually resolve one.\",\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getPendingEffects', []),\n )\n\n registry.register(\n {\n name: 'llui_effect_timeline',\n description:\n \"Phased log of effect events: dispatched -> in-flight -> resolved/cancelled/resolved-mocked. Each entry has { effectId, type, phase, timestamp, durationMs? }. Pass 'limit' to cap the tail.\",\n schema: z.object({ limit: z.number().optional() }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('getEffectTimeline', [args.limit]),\n )\n\n registry.register(\n {\n name: 'llui_step_back',\n description:\n \"Rewind state by replaying from init() with the last N messages excluded. 'mode' is 'pure' (default; suppresses effects) or 'live' (re-fires effects from replay). Returns the new state and rewindDepth.\",\n schema: z.object({\n n: z.number().optional(),\n mode: z.enum(['pure', 'live']).optional(),\n }),\n },\n 'debug-api',\n async (args, ctx) => {\n const n = typeof args.n === 'number' ? args.n : 1\n const mode = args.mode === 'live' ? 'live' : 'pure'\n return ctx.relay!.call('stepBack', [n, mode])\n },\n )\n\n registry.register(\n {\n name: 'llui_coverage',\n description:\n \"Per-Msg-variant coverage for the current session: { fired: { variant: { count, lastIndex } }, neverFired: [variants] }. Shows which message types have run and which haven't — useful for finding untested paths.\",\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => ctx.relay!.call('getCoverage', []),\n )\n\n registry.register(\n {\n name: 'llui_diff_state',\n description:\n \"Structured JSON diff between two state values. Pass 'a' and 'b' — plain objects. Returns { added, removed, changed }.\",\n schema: z.object({\n a: z.unknown(),\n b: z.unknown(),\n }),\n },\n 'debug-api',\n async (args) => diffState(args.a, args.b),\n )\n\n registry.register(\n {\n name: 'llui_assert',\n description:\n \"Evaluate a predicate against current state. Pass 'path' (dot-separated), 'op' (eq/neq/exists/gt/lt/in), and 'value'. Returns { pass, actual, expected, op }.\",\n schema: z.object({\n path: z.string(),\n op: z.enum(['eq', 'neq', 'exists', 'gt', 'lt', 'in']),\n value: z.unknown().optional(),\n }),\n },\n 'debug-api',\n async (args, ctx) => {\n const actual = await ctx.relay!.call('searchState', [args.path])\n const expected = args.value\n let pass = false\n switch (args.op) {\n case 'eq':\n pass = Object.is(actual, expected)\n break\n case 'neq':\n pass = !Object.is(actual, expected)\n break\n case 'exists':\n pass = actual !== undefined\n break\n case 'gt':\n pass = typeof actual === 'number' && typeof expected === 'number' && actual > expected\n break\n case 'lt':\n pass = typeof actual === 'number' && typeof expected === 'number' && actual < expected\n break\n case 'in':\n pass = Array.isArray(expected) && expected.includes(actual)\n break\n }\n return { pass, actual, expected, op: args.op }\n },\n )\n\n registry.register(\n {\n name: 'llui_search_history',\n description:\n \"Filtered message history. Pass 'filter' with { type?, statePath?, effectType?, fromIndex?, toIndex? }. Entries match if all present fields match — type is the Msg discriminant, statePath is a dot path whose value differs pre->post, effectType is a type present in the effects array.\",\n schema: z.object({\n filter: z.object({\n type: z.string().optional(),\n statePath: z.string().optional(),\n effectType: z.string().optional(),\n fromIndex: z.number().optional(),\n toIndex: z.number().optional(),\n }),\n }),\n },\n 'debug-api',\n async (args, ctx) => {\n type HRecord = {\n index: number\n timestamp: number\n msg: unknown\n stateBefore: unknown\n stateAfter: unknown\n effects: unknown[]\n dirtyMask: number\n }\n const history = (await ctx.relay!.call('getMessageHistory', [{}])) as HRecord[]\n const f = args.filter\n function pathValue(obj: unknown, path: string): unknown {\n const parts = path.split('.')\n let v: unknown = obj\n for (const p of parts) {\n if (v == null || typeof v !== 'object') return undefined\n v = (v as Record<string, unknown>)[p]\n }\n return v\n }\n return history.filter((r) => {\n if (f.fromIndex !== undefined && r.index < f.fromIndex) return false\n if (f.toIndex !== undefined && r.index > f.toIndex) return false\n if (f.type !== undefined) {\n const t = (r.msg as { type?: string } | null)?.type\n if (t !== f.type) return false\n }\n if (f.statePath !== undefined) {\n const before = pathValue(r.stateBefore, f.statePath)\n const after = pathValue(r.stateAfter, f.statePath)\n if (Object.is(before, after)) return false\n }\n if (f.effectType !== undefined) {\n if (!r.effects.some((e) => (e as { type?: string } | null)?.type === f.effectType)) {\n return false\n }\n }\n return true\n })\n },\n )\n\n registry.register(\n {\n name: 'llui_eval',\n description:\n \"Arbitrary JavaScript in the page context via the debug relay. Returns { result, sideEffects }. 'result' is the expression's return value or { error }. 'sideEffects' makes any state changes, new history entries, new pending effects, and dirty bindings visible. Phase 1 does not support async expressions; expose async results via globalThis instead.\",\n schema: z.object({ code: z.string() }),\n },\n 'debug-api',\n async (args, ctx) => ctx.relay!.call('evalInPage', [args.code]),\n )\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/tools/source.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGvD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAmIhE"}
1
+ {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/tools/source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGvD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAgHhE"}
@@ -1,60 +1,48 @@
1
1
  import { execSync } from 'node:child_process';
2
2
  import { existsSync } from 'node:fs';
3
3
  import { resolve } from 'node:path';
4
+ import { z } from 'zod';
4
5
  import { findWorkspaceRoot } from '../index.js';
5
6
  export function registerSourceTools(registry) {
6
7
  registry.register({
7
8
  name: 'llui_find_msg_producers',
8
9
  description: 'Find all send({type: "msgType"}) call sites in the project source. Returns file path, line, column, and surrounding context for each hit.',
9
- inputSchema: {
10
- type: 'object',
11
- properties: {
12
- msgType: { type: 'string', description: 'The Msg variant type string to search for' },
13
- rootDir: {
14
- type: 'string',
15
- description: 'Root directory to search (defaults to workspace root)',
16
- },
17
- },
18
- required: ['msgType'],
19
- },
10
+ schema: z.object({
11
+ msgType: z.string().describe('The Msg variant type string to search for'),
12
+ rootDir: z
13
+ .string()
14
+ .optional()
15
+ .describe('Root directory to search (defaults to workspace root)'),
16
+ }),
20
17
  }, 'source', async (args, _ctx) => {
21
- const msgType = args.msgType;
22
18
  const rootDir = args.rootDir ?? findWorkspaceRoot();
23
- const pattern = `send\\(\\{[^}]*type:\\s*['"]${msgType}['"]`;
19
+ const pattern = `send\\(\\{[^}]*type:\\s*['"]${args.msgType}['"]`;
24
20
  const hits = grepHits(pattern, rootDir, ['*.ts', '*.tsx']);
25
- return { msgType, hits };
21
+ return { msgType: args.msgType, hits };
26
22
  });
27
23
  registry.register({
28
24
  name: 'llui_find_msg_handlers',
29
25
  description: 'Find all update() function branches that handle a specific Msg variant. Returns file, line, column, and context for each case arm.',
30
- inputSchema: {
31
- type: 'object',
32
- properties: {
33
- msgType: { type: 'string', description: 'The Msg variant type string to search for' },
34
- rootDir: {
35
- type: 'string',
36
- description: 'Root directory to search (defaults to workspace root)',
37
- },
38
- },
39
- required: ['msgType'],
40
- },
26
+ schema: z.object({
27
+ msgType: z.string().describe('The Msg variant type string to search for'),
28
+ rootDir: z
29
+ .string()
30
+ .optional()
31
+ .describe('Root directory to search (defaults to workspace root)'),
32
+ }),
41
33
  }, 'source', async (args, _ctx) => {
42
- const msgType = args.msgType;
43
34
  const rootDir = args.rootDir ?? findWorkspaceRoot();
44
- const pattern = `case\\s+['"]${msgType}['"]\\s*:`;
35
+ const pattern = `case\\s+['"]${args.msgType}['"]\\s*:`;
45
36
  const hits = grepHits(pattern, rootDir, ['*.ts', '*.tsx']);
46
- return { msgType, hits };
37
+ return { msgType: args.msgType, hits };
47
38
  });
48
39
  registry.register({
49
40
  name: 'llui_run_test',
50
41
  description: 'Run a vitest test file (and optionally a specific test name). Returns pass/fail status and captured output.',
51
- inputSchema: {
52
- type: 'object',
53
- properties: {
54
- file: { type: 'string', description: 'Absolute path to the test file' },
55
- testName: { type: 'string', description: 'Test name pattern to filter (-t flag)' },
56
- },
57
- },
42
+ schema: z.object({
43
+ file: z.string().optional().describe('Absolute path to the test file'),
44
+ testName: z.string().optional().describe('Test name pattern to filter (-t flag)'),
45
+ }),
58
46
  }, 'source', async (args, _ctx) => {
59
47
  const workspaceRoot = findWorkspaceRoot();
60
48
  let cmd = `pnpm exec vitest run`;
@@ -80,15 +68,9 @@ export function registerSourceTools(registry) {
80
68
  registry.register({
81
69
  name: 'llui_lint_project',
82
70
  description: 'Run @llui/eslint-plugin rules across all TypeScript files in a directory. Returns a 0–20 idiomatic score, violation count, and per-file violations.',
83
- inputSchema: {
84
- type: 'object',
85
- properties: {
86
- rootDir: {
87
- type: 'string',
88
- description: 'Directory to lint (defaults to workspace root)',
89
- },
90
- },
91
- },
71
+ schema: z.object({
72
+ rootDir: z.string().optional().describe('Directory to lint (defaults to workspace root)'),
73
+ }),
92
74
  }, 'source', async (args, _ctx) => {
93
75
  const rootDir = args.rootDir ?? findWorkspaceRoot();
94
76
  const workspaceRoot = findWorkspaceRoot();
@@ -1 +1 @@
1
- {"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/tools/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,UAAU,mBAAmB,CAAC,QAAsB;IACxD,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,yBAAyB;QAC/B,WAAW,EACT,2IAA2I;QAC7I,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,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,CAAC,EAAE,GAAG,CAAC,CAAA;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IAKvC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAqD,CAAA;IACtF,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACrD,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAA;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;IACjD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAA;AACzC,CAAC","sourcesContent":["import { execSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { ToolRegistry } from '../tool-registry.js'\nimport { findWorkspaceRoot } from '../index.js'\n\nexport function registerSourceTools(registry: ToolRegistry): void {\n registry.register(\n {\n name: 'llui_find_msg_producers',\n description:\n 'Find all send({type: \"msgType\"}) call sites in the project source. Returns file path, line, column, and surrounding context for each hit.',\n inputSchema: {\n type: 'object',\n properties: {\n msgType: { type: 'string', description: 'The Msg variant type string to search for' },\n rootDir: {\n type: 'string',\n description: 'Root directory to search (defaults to workspace root)',\n },\n },\n required: ['msgType'],\n },\n },\n 'source',\n async (args, _ctx) => {\n const msgType = args.msgType as string\n const rootDir = (args.rootDir as string | undefined) ?? findWorkspaceRoot()\n const pattern = `send\\\\(\\\\{[^}]*type:\\\\s*['\"]${msgType}['\"]`\n const hits = grepHits(pattern, rootDir, ['*.ts', '*.tsx'])\n return { msgType, hits }\n },\n )\n\n registry.register(\n {\n name: 'llui_find_msg_handlers',\n description:\n 'Find all update() function branches that handle a specific Msg variant. Returns file, line, column, and context for each case arm.',\n inputSchema: {\n type: 'object',\n properties: {\n msgType: { type: 'string', description: 'The Msg variant type string to search for' },\n rootDir: {\n type: 'string',\n description: 'Root directory to search (defaults to workspace root)',\n },\n },\n required: ['msgType'],\n },\n },\n 'source',\n async (args, _ctx) => {\n const msgType = args.msgType as string\n const rootDir = (args.rootDir as string | undefined) ?? findWorkspaceRoot()\n const pattern = `case\\\\s+['\"]${msgType}['\"]\\\\s*:`\n const hits = grepHits(pattern, rootDir, ['*.ts', '*.tsx'])\n return { msgType, hits }\n },\n )\n\n registry.register(\n {\n name: 'llui_run_test',\n description:\n 'Run a vitest test file (and optionally a specific test name). Returns pass/fail status and captured output.',\n inputSchema: {\n type: 'object',\n properties: {\n file: { type: 'string', description: 'Absolute path to the test file' },\n testName: { type: 'string', description: 'Test name pattern to filter (-t flag)' },\n },\n },\n },\n 'source',\n async (args, _ctx) => {\n const workspaceRoot = findWorkspaceRoot()\n let cmd = `pnpm exec vitest run`\n if (args.file) cmd += ` \"${args.file as string}\"`\n if (args.testName) cmd += ` -t \"${args.testName as string}\"`\n try {\n const output = execSync(cmd, {\n cwd: workspaceRoot,\n encoding: 'utf8',\n timeout: 60_000,\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n return { passed: true, output: output.slice(-4000) }\n } catch (err: unknown) {\n const e = err as { stdout?: string; stderr?: string; message?: string }\n const output = ((e.stdout ?? '') + (e.stderr ?? '')).slice(-4000)\n return { passed: false, output: output || e.message || 'Test failed' }\n }\n },\n )\n\n registry.register(\n {\n name: 'llui_lint_project',\n description:\n 'Run @llui/eslint-plugin rules across all TypeScript files in a directory. Returns a 0–20 idiomatic score, violation count, and per-file violations.',\n inputSchema: {\n type: 'object',\n properties: {\n rootDir: {\n type: 'string',\n description: 'Directory to lint (defaults to workspace root)',\n },\n },\n },\n },\n 'source',\n async (args, _ctx) => {\n const rootDir = (args.rootDir as string | undefined) ?? findWorkspaceRoot()\n const workspaceRoot = findWorkspaceRoot()\n const target = resolve(rootDir, '**/*.{ts,tsx}')\n const cmd = `pnpm exec eslint --format json \"${target}\"`\n try {\n const output = execSync(cmd, {\n cwd: workspaceRoot,\n encoding: 'utf8',\n timeout: 60_000,\n })\n return parseEslintOutput(output)\n } catch (err: unknown) {\n const e = err as { stdout?: string }\n if (e.stdout) {\n try {\n return parseEslintOutput(e.stdout)\n } catch {\n // fall through\n }\n }\n return { score: 0, violations: [], fileCount: 0, error: 'ESLint failed' }\n }\n },\n )\n}\n\ninterface GrepHit {\n file: string\n line: number\n column: number\n context: string\n}\n\nfunction grepHits(pattern: string, rootDir: string, globs: string[]): GrepHit[] {\n if (!existsSync(rootDir)) return []\n const globArgs = globs.map((g) => `--include=\"${g}\"`).join(' ')\n try {\n const out = execSync(`grep -rn --color=never -E ${globArgs} \"${pattern}\" \"${rootDir}\"`, {\n encoding: 'utf8',\n timeout: 15_000,\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n return out\n .split('\\n')\n .filter(Boolean)\n .map((line) => {\n const m = /^(.+?):(\\d+):(.+)$/.exec(line)\n if (!m) return null\n return { file: m[1]!, line: Number(m[2]), column: 1, context: m[3]!.trim() }\n })\n .filter((x): x is GrepHit => x !== null)\n .slice(0, 100)\n } catch {\n return []\n }\n}\n\nfunction parseEslintOutput(output: string): {\n score: number\n violations: unknown[]\n fileCount: number\n} {\n const results = JSON.parse(output) as Array<{ filePath: string; messages: unknown[] }>\n const violations = results.flatMap((r) => r.messages)\n const fileCount = results.length\n const score = Math.max(0, 20 - violations.length)\n return { score, violations, fileCount }\n}\n"]}
1
+ {"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/tools/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,iBAAiB,E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AC9E,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,CAAC,EAAgB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;aACvC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IAKvC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAqD,CAAA;IACtF,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACrD,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAA;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;IACjD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAA;AACzC,CAAC","sourcesContent":["import { execSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { z } from 'zod'\nimport type { ToolRegistry } from '../tool-registry.js'\nimport { findWorkspaceRoot } from '../index.js'\n\nexport function registerSourceTools(registry: ToolRegistry): void {\n registry.register(\n {\n name: 'llui_find_msg_producers',\n description:\n 'Find all send({type: \"msgType\"}) call sites in the project source. Returns file path, line, column, and surrounding context for each hit.',\n schema: z.object({\n msgType: z.string().describe('The Msg variant type string to search for'),\n rootDir: z\n .string()\n .optional()\n .describe('Root directory to search (defaults to workspace root)'),\n }),\n },\n 'source',\n async (args, _ctx) => {\n const rootDir = args.rootDir ?? findWorkspaceRoot()\n const pattern = `send\\\\(\\\\{[^}]*type:\\\\s*['\"]${args.msgType}['\"]`\n const hits = grepHits(pattern, rootDir, ['*.ts', '*.tsx'])\n return { msgType: args.msgType, hits }\n },\n )\n\n registry.register(\n {\n name: 'llui_find_msg_handlers',\n description:\n 'Find all update() function branches that handle a specific Msg variant. Returns file, line, column, and context for each case arm.',\n schema: z.object({\n msgType: z.string().describe('The Msg variant type string to search for'),\n rootDir: z\n .string()\n .optional()\n .describe('Root directory to search (defaults to workspace root)'),\n }),\n },\n 'source',\n async (args, _ctx) => {\n const rootDir = args.rootDir ?? findWorkspaceRoot()\n const pattern = `case\\\\s+['\"]${args.msgType}['\"]\\\\s*:`\n const hits = grepHits(pattern, rootDir, ['*.ts', '*.tsx'])\n return { msgType: args.msgType, hits }\n },\n )\n\n registry.register(\n {\n name: 'llui_run_test',\n description:\n 'Run a vitest test file (and optionally a specific test name). Returns pass/fail status and captured output.',\n schema: z.object({\n file: z.string().optional().describe('Absolute path to the test file'),\n testName: z.string().optional().describe('Test name pattern to filter (-t flag)'),\n }),\n },\n 'source',\n async (args, _ctx) => {\n const workspaceRoot = findWorkspaceRoot()\n let cmd = `pnpm exec vitest run`\n if (args.file) cmd += ` \"${args.file}\"`\n if (args.testName) cmd += ` -t \"${args.testName}\"`\n try {\n const output = execSync(cmd, {\n cwd: workspaceRoot,\n encoding: 'utf8',\n timeout: 60_000,\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n return { passed: true, output: output.slice(-4000) }\n } catch (err: unknown) {\n const e = err as { stdout?: string; stderr?: string; message?: string }\n const output = ((e.stdout ?? '') + (e.stderr ?? '')).slice(-4000)\n return { passed: false, output: output || e.message || 'Test failed' }\n }\n },\n )\n\n registry.register(\n {\n name: 'llui_lint_project',\n description:\n 'Run @llui/eslint-plugin rules across all TypeScript files in a directory. Returns a 0–20 idiomatic score, violation count, and per-file violations.',\n schema: z.object({\n rootDir: z.string().optional().describe('Directory to lint (defaults to workspace root)'),\n }),\n },\n 'source',\n async (args, _ctx) => {\n const rootDir = args.rootDir ?? findWorkspaceRoot()\n const workspaceRoot = findWorkspaceRoot()\n const target = resolve(rootDir, '**/*.{ts,tsx}')\n const cmd = `pnpm exec eslint --format json \"${target}\"`\n try {\n const output = execSync(cmd, {\n cwd: workspaceRoot,\n encoding: 'utf8',\n timeout: 60_000,\n })\n return parseEslintOutput(output)\n } catch (err: unknown) {\n const e = err as { stdout?: string }\n if (e.stdout) {\n try {\n return parseEslintOutput(e.stdout)\n } catch {\n // fall through\n }\n }\n return { score: 0, violations: [], fileCount: 0, error: 'ESLint failed' }\n }\n },\n )\n}\n\ninterface GrepHit {\n file: string\n line: number\n column: number\n context: string\n}\n\nfunction grepHits(pattern: string, rootDir: string, globs: string[]): GrepHit[] {\n if (!existsSync(rootDir)) return []\n const globArgs = globs.map((g) => `--include=\"${g}\"`).join(' ')\n try {\n const out = execSync(`grep -rn --color=never -E ${globArgs} \"${pattern}\" \"${rootDir}\"`, {\n encoding: 'utf8',\n timeout: 15_000,\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n return out\n .split('\\n')\n .filter(Boolean)\n .map((line) => {\n const m = /^(.+?):(\\d+):(.+)$/.exec(line)\n if (!m) return null\n return { file: m[1]!, line: Number(m[2]), column: 1, context: m[3]!.trim() }\n })\n .filter((x): x is GrepHit => x !== null)\n .slice(0, 100)\n } catch {\n return []\n }\n}\n\nfunction parseEslintOutput(output: string): {\n score: number\n violations: unknown[]\n fileCount: number\n} {\n const results = JSON.parse(output) as Array<{ filePath: string; messages: unknown[] }>\n const violations = results.flatMap((r) => r.messages)\n const fileCount = results.length\n const score = Math.max(0, 20 - violations.length)\n return { score, violations, fileCount }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ssr.d.ts","sourceRoot":"","sources":["../../src/tools/ssr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CA6E7D"}
1
+ {"version":3,"file":"ssr.d.ts","sourceRoot":"","sources":["../../src/tools/ssr.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CA0E7D"}
package/dist/tools/ssr.js CHANGED
@@ -1,8 +1,9 @@
1
+ import { z } from 'zod';
1
2
  export function registerSsrTools(registry) {
2
3
  registry.register({
3
4
  name: 'llui_hydration_report',
4
5
  description: 'Compare the server-rendered HTML (from @llui/vike) against the current client DOM and return divergences. Each divergence includes the DOM path, kind (attribute/text/structural), and the server vs client values. Returns an empty array when hydration is clean.',
5
- inputSchema: { type: 'object', properties: {} },
6
+ schema: z.object({}),
6
7
  }, 'debug-api', async (_args, ctx) => {
7
8
  const divergences = await ctx.relay.call('getHydrationReport', []);
8
9
  return { divergences };
@@ -10,15 +11,12 @@ export function registerSsrTools(registry) {
10
11
  registry.register({
11
12
  name: 'llui_ssr_render',
12
13
  description: 'Server-render the active component using its current state and return the resulting HTML string. Requires @llui/vike to be installed. Useful for verifying that the server output matches what you expect before hydration.',
13
- inputSchema: {
14
- type: 'object',
15
- properties: {
16
- state: {
17
- type: 'object',
18
- description: 'State override (defaults to current component state)',
19
- },
20
- },
21
- },
14
+ schema: z.object({
15
+ state: z
16
+ .record(z.string(), z.unknown())
17
+ .optional()
18
+ .describe('State override (defaults to current component state)'),
19
+ }),
22
20
  }, 'debug-api', async (args, ctx) => {
23
21
  const currentState = args.state ?? (await ctx.relay.call('getState', []));
24
22
  const componentInfo = (await ctx.relay.call('getComponentInfo', []));
@@ -1 +1 @@
1
- {"version":3,"file":"ssr.js","sourceRoot":"","sources":["../../src/tools/ssr.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,QAAsB;IACrD,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,qQAAqQ;QACvQ,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KAChD,EACD,WAAW,EACX,KAAK,EAAE,KAAK,EAAE,GAAG,E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AAE,EAAE,YAAY,EAAE,YAAY,EAAE;gBACzC,WAAW,EAAE,GAAG;gBAChB,eAAe,EAAE,EAAE;aACpB,CAAA;YACD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;YACzD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAA;QACxD,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,CAAC,GAAG,GAA2B,CAAA;YACrC,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE,mBAAmB;gBAC1B,IAAI,EAAE,CAAC,CAAC,OAAO,IAAI,eAAe;aACnC,CAAA;QACH,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC","sourcesContent":["import type { ToolRegistry } from '../tool-registry.js'\n\nexport function registerSsrTools(registry: ToolRegistry): void {\n registry.register(\n {\n name: 'llui_hydration_report',\n description:\n 'Compare the server-rendered HTML (from @llui/vike) against the current client DOM and return divergences. Each divergence includes the DOM path, kind (attribute/text/structural), and the server vs client values. Returns an empty array when hydration is clean.',\n inputSchema: { type: 'object', properties: {} },\n },\n 'debug-api',\n async (_args, ctx) => {\n const divergences = await ctx.relay!.call('getHydrationReport', [])\n return { divergences }\n },\n )\n\n registry.register(\n {\n name: 'llui_ssr_render',\n description:\n 'Server-render the active component using its current state and return the resulting HTML string. Requires @llui/vike to be installed. Useful for verifying that the server output matches what you expect before hydration.',\n inputSchema: {\n type: 'object',\n properties: {\n state: {\n type: 'object',\n description: 'State override (defaults to current component state)',\n },\n },\n },\n },\n 'debug-api',\n async (args, ctx) => {\n const currentState = args.state ?? (await ctx.relay!.call('getState', []))\n const componentInfo = (await ctx.relay!.call('getComponentInfo', [])) as {\n name: string\n file: string | null\n } | null\n\n if (!componentInfo?.file) {\n return {\n ok: false,\n error: 'component_file_unknown',\n hint: 'Component file path not available — ensure @llui/vite-plugin emits __componentMeta in dev mode.',\n }\n }\n\n try {\n // Use Function-based dynamic import to avoid Vite static analysis\n // at transform time. @llui/vike is an optional peer dep — we must\n // not let the bundler try to resolve it unconditionally.\n const dynamicImport = new Function('specifier', 'return import(specifier)') as (\n s: string,\n ) => Promise<unknown>\n const vikeModule = (await dynamicImport('@llui/vike')) as {\n onRenderHtml: (ctx: unknown) => Promise<{ documentHtml: unknown }>\n }\n const pageModule = (await dynamicImport(componentInfo.file)) as {\n default: unknown\n }\n const pageContext = {\n Page: pageModule.default,\n pageProps: { initialState: currentState },\n urlOriginal: '/',\n headersOriginal: {},\n }\n const result = await vikeModule.onRenderHtml(pageContext)\n return { ok: true, html: String(result.documentHtml) }\n } catch (err: unknown) {\n const e = err as { message?: string }\n return {\n ok: false,\n error: 'ssr_render_failed',\n hint: e.message ?? 'Unknown error',\n }\n }\n },\n )\n}\n"]}
1
+ {"version":3,"file":"ssr.js","sourceRoot":"","sources":["../../src/tools/ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,MAAM,UAAU,gBAAgB,CAAC,QAAsB;IACrD,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,qQAAqQ;QACvQ,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;KACrB,EACD,WAAW,EACX,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACnB,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,KAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAA;QACnE,OAAO,EAAE,WAAW,EAAE,CAAA;IACxB,CAAC,CACF,CAAA;IAED,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,6NAA6N;QAC/N,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;YACf,KAAK,EAAE,CAAC;iBACL,MAAM,CAAC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AA;QACxD,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,CAAC,GAAG,GAA2B,CAAA;YACrC,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE,mBAAmB;gBAC1B,IAAI,EAAE,CAAC,CAAC,OAAO,IAAI,eAAe;aACnC,CAAA;QACH,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC","sourcesContent":["import { z } from 'zod'\nimport type { ToolRegistry } from '../tool-registry.js'\n\nexport function registerSsrTools(registry: ToolRegistry): void {\n registry.register(\n {\n name: 'llui_hydration_report',\n description:\n 'Compare the server-rendered HTML (from @llui/vike) against the current client DOM and return divergences. Each divergence includes the DOM path, kind (attribute/text/structural), and the server vs client values. Returns an empty array when hydration is clean.',\n schema: z.object({}),\n },\n 'debug-api',\n async (_args, ctx) => {\n const divergences = await ctx.relay!.call('getHydrationReport', [])\n return { divergences }\n },\n )\n\n registry.register(\n {\n name: 'llui_ssr_render',\n description:\n 'Server-render the active component using its current state and return the resulting HTML string. Requires @llui/vike to be installed. Useful for verifying that the server output matches what you expect before hydration.',\n schema: z.object({\n state: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('State override (defaults to current component state)'),\n }),\n },\n 'debug-api',\n async (args, ctx) => {\n const currentState = args.state ?? (await ctx.relay!.call('getState', []))\n const componentInfo = (await ctx.relay!.call('getComponentInfo', [])) as {\n name: string\n file: string | null\n } | null\n\n if (!componentInfo?.file) {\n return {\n ok: false,\n error: 'component_file_unknown',\n hint: 'Component file path not available — ensure @llui/vite-plugin emits __componentMeta in dev mode.',\n }\n }\n\n try {\n // Use Function-based dynamic import to avoid Vite static analysis\n // at transform time. @llui/vike is an optional peer dep — we must\n // not let the bundler try to resolve it unconditionally.\n const dynamicImport = new Function('specifier', 'return import(specifier)') as (\n s: string,\n ) => Promise<unknown>\n const vikeModule = (await dynamicImport('@llui/vike')) as {\n onRenderHtml: (ctx: unknown) => Promise<{ documentHtml: unknown }>\n }\n const pageModule = (await dynamicImport(componentInfo.file)) as {\n default: unknown\n }\n const pageContext = {\n Page: pageModule.default,\n pageProps: { initialState: currentState },\n urlOriginal: '/',\n headersOriginal: {},\n }\n const result = await vikeModule.onRenderHtml(pageContext)\n return { ok: true, html: String(result.documentHtml) }\n } catch (err: unknown) {\n const e = err as { message?: string }\n return {\n ok: false,\n error: 'ssr_render_failed',\n hint: e.message ?? 'Unknown error',\n }\n }\n },\n )\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llui/mcp",
3
- "version": "0.0.24",
3
+ "version": "0.0.27",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "bin": {
@@ -18,10 +18,11 @@
18
18
  "dependencies": {
19
19
  "@modelcontextprotocol/sdk": "^1.29.0",
20
20
  "ws": "^8.18.0",
21
- "@llui/dom": "0.0.30",
22
- "@llui/eslint-plugin": "0.0.14"
21
+ "zod": "^4.0.0",
22
+ "@llui/eslint-plugin": "0.0.17"
23
23
  },
24
24
  "peerDependencies": {
25
+ "@llui/dom": "^0.0.32",
25
26
  "playwright": ">=1.0.0"
26
27
  },
27
28
  "peerDependenciesMeta": {
@@ -32,7 +33,8 @@
32
33
  "devDependencies": {
33
34
  "@types/node": "^22.0.0",
34
35
  "@types/ws": "^8.5.13",
35
- "playwright": "*"
36
+ "playwright": "*",
37
+ "@llui/dom": "0.0.32"
36
38
  },
37
39
  "description": "LLui MCP server — LLM debug tools via Model Context Protocol",
38
40
  "keywords": [