@golemui/gui-mcp 1.0.0-rc.3 → 1.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +64 -23
- package/cli.js +43 -35
- package/dx/check-dx-code.d.ts +25 -0
- package/dx/dx-lint.d.ts +27 -0
- package/dx/dx-specs.d.ts +70 -0
- package/dx/get-dx-spec.d.ts +27 -0
- package/dx/instructions.d.ts +7 -0
- package/dx/list-dx-factories.d.ts +19 -0
- package/dx/tools.d.ts +3 -0
- package/dx/type-graph.d.ts +10 -0
- package/dx/typecheck.d.ts +41 -0
- package/{get-concept-B7s_l8Qs.js → get-concept-Cy3zD1BS.js} +22 -16
- package/{tools → json}/generate-from-json-schema.d.ts +3 -3
- package/{tools → json}/generate-from-openapi.d.ts +3 -3
- package/{tools → json}/get-widget-spec.d.ts +3 -3
- package/json/instructions.d.ts +6 -0
- package/json/tools.d.ts +3 -0
- package/{tools → json}/validate-form-definition.d.ts +5 -5
- package/json.d.ts +7 -0
- package/json.js +13 -0
- package/lib.d.ts +11 -7
- package/lib.js +17 -6
- package/list-dx-factories-CF4ExKyx.js +602 -0
- package/package.json +16 -7
- package/{lint → shared/lint}/reactive-expressions.d.ts +8 -0
- package/shared/tool.d.ts +49 -0
- package/shared/tools.d.ts +7 -0
- /package/{utils → json}/errors.d.ts +0 -0
- /package/{mapping → json/mapping}/json-schema-to-gui.d.ts +0 -0
- /package/{mapping → json/mapping}/validator.d.ts +0 -0
- /package/{schemas → json/schemas}/ajv.d.ts +0 -0
- /package/{schemas → json/schemas}/index.d.ts +0 -0
- /package/{schemas → json/schemas}/shallow-validators.d.ts +0 -0
- /package/{lint → json}/string-interpolation.d.ts +0 -0
- /package/{tools → shared}/get-concept.d.ts +0 -0
|
@@ -16,3 +16,11 @@ export type ExpressionFinding = {
|
|
|
16
16
|
* We deliberately don't try to fully parse: too easy to get false positives, too little gain.
|
|
17
17
|
*/
|
|
18
18
|
export declare function lintReactiveExpressions(formDefinition: unknown): ExpressionFinding[];
|
|
19
|
+
/**
|
|
20
|
+
* Lint a single reactive expression string in isolation, against the same rules
|
|
21
|
+
* `lintReactiveExpressions` applies while walking a JSON form definition. This is
|
|
22
|
+
* the shared engine the DX path (`dx_check_code`) reuses: the JSON walker has the
|
|
23
|
+
* object tree, the DX linter has the AST — both funnel each `when` expression
|
|
24
|
+
* through here so the two surfaces can never drift.
|
|
25
|
+
*/
|
|
26
|
+
export declare function checkReactiveExpression(expression: string, path?: string): ExpressionFinding[];
|
package/shared/tool.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MCP tool wiring shared by both authoring paths.
|
|
3
|
+
*
|
|
4
|
+
* Each path (`json/`, `dx/`) and the shared surface export a `ToolEntry[]` that pairs an
|
|
5
|
+
* MCP tool descriptor with its handler. The server concatenates those arrays for both the
|
|
6
|
+
* `tools/list` response and name-based dispatch, so adding a tool is a one-line change in
|
|
7
|
+
* the owning module — there is no central switch to keep in sync.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The shape of the exported `*_TOOL` descriptor objects. Kept intentionally loose
|
|
11
|
+
* (`inputSchema: unknown`, readonly fields) so the `as const` descriptors assign without
|
|
12
|
+
* readonly friction; the MCP client is what validates `arguments` against the real
|
|
13
|
+
* `inputSchema` before a call ever reaches us.
|
|
14
|
+
*/
|
|
15
|
+
export type ToolDescriptor = {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly description?: string;
|
|
18
|
+
readonly inputSchema: unknown;
|
|
19
|
+
};
|
|
20
|
+
/** One registered MCP tool: its descriptor (advertised to the client) and its handler. */
|
|
21
|
+
export interface ToolEntry {
|
|
22
|
+
tool: ToolDescriptor;
|
|
23
|
+
run: (args: Record<string, unknown> | undefined) => unknown | Promise<unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Pair a tool descriptor with its handler. `args` arrives already shape-validated by the
|
|
27
|
+
* MCP client against `tool.inputSchema`, so this is the single trusted boundary where raw
|
|
28
|
+
* arguments are cast to the handler's input type — instead of an `as any` repeated at
|
|
29
|
+
* every dispatch arm.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const jsonTools = [defineTool(JSON_VALIDATE_FORM_DEFINITION_TOOL, validateFormDefinition)];
|
|
33
|
+
*/
|
|
34
|
+
export declare function defineTool<Input, Output>(tool: ToolDescriptor, handler: (input: Input) => Output): ToolEntry;
|
|
35
|
+
/** Wrap a successful tool result in the MCP text-content envelope. */
|
|
36
|
+
export declare function ok(payload: unknown): {
|
|
37
|
+
content: {
|
|
38
|
+
type: "text";
|
|
39
|
+
text: string;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
/** Wrap an error message in the MCP error envelope. */
|
|
43
|
+
export declare function err(message: string): {
|
|
44
|
+
isError: boolean;
|
|
45
|
+
content: {
|
|
46
|
+
type: "text";
|
|
47
|
+
text: string;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ToolEntry } from './tool';
|
|
2
|
+
/**
|
|
3
|
+
* Cross-cutting reference tools that serve both authoring paths. `get_concept` explains
|
|
4
|
+
* behavior that spans widgets (conditional rendering, per-state props, the reactive
|
|
5
|
+
* scope), which a JSON author and a `gui.*` DX author both reach for.
|
|
6
|
+
*/
|
|
7
|
+
export declare const sharedTools: ToolEntry[];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|