@forumone/throughline-components 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +8 -1
- package/dist/plugin.js.map +1 -1
- package/dist/tools/descriptors.d.ts +34 -0
- package/dist/tools/descriptors.d.ts.map +1 -0
- package/dist/tools/descriptors.js +43 -0
- package/dist/tools/descriptors.js.map +1 -0
- package/dist/tools/find-anti-pattern.d.ts.map +1 -1
- package/dist/tools/find-anti-pattern.js +2 -2
- package/dist/tools/find-anti-pattern.js.map +1 -1
- package/dist/tools/get-contract.d.ts.map +1 -1
- package/dist/tools/get-contract.js +2 -2
- package/dist/tools/get-contract.js.map +1 -1
- package/dist/tools/get-tokens.d.ts.map +1 -1
- package/dist/tools/get-tokens.js +2 -2
- package/dist/tools/get-tokens.js.map +1 -1
- package/dist/tools/get-variants.d.ts.map +1 -1
- package/dist/tools/get-variants.js +2 -2
- package/dist/tools/get-variants.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/list-components.d.ts.map +1 -1
- package/dist/tools/list-components.js +2 -2
- package/dist/tools/list-components.js.map +1 -1
- package/dist/tools/suggest-for-intent.d.ts.map +1 -1
- package/dist/tools/suggest-for-intent.js +2 -2
- package/dist/tools/suggest-for-intent.js.map +1 -1
- package/dist/tools/validate-composition.d.ts.map +1 -1
- package/dist/tools/validate-composition.js +2 -2
- package/dist/tools/validate-composition.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @forumone/throughline-components
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a9262da: Per-tool gating works, because tool names no longer wait for `onInit`
|
|
8
|
+
|
|
9
|
+
`@payloadcms/plugin-mcp` generates one per-key checkbox per tool while the host's
|
|
10
|
+
config is being built, and then gates every call on the checkbox matching the
|
|
11
|
+
tool's name. Every Throughline tool was built at `onInit` — each closes over
|
|
12
|
+
`payload`, the publishing service or the manifest loader — so the array it maps
|
|
13
|
+
over was empty, no checkboxes were generated, and its `?? false` denied all 27
|
|
14
|
+
tools to every key. A valid key got a 200 and an empty `tools/list`, with nothing
|
|
15
|
+
wrong on either side.
|
|
16
|
+
|
|
17
|
+
The plugin needs only `name` and `description` then, and neither needs a Payload.
|
|
18
|
+
So a server now **declares** its tools as the config is built and **binds** their
|
|
19
|
+
handlers at `onInit`:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
options.mcpTools?.declare(PUBLISHING_TOOL_DESCRIPTORS, { serverName: 'publishing' })
|
|
23
|
+
// …later, at onInit:
|
|
24
|
+
options.mcpTools?.add(tools, { serverName: 'publishing' })
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Each package gained a `tools/descriptors.ts` holding every tool's name and
|
|
28
|
+
description; the factories spread from it, so the checkbox and the MCP client
|
|
29
|
+
cannot describe a tool differently. A `descriptors.test.ts` in each package
|
|
30
|
+
asserts the two sets match, without needing a database.
|
|
31
|
+
|
|
32
|
+
`createMcpToolCollector` gains `declare()` and an `unbound` list. Both mismatches
|
|
33
|
+
are refused rather than absorbed: a tool built but never declared throws at
|
|
34
|
+
`onInit` (it would otherwise be denied to every key, silently), and a tool
|
|
35
|
+
declared but never bound stays advertised with a handler that explains itself.
|
|
36
|
+
|
|
37
|
+
**Order in the host's plugin array is now load-bearing.** Every tool-bearing
|
|
38
|
+
server must come before `mcpPlugin`, or it declares into an array that has
|
|
39
|
+
already been read. It was only a convention before; it is a requirement now, and
|
|
40
|
+
the failure mode — a server's tools missing from every key — is the one this
|
|
41
|
+
change exists to remove.
|
|
42
|
+
|
|
43
|
+
`requiredScope` stays declared and read by nothing. Enforcement is the checkbox;
|
|
44
|
+
these record which tools are consequential, and are the mapping a scope-aware
|
|
45
|
+
default would be built from.
|
|
46
|
+
|
|
47
|
+
The playground registers `mcpPlugin` for the first time, so the suite's only
|
|
48
|
+
end-to-end host now exercises the tools rather than just their composition.
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [a9262da]
|
|
53
|
+
- @forumone/throughline-core@0.8.0
|
|
54
|
+
|
|
3
55
|
## 0.4.0
|
|
4
56
|
|
|
5
57
|
### Minor Changes
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AAGvE,OAAO,EAAE,KAAK,uBAAuB,EAAmB,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AAGvE,OAAO,EAAE,KAAK,uBAAuB,EAAmB,MAAM,cAAc,CAAA;AA6B5E,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,uBAAuB,CAsE9D,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createNamedLogger, defaultLogger, getAuditWriter } from '@forumone/thro
|
|
|
3
3
|
import { validateOptions } from './options.js';
|
|
4
4
|
import { createManifestLoader } from './manifest-source.js';
|
|
5
5
|
import { createTfidfMatcher } from './matching/index.js';
|
|
6
|
-
import { createFindAntiPatternTool, createGetContractTool, createGetTokensTool, createGetVariantsTool, createListComponentsTool, createSuggestForIntentTool, createValidateCompositionTool, } from './tools/index.js';
|
|
6
|
+
import { COMPONENTS_TOOL_DESCRIPTORS, createFindAntiPatternTool, createGetContractTool, createGetTokensTool, createGetVariantsTool, createListComponentsTool, createSuggestForIntentTool, createValidateCompositionTool, } from './tools/index.js';
|
|
7
7
|
import { validateComposition, } from './validation/composition.js';
|
|
8
8
|
const PLUGIN_ID = '@forumone/throughline-components';
|
|
9
9
|
const PLUGIN_VERSION = '0.1.0';
|
|
@@ -20,6 +20,13 @@ export const componentsPlugin = (rawOptions) => (incomingConfig) => {
|
|
|
20
20
|
const options = validateOptions(rawOptions);
|
|
21
21
|
const logger = createNamedLogger('components', options.logger ?? defaultLogger);
|
|
22
22
|
const maxRecommendations = options.matching?.maxRecommendations ?? 5;
|
|
23
|
+
/*
|
|
24
|
+
Declared here, bound at `onInit` — `mcpPlugin` generates its per-key
|
|
25
|
+
checkboxes from these names and descriptions while the config is built, and
|
|
26
|
+
denies any tool it has no checkbox for. This plugin must therefore come
|
|
27
|
+
before `mcpPlugin` in the host's array.
|
|
28
|
+
*/
|
|
29
|
+
options.mcpTools?.declare(COMPONENTS_TOOL_DESCRIPTORS, { serverName: 'components' });
|
|
23
30
|
return {
|
|
24
31
|
...incomingConfig,
|
|
25
32
|
onInit: async (payload) => {
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EAAgC,eAAe,EAAE,MAAM,cAAc,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAuB,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,kBAA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
+
import type { McpToolDescriptor } from '@forumone/throughline-core';
|
|
2
|
+
export declare const COMPONENTS_TOOLS: {
|
|
3
|
+
readonly listComponents: {
|
|
4
|
+
readonly name: "list_components";
|
|
5
|
+
readonly description: "Returns the list of components available in the design system. Use this to discover what components exist before composing content.";
|
|
6
|
+
};
|
|
7
|
+
readonly getContract: {
|
|
8
|
+
readonly name: "get_contract";
|
|
9
|
+
readonly description: "Returns the full contract for a named component, including intent, composition rules, content fields, variants, tokens, accessibility requirements, examples, and anti-examples.";
|
|
10
|
+
};
|
|
11
|
+
readonly getVariants: {
|
|
12
|
+
readonly name: "get_variants";
|
|
13
|
+
readonly description: "Returns the available variants for a component, with descriptions and guidance about when to use each.";
|
|
14
|
+
};
|
|
15
|
+
readonly getTokens: {
|
|
16
|
+
readonly name: "get_tokens";
|
|
17
|
+
readonly description: "Returns the design tokens a component consumes plus the configurable token-backed props and their allowed values.";
|
|
18
|
+
};
|
|
19
|
+
readonly suggestForIntent: {
|
|
20
|
+
readonly name: "suggest_for_intent";
|
|
21
|
+
readonly description: "Given a natural-language description of what the author wants to accomplish, returns ranked component recommendations with reasoning. Optionally accepts the existing page context so duplicate Heroes / composition conflicts surface as warnings on the suggestions.";
|
|
22
|
+
};
|
|
23
|
+
readonly validateComposition: {
|
|
24
|
+
readonly name: "validate_composition";
|
|
25
|
+
readonly description: "Validates a proposed page layout against the design system's composition rules. Returns errors (blocking publish) and warnings (advisory). Call this before recommending a final layout.";
|
|
26
|
+
};
|
|
27
|
+
readonly findAntiPattern: {
|
|
28
|
+
readonly name: "find_anti_pattern";
|
|
29
|
+
readonly description: "Scans a proposed composition for known design anti-patterns (multiple Heroes, Hero at the bottom of a page, etc.). Returns matches with explanation and suggested alternatives. Use before publishing to surface editorial issues.";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/** Every tool this server contributes, for the collector. */
|
|
33
|
+
export declare const COMPONENTS_TOOL_DESCRIPTORS: readonly McpToolDescriptor[];
|
|
34
|
+
//# sourceMappingURL=descriptors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../src/tools/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAYnE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCyB,CAAA;AAEtD,6DAA6D;AAC7D,eAAO,MAAM,2BAA2B,EAAE,SAAS,iBAAiB,EACnC,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This server's tools, by name and description, knowable without a Payload.
|
|
3
|
+
|
|
4
|
+
`@payloadcms/plugin-mcp` reads exactly these two fields while the host's config
|
|
5
|
+
is being built, to generate one per-key checkbox per tool, and denies any tool it
|
|
6
|
+
has no checkbox for. The handlers close over the manifest loader and the matcher,
|
|
7
|
+
which are built at `onInit` — the names never needed to wait for them.
|
|
8
|
+
|
|
9
|
+
The factories below spread these, so the two cannot drift.
|
|
10
|
+
*/
|
|
11
|
+
export const COMPONENTS_TOOLS = {
|
|
12
|
+
listComponents: {
|
|
13
|
+
name: 'list_components',
|
|
14
|
+
description: 'Returns the list of components available in the design system. Use this to discover what components exist before composing content.',
|
|
15
|
+
},
|
|
16
|
+
getContract: {
|
|
17
|
+
name: 'get_contract',
|
|
18
|
+
description: 'Returns the full contract for a named component, including intent, composition rules, content fields, variants, tokens, accessibility requirements, examples, and anti-examples.',
|
|
19
|
+
},
|
|
20
|
+
getVariants: {
|
|
21
|
+
name: 'get_variants',
|
|
22
|
+
description: 'Returns the available variants for a component, with descriptions and guidance about when to use each.',
|
|
23
|
+
},
|
|
24
|
+
getTokens: {
|
|
25
|
+
name: 'get_tokens',
|
|
26
|
+
description: 'Returns the design tokens a component consumes plus the configurable token-backed props and their allowed values.',
|
|
27
|
+
},
|
|
28
|
+
suggestForIntent: {
|
|
29
|
+
name: 'suggest_for_intent',
|
|
30
|
+
description: 'Given a natural-language description of what the author wants to accomplish, returns ranked component recommendations with reasoning. Optionally accepts the existing page context so duplicate Heroes / composition conflicts surface as warnings on the suggestions.',
|
|
31
|
+
},
|
|
32
|
+
validateComposition: {
|
|
33
|
+
name: 'validate_composition',
|
|
34
|
+
description: "Validates a proposed page layout against the design system's composition rules. Returns errors (blocking publish) and warnings (advisory). Call this before recommending a final layout.",
|
|
35
|
+
},
|
|
36
|
+
findAntiPattern: {
|
|
37
|
+
name: 'find_anti_pattern',
|
|
38
|
+
description: 'Scans a proposed composition for known design anti-patterns (multiple Heroes, Hero at the bottom of a page, etc.). Returns matches with explanation and suggested alternatives. Use before publishing to surface editorial issues.',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
/** Every tool this server contributes, for the collector. */
|
|
42
|
+
export const COMPONENTS_TOOL_DESCRIPTORS = Object.values(COMPONENTS_TOOLS);
|
|
43
|
+
//# sourceMappingURL=descriptors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../src/tools/descriptors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;EASE;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,cAAc,EAAE;QACd,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,qIAAqI;KACxI;IACD,WAAW,EAAE;QACX,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,kLAAkL;KACrL;IACD,WAAW,EAAE;QACX,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,wGAAwG;KAC3G;IACD,SAAS,EAAE;QACT,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,mHAAmH;KACtH;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,wQAAwQ;KAC3Q;IACD,mBAAmB,EAAE;QACnB,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EACT,0LAA0L;KAC7L;IACD,eAAe,EAAE;QACf,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,oOAAoO;KACvO;CACmD,CAAA;AAEtD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,2BAA2B,GACtC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-anti-pattern.d.ts","sourceRoot":"","sources":["../../src/tools/find-anti-pattern.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"find-anti-pattern.d.ts","sourceRoot":"","sources":["../../src/tools/find-anti-pattern.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAI3D,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,cAAc,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,GAAG,iBAAiB,CA6BtF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { auditContext, withMeta } from '@forumone/throughline-core';
|
|
3
3
|
import { findAntiPatterns } from '../validation/composition.js';
|
|
4
|
+
import { COMPONENTS_TOOLS } from './descriptors.js';
|
|
4
5
|
export function createFindAntiPatternTool(deps) {
|
|
5
6
|
const inputSchema = withMeta({
|
|
6
7
|
blocks: z
|
|
@@ -11,8 +12,7 @@ export function createFindAntiPatternTool(deps) {
|
|
|
11
12
|
.min(1),
|
|
12
13
|
});
|
|
13
14
|
return {
|
|
14
|
-
|
|
15
|
-
description: "Scans a proposed composition for known design anti-patterns (multiple Heroes, Hero at the bottom of a page, etc.). Returns matches with explanation and suggested alternatives. Use before publishing to surface editorial issues.",
|
|
15
|
+
...COMPONENTS_TOOLS.findAntiPattern,
|
|
16
16
|
inputSchema,
|
|
17
17
|
handler: async (input, ctx) => {
|
|
18
18
|
const manifest = await deps.loader.get();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-anti-pattern.js","sourceRoot":"","sources":["../../src/tools/find-anti-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"find-anti-pattern.js","sourceRoot":"","sources":["../../src/tools/find-anti-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAOnD,MAAM,UAAU,yBAAyB,CAAC,IAAyB;IACjE,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,MAAM,EAAE,CAAC;aACN,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC/B,CAAC,CACH;aACA,GAAG,CAAC,CAAC,CAAC;KACV,CAAC,CAAA;IAEF,OAAO;QACL,GAAG,gBAAgB,CAAC,eAAe;QACnC,WAAW;QACX,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;YACxC,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAA;YAEpE,MAAM,IAAI,CAAC,WAAW,CAAC;gBACrB,GAAG,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC;gBACjC,MAAM,EAAE,0BAA0B;gBAClC,SAAS,EAAE,WAAW;gBACtB,OAAO,EAAE,mBAAmB;aAC7B,CAAC,CAAA;YAEF,OAAO,EAAE,OAAO,EAAE,CAAA;QACpB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-contract.d.ts","sourceRoot":"","sources":["../../src/tools/get-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"get-contract.d.ts","sourceRoot":"","sources":["../../src/tools/get-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAe/E"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { COMPONENTS_TOOLS } from './descriptors.js';
|
|
2
3
|
export function createGetContractTool(loader) {
|
|
3
4
|
return {
|
|
4
|
-
|
|
5
|
-
description: 'Returns the full contract for a named component, including intent, composition rules, content fields, variants, tokens, accessibility requirements, examples, and anti-examples.',
|
|
5
|
+
...COMPONENTS_TOOLS.getContract,
|
|
6
6
|
inputSchema: z.object({
|
|
7
7
|
name: z.string().describe('The PascalCase name of the component'),
|
|
8
8
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-contract.js","sourceRoot":"","sources":["../../src/tools/get-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"get-contract.js","sourceRoot":"","sources":["../../src/tools/get-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAEnD,MAAM,UAAU,qBAAqB,CAAC,MAAsB;IAC1D,OAAO;QACL,GAAG,gBAAgB,CAAC,WAAW;QAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;SAClE,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAA;YACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,EAAE,KAAK,EAAE,cAAc,KAAK,CAAC,IAAI,kCAAkC,EAAE,CAAA;YAC9E,CAAC;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-tokens.d.ts","sourceRoot":"","sources":["../../src/tools/get-tokens.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"get-tokens.d.ts","sourceRoot":"","sources":["../../src/tools/get-tokens.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAe7E"}
|
package/dist/tools/get-tokens.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { COMPONENTS_TOOLS } from './descriptors.js';
|
|
2
3
|
export function createGetTokensTool(loader) {
|
|
3
4
|
return {
|
|
4
|
-
|
|
5
|
-
description: 'Returns the design tokens a component consumes plus the configurable token-backed props and their allowed values.',
|
|
5
|
+
...COMPONENTS_TOOLS.getTokens,
|
|
6
6
|
inputSchema: z.object({
|
|
7
7
|
name: z.string().describe('The PascalCase name of the component'),
|
|
8
8
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-tokens.js","sourceRoot":"","sources":["../../src/tools/get-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"get-tokens.js","sourceRoot":"","sources":["../../src/tools/get-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAEnD,MAAM,UAAU,mBAAmB,CAAC,MAAsB;IACxD,OAAO;QACL,GAAG,gBAAgB,CAAC,SAAS;QAC7B,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;SAClE,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAA;YACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,EAAE,KAAK,EAAE,cAAc,KAAK,CAAC,IAAI,aAAa,EAAE,CAAA;YACzD,CAAC;YACD,OAAO,QAAQ,CAAC,MAAM,CAAA;QACxB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-variants.d.ts","sourceRoot":"","sources":["../../src/tools/get-variants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"get-variants.d.ts","sourceRoot":"","sources":["../../src/tools/get-variants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAe/E"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { COMPONENTS_TOOLS } from './descriptors.js';
|
|
2
3
|
export function createGetVariantsTool(loader) {
|
|
3
4
|
return {
|
|
4
|
-
|
|
5
|
-
description: 'Returns the available variants for a component, with descriptions and guidance about when to use each.',
|
|
5
|
+
...COMPONENTS_TOOLS.getVariants,
|
|
6
6
|
inputSchema: z.object({
|
|
7
7
|
name: z.string().describe('The PascalCase name of the component'),
|
|
8
8
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-variants.js","sourceRoot":"","sources":["../../src/tools/get-variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"get-variants.js","sourceRoot":"","sources":["../../src/tools/get-variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAEnD,MAAM,UAAU,qBAAqB,CAAC,MAAsB;IAC1D,OAAO;QACL,GAAG,gBAAgB,CAAC,WAAW;QAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;SAClE,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAA;YACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,EAAE,KAAK,EAAE,cAAc,KAAK,CAAC,IAAI,aAAa,EAAE,CAAA;YACzD,CAAC;YACD,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAA;QACtD,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,6BAA6B,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,6BAA6B,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAA"}
|
package/dist/tools/index.js
CHANGED
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,0BAA0B,GAE3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,6BAA6B,GAE9B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,yBAAyB,GAE1B,MAAM,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,0BAA0B,GAE3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,6BAA6B,GAE9B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,yBAAyB,GAE1B,MAAM,wBAAwB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-components.d.ts","sourceRoot":"","sources":["../../src/tools/list-components.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"list-components.d.ts","sourceRoot":"","sources":["../../src/tools/list-components.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAqBlF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { COMPONENTS_TOOLS } from './descriptors.js';
|
|
2
3
|
export function createListComponentsTool(loader) {
|
|
3
4
|
return {
|
|
4
|
-
|
|
5
|
-
description: 'Returns the list of components available in the design system. Use this to discover what components exist before composing content.',
|
|
5
|
+
...COMPONENTS_TOOLS.listComponents,
|
|
6
6
|
inputSchema: z.object({
|
|
7
7
|
category: z
|
|
8
8
|
.string()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-components.js","sourceRoot":"","sources":["../../src/tools/list-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"list-components.js","sourceRoot":"","sources":["../../src/tools/list-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAEnD,MAAM,UAAU,wBAAwB,CAAC,MAAsB;IAC7D,OAAO;QACL,GAAG,gBAAgB,CAAC,cAAc;QAClC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,CAAC;iBACR,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,0GAA0G,CAAC;SACxH,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAA;YACnC,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ;gBAC/B,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC;gBACzC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;YAC1C,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC5B,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBACpB,WAAW,EAAE,CAAC,CAAC,WAAW;aAC3B,CAAC,CAAC,CAAA;QACL,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-for-intent.d.ts","sourceRoot":"","sources":["../../src/tools/suggest-for-intent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AAErF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAoB,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"suggest-for-intent.d.ts","sourceRoot":"","sources":["../../src/tools/suggest-for-intent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AAErF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAoB,MAAM,sBAAsB,CAAA;AAIrE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,cAAc,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,WAAW,CAAA;IACxB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,oBAAoB,GAAG,iBAAiB,CA8DxF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { auditContext, withMeta } from '@forumone/throughline-core';
|
|
3
3
|
import { validateComposition } from '../validation/composition.js';
|
|
4
|
+
import { COMPONENTS_TOOLS } from './descriptors.js';
|
|
4
5
|
export function createSuggestForIntentTool(deps) {
|
|
5
6
|
const inputSchema = withMeta({
|
|
6
7
|
intent: z
|
|
@@ -21,8 +22,7 @@ export function createSuggestForIntentTool(deps) {
|
|
|
21
22
|
.optional(),
|
|
22
23
|
});
|
|
23
24
|
return {
|
|
24
|
-
|
|
25
|
-
description: "Given a natural-language description of what the author wants to accomplish, returns ranked component recommendations with reasoning. Optionally accepts the existing page context so duplicate Heroes / composition conflicts surface as warnings on the suggestions.",
|
|
25
|
+
...COMPONENTS_TOOLS.suggestForIntent,
|
|
26
26
|
inputSchema,
|
|
27
27
|
handler: async (input, ctx) => {
|
|
28
28
|
const manifest = await deps.loader.get();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-for-intent.js","sourceRoot":"","sources":["../../src/tools/suggest-for-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAIrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"suggest-for-intent.js","sourceRoot":"","sources":["../../src/tools/suggest-for-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAIrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AASnD,MAAM,UAAU,0BAA0B,CAAC,IAA0B;IACnE,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,MAAM,EAAE,CAAC;aACN,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,qFAAqF,CAAC;QAClG,OAAO,EAAE,CAAC;aACP,MAAM,CAAC;YACN,cAAc,EAAE,CAAC;iBACd,KAAK,CAAC,CAAC,CAAC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AE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,eAAe,CACtB,SAA4B,EAC5B,KAAa,EACb,QAAkB;IAElB,MAAM,UAAU,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAA;IACpG,MAAM,IAAI,GAAG,GAAG,SAAS,CAAC,IAAI,KAAK,UAAU,KAAK,SAAS,CAAC,WAAW,EAAE,CAAA;IACzE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACtC,OAAO,GAAG,IAAI,UAAU,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;AAC9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-composition.d.ts","sourceRoot":"","sources":["../../src/tools/validate-composition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"validate-composition.d.ts","sourceRoot":"","sources":["../../src/tools/validate-composition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAI3D,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,cAAc,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,uBAAuB,GAAG,iBAAiB,CA6B9F"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { auditContext, withMeta } from '@forumone/throughline-core';
|
|
3
3
|
import { validateComposition } from '../validation/composition.js';
|
|
4
|
+
import { COMPONENTS_TOOLS } from './descriptors.js';
|
|
4
5
|
export function createValidateCompositionTool(deps) {
|
|
5
6
|
const inputSchema = withMeta({
|
|
6
7
|
blocks: z
|
|
@@ -11,8 +12,7 @@ export function createValidateCompositionTool(deps) {
|
|
|
11
12
|
.min(1),
|
|
12
13
|
});
|
|
13
14
|
return {
|
|
14
|
-
|
|
15
|
-
description: "Validates a proposed page layout against the design system's composition rules. Returns errors (blocking publish) and warnings (advisory). Call this before recommending a final layout.",
|
|
15
|
+
...COMPONENTS_TOOLS.validateComposition,
|
|
16
16
|
inputSchema,
|
|
17
17
|
handler: async (input, ctx) => {
|
|
18
18
|
const manifest = await deps.loader.get();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-composition.js","sourceRoot":"","sources":["../../src/tools/validate-composition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"validate-composition.js","sourceRoot":"","sources":["../../src/tools/validate-composition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAOnD,MAAM,UAAU,6BAA6B,CAAC,IAA6B;IACzE,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,MAAM,EAAE,CAAC;aACN,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC/B,CAAC,CACH;aACA,GAAG,CAAC,CAAC,CAAC;KACV,CAAC,CAAA;IAEF,OAAO;QACL,GAAG,gBAAgB,CAAC,mBAAmB;QACvC,WAAW;QACX,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;YACxC,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAA;YAEtE,MAAM,IAAI,CAAC,WAAW,CAAC;gBACrB,GAAG,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC;gBACjC,MAAM,EAAE,iBAAiB;gBACzB,SAAS,EAAE,WAAW;gBACtB,OAAO,EAAE,sBAAsB;aAChC,CAAC,CAAA;YAEF,OAAO,MAAM,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forumone/throughline-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "MCP server that exposes a design system manifest as conversational primitives for Throughline.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"zod": "^3.23.0",
|
|
43
|
-
"@forumone/throughline-core": "0.
|
|
43
|
+
"@forumone/throughline-core": "0.8.0",
|
|
44
44
|
"@forumone/throughline-design-contract": "0.3.0",
|
|
45
45
|
"@forumone/throughline-plugin-contract": "0.4.0"
|
|
46
46
|
},
|