@llui/mcp 0.0.25 → 0.0.28

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,16 +1,11 @@
1
+ import { z } from 'zod';
1
2
  export function registerCompilerTools(registry) {
2
3
  registry.register({
3
4
  name: 'llui_show_compiled',
4
5
  description: "Return the pre-transform and post-transform source for the active component's view function. Useful for understanding what the Vite plugin compiled and why a binding exists.",
5
- inputSchema: {
6
- type: 'object',
7
- properties: {
8
- viewFn: {
9
- type: 'string',
10
- description: 'Specific view helper name to extract (optional)',
11
- },
12
- },
13
- },
6
+ schema: z.object({
7
+ viewFn: z.string().optional().describe('Specific view helper name to extract (optional)'),
8
+ }),
14
9
  }, 'compiler', async (args, ctx) => {
15
10
  const result = (await ctx.relay.call('getCompiledSource', [args.viewFn ?? null]));
16
11
  return result ?? { pre: null, post: null };
@@ -18,16 +13,9 @@ export function registerCompilerTools(registry) {
18
13
  registry.register({
19
14
  name: 'llui_explain_mask',
20
15
  description: 'For a given state-path key, return the mask bit and related paths. Helps diagnose why a binding does or does not update when a message fires.',
21
- inputSchema: {
22
- type: 'object',
23
- properties: {
24
- msgType: {
25
- type: 'string',
26
- description: 'State path key to look up in the mask map',
27
- },
28
- },
29
- required: ['msgType'],
30
- },
16
+ schema: z.object({
17
+ msgType: z.string().describe('State path key to look up in the mask map'),
18
+ }),
31
19
  }, 'compiler', async (args, ctx) => {
32
20
  const map = (await ctx.relay.call('getMsgMaskMap', []));
33
21
  if (!map) {
@@ -46,13 +34,9 @@ export function registerCompilerTools(registry) {
46
34
  registry.register({
47
35
  name: 'llui_goto_binding_source',
48
36
  description: 'Return the source file, line, and column of the view() expression that created a specific binding index. Use with llui_get_bindings to map binding indices to their origin.',
49
- inputSchema: {
50
- type: 'object',
51
- properties: {
52
- bindingIndex: { type: 'number', description: 'The binding index (0-based)' },
53
- },
54
- required: ['bindingIndex'],
55
- },
37
+ schema: z.object({
38
+ bindingIndex: z.number().describe('The binding index (0-based)'),
39
+ }),
56
40
  }, 'compiler', async (args, ctx) => {
57
41
  return ctx.relay.call('getBindingSource', [args.bindingIndex]);
58
42
  });
@@ -1 +1 @@
1
- {"version":3,"file":"compiler.js","sourceRoot":"","sources":["../../src/tools/compiler.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,qBAAqB,CAAC,QAAsB;IAC1D,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,+KAA+K;QACjL,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,iDAAiD;iBAC/D;aACF;SACF;KACF,EACD,UAAU,EACV,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAClB,MAAM,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,KAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAGzE,CAAA;QACR,OAAO,MAAM,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IAC5C,CAAC,CACF,CAAA;IAED,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,+IAA+I;QACjJ,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,2CAA2C;iBACzD;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF,EACD,UAAU,EACV,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAClB,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,KAAM,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC,CAAkC,CAAA;QACzF,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO;gBACL,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,uEAAuE;aAC/E,CAAA;QACH,CAAC;QACD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,OAAiB,CAAC,IAAI,CAAC,CAAA;QAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;aAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC;aAC/C,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;QACxB,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IAC/C,CAAC,CACF,CAAA;IAED,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,0BAA0B;QAChC,WAAW,EACT,6KAA6K;QAC/K,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;aAC7E;YACD,QAAQ,EAAE,CAAC,cAAc,CAAC;SAC3B;KACF,EACD,UAAU,EACV,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAClB,OAAO,GAAG,CAAC,KAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAA;IACjE,CAAC,CACF,CAAA;AACH,CAAC","sourcesContent":["import type { ToolRegistry } from '../tool-registry.js'\n\nexport function registerCompilerTools(registry: ToolRegistry): void {\n registry.register(\n {\n name: 'llui_show_compiled',\n description:\n \"Return the pre-transform and post-transform source for the active component's view function. Useful for understanding what the Vite plugin compiled and why a binding exists.\",\n inputSchema: {\n type: 'object',\n properties: {\n viewFn: {\n type: 'string',\n description: 'Specific view helper name to extract (optional)',\n },\n },\n },\n },\n 'compiler',\n async (args, ctx) => {\n const result = (await ctx.relay!.call('getCompiledSource', [args.viewFn ?? null])) as {\n pre: string\n post: string\n } | null\n return result ?? { pre: null, post: null }\n },\n )\n\n registry.register(\n {\n name: 'llui_explain_mask',\n description:\n 'For a given state-path key, return the mask bit and related paths. Helps diagnose why a binding does or does not update when a message fires.',\n inputSchema: {\n type: 'object',\n properties: {\n msgType: {\n type: 'string',\n description: 'State path key to look up in the mask map',\n },\n },\n required: ['msgType'],\n },\n },\n 'compiler',\n async (args, ctx) => {\n const map = (await ctx.relay!.call('getMsgMaskMap', [])) as Record<string, number> | null\n if (!map) {\n return {\n msgType: args.msgType,\n mask: null,\n error: 'No mask map available — component may not have agent metadata emitted',\n }\n }\n const mask = map[args.msgType as string] ?? 0\n const paths = Object.entries(map)\n .filter(([, bit]) => bit === mask && mask !== 0)\n .map(([path]) => path)\n return { msgType: args.msgType, mask, paths }\n },\n )\n\n registry.register(\n {\n name: 'llui_goto_binding_source',\n description:\n 'Return the source file, line, and column of the view() expression that created a specific binding index. Use with llui_get_bindings to map binding indices to their origin.',\n inputSchema: {\n type: 'object',\n properties: {\n bindingIndex: { type: 'number', description: 'The binding index (0-based)' },\n },\n required: ['bindingIndex'],\n },\n },\n 'compiler',\n async (args, ctx) => {\n return ctx.relay!.call('getBindingSource', [args.bindingIndex])\n },\n )\n}\n"]}
1
+ {"version":3,"file":"compiler.js","sourceRoot":"","sources":["../../src/tools/compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,MAAM,UAAU,qBAAqB,CAAC,QAAsB;IAC1D,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,+KAA+K;QACjL,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;YACf,MAAM,EAAE,CAAC,CA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CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;QACxB,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IAC/C,CAAC,CACF,CAAA;IAED,QAAQ,CAAC,QAAQ,CACf;QACE,IAAI,EAAE,0BAA0B;QAChC,WAAW,EACT,6KAA6K;QAC/K,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;YACf,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;SACjE,CAAC;KACH,EACD,UAAU,EACV,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAClB,OAAO,GAAG,CAAC,KAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAA;IACjE,CAAC,CACF,CAAA;AACH,CAAC","sourcesContent":["import { z } from 'zod'\nimport type { ToolRegistry } from '../tool-registry.js'\n\nexport function registerCompilerTools(registry: ToolRegistry): void {\n registry.register(\n {\n name: 'llui_show_compiled',\n description:\n \"Return the pre-transform and post-transform source for the active component's view function. Useful for understanding what the Vite plugin compiled and why a binding exists.\",\n schema: z.object({\n viewFn: z.string().optional().describe('Specific view helper name to extract (optional)'),\n }),\n },\n 'compiler',\n async (args, ctx) => {\n const result = (await ctx.relay!.call('getCompiledSource', [args.viewFn ?? null])) as {\n pre: string\n post: string\n } | null\n return result ?? { pre: null, post: null }\n },\n )\n\n registry.register(\n {\n name: 'llui_explain_mask',\n description:\n 'For a given state-path key, return the mask bit and related paths. Helps diagnose why a binding does or does not update when a message fires.',\n schema: z.object({\n msgType: z.string().describe('State path key to look up in the mask map'),\n }),\n },\n 'compiler',\n async (args, ctx) => {\n const map = (await ctx.relay!.call('getMsgMaskMap', [])) as Record<string, number> | null\n if (!map) {\n return {\n msgType: args.msgType,\n mask: null,\n error: 'No mask map available — component may not have agent metadata emitted',\n }\n }\n const mask = map[args.msgType] ?? 0\n const paths = Object.entries(map)\n .filter(([, bit]) => bit === mask && mask !== 0)\n .map(([path]) => path)\n return { msgType: args.msgType, mask, paths }\n },\n )\n\n registry.register(\n {\n name: 'llui_goto_binding_source',\n description:\n 'Return the source file, line, and column of the view() expression that created a specific binding index. Use with llui_get_bindings to map binding indices to their origin.',\n schema: z.object({\n bindingIndex: z.number().describe('The binding index (0-based)'),\n }),\n },\n 'compiler',\n async (args, ctx) => {\n return ctx.relay!.call('getBindingSource', [args.bindingIndex])\n },\n )\n}\n"]}
@@ -1,9 +1,14 @@
1
1
  import type { ToolRegistry } from '../tool-registry.js';
2
2
  /**
3
- * Register the 23 debug-API-backed tools. Every handler here routes through
4
- * `ctx.relay!.call(method, args)` — which transparently dispatches to either
5
- * an in-process `LluiDebugAPI` or the WebSocket bridge, depending on how the
6
- * transport was wired.
3
+ * Register the 33 debug-API-backed tools. Every handler routes through
4
+ * `ctx.relay!.call(method, args)` — which transparently dispatches to
5
+ * either an in-process `LluiDebugAPI` or the WebSocket bridge,
6
+ * depending on how the transport was wired.
7
+ *
8
+ * Zod schemas drive both runtime input validation (the registry's
9
+ * `dispatch()` calls `schema.safeParse()` before invoking the handler)
10
+ * and the JSON Schema published in `tools/list` (derived once at
11
+ * registration time). Handlers receive parsed/typed arguments.
7
12
  */
8
13
  export declare function registerDebugApiTools(registry: ToolRegistry): void;
9
14
  //# sourceMappingURL=debug-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug-api.d.ts","sourceRoot":"","sources":["../../src/tools/debug-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAIvD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CA63BlE"}
1
+ {"version":3,"file":"debug-api.d.ts","sourceRoot":"","sources":["../../src/tools/debug-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAIvD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAotBlE"}