@xtyle/core 0.7.0 → 0.7.1

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.
Files changed (48) hide show
  1. package/README.md +28 -4
  2. package/dist/algorithms/factory.d.ts +24 -11
  3. package/dist/algorithms/factory.d.ts.map +1 -1
  4. package/dist/algorithms/factory.js +55 -22
  5. package/dist/algorithms/factory.js.map +1 -1
  6. package/dist/baked.d.ts +14 -1
  7. package/dist/baked.d.ts.map +1 -1
  8. package/dist/baked.js +17 -0
  9. package/dist/baked.js.map +1 -1
  10. package/dist/batteries.js +11 -2
  11. package/dist/cli.js +55 -28
  12. package/dist/cli.js.map +1 -1
  13. package/dist/elements/qr.js +0 -0
  14. package/dist/elements/qr.js.map +1 -1
  15. package/dist/host/algorithms-bundle.generated.d.ts.map +1 -1
  16. package/dist/host/algorithms-bundle.generated.js +1 -1
  17. package/dist/host/algorithms-bundle.generated.js.map +1 -1
  18. package/dist/host/authoring-prelude.generated.d.ts +1 -1
  19. package/dist/host/authoring-prelude.generated.d.ts.map +1 -1
  20. package/dist/host/authoring-prelude.generated.js +1 -1
  21. package/dist/host/authoring-prelude.generated.js.map +1 -1
  22. package/dist/host/index.d.ts.map +1 -1
  23. package/dist/host/index.js +11 -3
  24. package/dist/host/index.js.map +1 -1
  25. package/dist/host/registry.d.ts +34 -7
  26. package/dist/host/registry.d.ts.map +1 -1
  27. package/dist/host/registry.js +45 -11
  28. package/dist/host/registry.js.map +1 -1
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/knobs.d.ts +22 -0
  34. package/dist/knobs.d.ts.map +1 -0
  35. package/dist/knobs.js +63 -0
  36. package/dist/knobs.js.map +1 -0
  37. package/dist/mcp/tools.d.ts +7 -0
  38. package/dist/mcp/tools.d.ts.map +1 -1
  39. package/dist/mcp/tools.js +65 -29
  40. package/dist/mcp/tools.js.map +1 -1
  41. package/dist/theme-file.d.ts +8 -0
  42. package/dist/theme-file.d.ts.map +1 -1
  43. package/dist/theme-file.js +10 -0
  44. package/dist/theme-file.js.map +1 -1
  45. package/dist/types.d.ts +46 -12
  46. package/dist/types.d.ts.map +1 -1
  47. package/manifest.json +25 -2
  48. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"authoring-prelude.generated.js","sourceRoot":"","sources":["../../src/host/authoring-prelude.generated.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,2zgNAA2zgN,CAAC"}
1
+ {"version":3,"file":"authoring-prelude.generated.js","sourceRoot":"","sources":["../../src/host/authoring-prelude.generated.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,2yiNAA2yiN,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,SAAS,EAaT,MAAM,aAAa,CAAC;AAuCrB,MAAM,WAAW,oBAAoB;IACpC;mFAC+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAChE,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAuBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAAwB,GAC/B,OAAO,CAAC,SAAS,CAAC,CAGpB;AAeD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAClC,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,oBAAyB,GAChC,OAAO,CAAC,SAAS,CAAC,CAoFpB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,SAAS,EAaT,MAAM,aAAa,CAAC;AAuCrB,MAAM,WAAW,oBAAoB;IACpC;mFAC+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAChE,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAuBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAAwB,GAC/B,OAAO,CAAC,SAAS,CAAC,CAGpB;AAeD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAClC,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,oBAAyB,GAChC,OAAO,CAAC,SAAS,CAAC,CA+FpB"}
@@ -92,6 +92,12 @@ export async function loadAlgorithm(modManifest, source, options = {}) {
92
92
  fragmentSources: { [entryScriptKey(modManifest)]: source },
93
93
  });
94
94
  const manifest = rt.invokeExport("manifest", []);
95
+ // The invariant list is *sized* from this number, so an absent one yields a zero-length list: the mod
96
+ // would load, report no invariants at all, and sail through the gauntlet having proven nothing. A mod
97
+ // that cannot say how many invariants it has does not get to be silently assumed to have none.
98
+ if (typeof manifest.invariantCount !== "number" || !Number.isInteger(manifest.invariantCount) || manifest.invariantCount < 0) {
99
+ throw new Error(`xtyle: algorithm mod's manifest() must report a non-negative integer invariantCount, got ${JSON.stringify(manifest.invariantCount)}`);
100
+ }
95
101
  const graphCache = new Map();
96
102
  const graph = (opts) => {
97
103
  const key = JSON.stringify(opts ?? {});
@@ -134,9 +140,11 @@ export async function loadAlgorithm(modManifest, source, options = {}) {
134
140
  id: modManifest.name ?? manifest.produces[0] ?? "unknown",
135
141
  produces: manifest.produces,
136
142
  knobs: manifest.knobs,
137
- // A mod built against the widened surface ships its own specs (novel knobs included); an older
138
- // or third-party mod that omits them still gets correct domains for shared knobs from the registry.
139
- knobSpecs: manifest.knobSpecs ?? resolveKnobSpecs(manifest.knobs),
143
+ // Merged, not replaced. A mod that declares specs for *some* of its knobs — the Tier-3 case this
144
+ // exists for, where an author hand-writes `manifest()` and describes only the novel knob they
145
+ // invented — would otherwise be taken at its word for the whole list and lose the domains for
146
+ // every shared knob it reads. The mod's own specs win by name; the registry fills the rest.
147
+ knobSpecs: resolveKnobSpecs(manifest.knobs, manifest.knobSpecs ?? []),
140
148
  categories: manifest.categories,
141
149
  derive: (opts = {}) => resolveGraph(graph(opts)),
142
150
  lineage: (opts = {}) => graph(opts).map(({ name, value, refs }) => refs && refs.length ? { name, value, refs } : { name, value }),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA6E,MAAM,kBAAkB,CAAC;AACxH,OAAO,YAAY,MAAM,qBAAqB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AA+B3D;;;;GAIG;AACH,SAAS,sBAAsB;IAC9B,MAAM,IAAI,KAAK,CACd,iHAAiH,CACjH,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,GAAgB,YAAwC,CAAC,MAAM,IAAI,EAAE,CAAC;AACvF,MAAM,kBAAkB,GAAG,WAAW,CAAC,UAAU,IAAI,IAAI,CAAC;AAa1D;kGACkG;AAClG,SAAS,gBAAgB,CAAC,IAAY;IACrC,OAAO;QACN,KAAK,EAAE,KAAK;QACZ,IAAI;QACJ,OAAO,EAAE,OAAO;QAChB,YAAY,EAAE,CAAC,YAAY,CAAC;QAC5B,KAAK,EAAE;YACN,MAAM,EAAE,YAAY;YACpB,MAAM,EAAE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ACV,MAAM;QACN,YAAY,EAAE,CAAC,OAAsB,EAAE,EAAe,EAAE;YACvD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACrC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;QAC9E,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -1,17 +1,44 @@
1
1
  import type { Algorithm } from "../types.js";
2
2
  /** The ids of the bundled mods the host can resolve. */
3
3
  export declare function availableAlgorithms(): string[];
4
+ /**
5
+ * The rail a *correctness harness* loads a mod under, as opposed to the production rail the host
6
+ * manifest declares.
7
+ *
8
+ * `limits.timeout_ms` (5s) is an anti-runaway rail: it exists so a mod with an infinite loop cannot
9
+ * hang the browser generator, and it must stay tight for that. But it is not a performance budget,
10
+ * and a single interpreted derivation against a hostile seed already runs ~3s — so a battery that
11
+ * sweeps hundreds of adversarial seeds through the sandbox trips the rail on the slowest of them and
12
+ * reports an interrupt that says nothing about the algorithm. The harness raises the rail for itself
13
+ * rather than every consumer paying for it: a gauntlet run is developer-supervised and bounded by the
14
+ * suite, so the runaway case it guards against is already covered by the person watching it.
15
+ */
16
+ export declare const HARNESS_TIMEOUT_MS = 60000;
17
+ export interface ResolveAlgorithmOptions {
18
+ /**
19
+ * Raise the sandbox's wall-clock rail, up to {@link HARNESS_TIMEOUT_MS}. Only a correctness harness
20
+ * should reach for this; a request above the ceiling is clamped to it rather than honored.
21
+ *
22
+ * This is a patience dial, not a confinement boundary: it governs how long the host waits before
23
+ * killing a mod that is spinning, and touches nothing else. The memory and stack limits hold, and
24
+ * the capability set a mod runs under (`color-math`, and a no-op `log`) is fixed and never
25
+ * parameterized — so a longer rail grants a mod no authority it did not already have.
26
+ */
27
+ timeoutMs?: number;
28
+ }
4
29
  /**
5
30
  * Resolves an algorithm by id to its host facade: loads the algorithm's xript mod
6
31
  * from `algorithms/<id>/`, runs it through the zero-authority sandbox, and returns
7
- * an `Algorithm`. Cached per id. This is the canonical resolution path — the whole
8
- * CLI (`derive` / `coverage` / `gauntlet`) and the site's SSR derive through it, so
9
- * the gauntlet proves the sandboxed mod that ships, not a baked copy. The baked
10
- * `getAlgorithm` registry from `@xtyle/core/algorithms` remains as the byte-identical
11
- * test oracle and as the synchronous first-paint fallback in the browser, where the
12
- * async mod load may not have completed yet.
32
+ * an `Algorithm`. Cached per id (and per rail; see {@link HARNESS_TIMEOUT_MS}). This
33
+ * is the canonical resolution path — the whole CLI (`derive` / `coverage` / `gauntlet`)
34
+ * and the site's SSR derive through it, so the gauntlet proves the sandboxed mod that
35
+ * ships, not a baked copy. The baked `getAlgorithm` registry from `@xtyle/core/algorithms`
36
+ * remains as the byte-identical test oracle and as the synchronous first-paint fallback
37
+ * in the browser, where the async mod load may not have completed yet.
13
38
  */
14
- export declare function resolveAlgorithm(id: string): Promise<Algorithm>;
39
+ export declare function resolveAlgorithm(id: string, options?: ResolveAlgorithmOptions): Promise<Algorithm>;
40
+ /** The algorithm an id-less caller derives with. One literal, rather than a `"xtyle-default"` in every consumer. */
41
+ export declare function defaultAlgorithm(): string;
15
42
  /**
16
43
  * Synchronous accessor for an already-resolved mod: returns the cached `Algorithm`
17
44
  * once `resolveAlgorithm(id)` has settled, else `null`. The hosted resolution is
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/host/registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAW7C,wDAAwD;AACxD,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAgCD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAqB/D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAE9D"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/host/registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAW7C,wDAAwD;AACxD,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAgCD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC,MAAM,WAAW,uBAAuB;IACvC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAYD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,uBAA4B,GAAG,OAAO,CAAC,SAAS,CAAC,CA4BtG;AAED,oHAAoH;AACpH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAE9D"}
@@ -41,18 +41,45 @@ function algorithmsDir() {
41
41
  }
42
42
  const cache = new Map();
43
43
  const resolved = new Map();
44
+ /**
45
+ * The rail a *correctness harness* loads a mod under, as opposed to the production rail the host
46
+ * manifest declares.
47
+ *
48
+ * `limits.timeout_ms` (5s) is an anti-runaway rail: it exists so a mod with an infinite loop cannot
49
+ * hang the browser generator, and it must stay tight for that. But it is not a performance budget,
50
+ * and a single interpreted derivation against a hostile seed already runs ~3s — so a battery that
51
+ * sweeps hundreds of adversarial seeds through the sandbox trips the rail on the slowest of them and
52
+ * reports an interrupt that says nothing about the algorithm. The harness raises the rail for itself
53
+ * rather than every consumer paying for it: a gauntlet run is developer-supervised and bounded by the
54
+ * suite, so the runaway case it guards against is already covered by the person watching it.
55
+ */
56
+ export const HARNESS_TIMEOUT_MS = 60_000;
57
+ /**
58
+ * The rail a load actually runs under. Clamped to {@link HARNESS_TIMEOUT_MS} so the ceiling is a real
59
+ * bound rather than a suggestion a doc comment makes: the anti-runaway guarantee survives whatever a
60
+ * caller asks for, and the mod cache cannot be grown without limit by varying the rail (it is part of
61
+ * the cache key, so an unbounded rail means an unbounded number of QuickJS runtimes).
62
+ */
63
+ function railFor(timeoutMs) {
64
+ return timeoutMs === undefined ? undefined : Math.min(timeoutMs, HARNESS_TIMEOUT_MS);
65
+ }
44
66
  /**
45
67
  * Resolves an algorithm by id to its host facade: loads the algorithm's xript mod
46
68
  * from `algorithms/<id>/`, runs it through the zero-authority sandbox, and returns
47
- * an `Algorithm`. Cached per id. This is the canonical resolution path — the whole
48
- * CLI (`derive` / `coverage` / `gauntlet`) and the site's SSR derive through it, so
49
- * the gauntlet proves the sandboxed mod that ships, not a baked copy. The baked
50
- * `getAlgorithm` registry from `@xtyle/core/algorithms` remains as the byte-identical
51
- * test oracle and as the synchronous first-paint fallback in the browser, where the
52
- * async mod load may not have completed yet.
69
+ * an `Algorithm`. Cached per id (and per rail; see {@link HARNESS_TIMEOUT_MS}). This
70
+ * is the canonical resolution path — the whole CLI (`derive` / `coverage` / `gauntlet`)
71
+ * and the site's SSR derive through it, so the gauntlet proves the sandboxed mod that
72
+ * ships, not a baked copy. The baked `getAlgorithm` registry from `@xtyle/core/algorithms`
73
+ * remains as the byte-identical test oracle and as the synchronous first-paint fallback
74
+ * in the browser, where the async mod load may not have completed yet.
53
75
  */
54
- export function resolveAlgorithm(id) {
55
- const cached = cache.get(id);
76
+ export function resolveAlgorithm(id, options = {}) {
77
+ const timeoutMs = railFor(options.timeoutMs);
78
+ // The rail is part of the identity of the loaded mod: a cache keyed on id alone would hand a
79
+ // harness the 5s-railed instance that a production caller warmed first, and the raise would silently
80
+ // do nothing. Keyed on the *clamped* rail, so the space is {default, harness} and no larger.
81
+ const key = timeoutMs === undefined ? id : `${id}@${timeoutMs}`;
82
+ const cached = cache.get(key);
56
83
  if (cached)
57
84
  return cached;
58
85
  const dir = MOD_DIRS[id];
@@ -62,13 +89,20 @@ export function resolveAlgorithm(id) {
62
89
  const modDir = join(algorithmsDir(), dir);
63
90
  const modManifest = JSON.parse(readFileSync(join(modDir, "mod-manifest.json"), "utf8"));
64
91
  const source = readFileSync(join(modDir, "src/mod.js"), "utf8");
65
- const loaded = loadAlgorithm(modManifest, source).then((algorithm) => {
66
- resolved.set(id, algorithm);
92
+ const loaded = loadAlgorithm(modManifest, source, { timeoutMs }).then((algorithm) => {
93
+ // `resolved` is the synchronous first-paint oracle, which wants the mod under whatever rail it
94
+ // was loaded with — the derivation is identical either way, so the default keeps its slot.
95
+ if (timeoutMs === undefined)
96
+ resolved.set(id, algorithm);
67
97
  return algorithm;
68
98
  });
69
- cache.set(id, loaded);
99
+ cache.set(key, loaded);
70
100
  return loaded;
71
101
  }
102
+ /** The algorithm an id-less caller derives with. One literal, rather than a `"xtyle-default"` in every consumer. */
103
+ export function defaultAlgorithm() {
104
+ return "xtyle-default";
105
+ }
72
106
  /**
73
107
  * Synchronous accessor for an already-resolved mod: returns the cached `Algorithm`
74
108
  * once `resolveAlgorithm(id)` has settled, else `null`. The hosted resolution is
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/host/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,QAAQ,GAA2B;IACxC,eAAe,EAAE,eAAe;IAChC,UAAU,EAAE,UAAU;IACtB,aAAa,EAAE,aAAa;IAC5B,YAAY,EAAE,YAAY;IAC1B,UAAU,EAAE,UAAU;CACtB,CAAC;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F,IAAI,SAAS,KAAK,SAAS;YAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;QACzD,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,OAAO,MAAM,CAAC;AACf,CAAC;AAED,oHAAoH;AACpH,MAAM,UAAU,gBAAgB;IAC/B,OAAO,eAAe,CAAC;AACxB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAU;IAC3C,OAAO,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;AACjC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -31,7 +31,8 @@ export type { BarSeries, BarScheme, HeatmapScheme, PieDatum, PieScheme, PieVaria
31
31
  export * from "./graph.js";
32
32
  export { emit, emitCss, emitJson, emitMonaco, emitPrism, emitTerminal, emitters, registerEmitter, } from "./emit/index.js";
33
33
  export { coverage, coverComponent, coverComponents } from "./coverage.js";
34
- export { THEME_FILE_FORMAT, THEME_FILE_VERSION, THEME_FILE_SCHEMA_URL, buildThemeFile, serializeThemeFile, isThemeFile, parseThemeFile, migrateRecipe, type ThemeFileMeta, type ThemeRecipe, type XtyleThemeFile, } from "./theme-file.js";
34
+ export { validateKnobs } from "./knobs.js";
35
+ export { THEME_FILE_FORMAT, THEME_FILE_VERSION, THEME_FILE_SCHEMA_URL, buildThemeFile, serializeThemeFile, isThemeFile, parseThemeFile, migrateRecipe, migratedTarget, type ThemeFileMeta, type ThemeRecipe, type XtyleThemeFile, } from "./theme-file.js";
35
36
  export { type Binding, type ComponentCategory, type AnatomyPart, type PropDef, type VariantDef, type SizeDef, type StateDef, type SlotDef, type ComponentExample, type ComponentManifest, type ComponentRegistry, components, getComponent, listComponents, tokensInCss, declaredPropsInCss, styleQueriedTokensInCss, styleQueryPairsInCss, consumedTokensInCss, lintManifest, lintStyleQueryDomains, lintHostControls, } from "./manifest/index.js";
36
37
  export { gauntlet } from "./gauntlet.js";
37
38
  export type { GauntletOptions, GauntletReport, GauntletFailure, } from "./gauntlet.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA4BvF,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,GAAE,aAAkB,GAAG,aAAa,CAEpF;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,GAAE,aAAkB,GAAG,WAAW,CAKxF;AAED,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1G,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAA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KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EACX,eAAe,EACf,cAAc,EACd,eAAe,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,WAAW,EACX,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -58,7 +58,8 @@ export { hoverMediaHtml } from "./markup/image.js";
58
58
  export * from "./graph.js";
59
59
  export { emit, emitCss, emitJson, emitMonaco, emitPrism, emitTerminal, emitters, registerEmitter, } from "./emit/index.js";
60
60
  export { coverage, coverComponent, coverComponents } from "./coverage.js";
61
- export { THEME_FILE_FORMAT, THEME_FILE_VERSION, THEME_FILE_SCHEMA_URL, buildThemeFile, serializeThemeFile, isThemeFile, parseThemeFile, migrateRecipe, } from "./theme-file.js";
61
+ export { validateKnobs } from "./knobs.js";
62
+ export { THEME_FILE_FORMAT, THEME_FILE_VERSION, THEME_FILE_SCHEMA_URL, buildThemeFile, serializeThemeFile, isThemeFile, parseThemeFile, migrateRecipe, migratedTarget, } from "./theme-file.js";
62
63
  export { components, getComponent, listComponents, tokensInCss, declaredPropsInCss, styleQueriedTokensInCss, styleQueryPairsInCss, consumedTokensInCss, lintManifest, lintStyleQueryDomains, lintHostControls, } from "./manifest/index.js";
63
64
  export { gauntlet } from "./gauntlet.js";
64
65
  export { makeXtyleAlgorithm, makeXtylePipelineAlgorithm, runPipeline, settlePass, registerToNodes, resolveBaseInputs, buildPassContext, DEFAULT_ANCHORS, SHARED_KNOBS, SHARED_KNOB_SPECS, resolveKnobSpecs, KEYWORD_DOMAINS, } from "./algorithms/factory.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAsB,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC;AAE5F;;;;;;;;GAQG;AACH,SAAS,iBAAiB,CAAC,IAAmB;IAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAwB,CAAC,CAAC,CAAC;IAClG,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,SAAS,CAClB,0BAA0B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YACpE,2EAA2E;YAC3E,gEAAgE;YAChE,kBAAkB,CAAC,GAAG,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACvD,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,I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AAc,EACd,aAAa,EACb,cAAc,GAId,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAYN,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAMzC,OAAO,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,WAAW,EACX,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAGf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { Algorithm, Knobs } from "./types.js";
2
+ /**
3
+ * Check a caller's knobs against the domain the algorithm declares, and coerce each value to the
4
+ * kind that domain states.
5
+ *
6
+ * Every knob reader in the derivation falls back silently on a value it does not recognize — an
7
+ * unknown `accentStrategy` resolves to the preset's own posture rather than failing — which is right
8
+ * for the *derivation* (a theme must always come out) and catastrophic for an *input surface*. Left
9
+ * unchecked, `--knob accentStrategy=duoo` exits 0 and emits a theme that is not the one asked for: a
10
+ * typo becomes a silently different design. The bench never had this problem, because its controls are
11
+ * built *from* the domain and cannot express a value outside it. A headless caller hands over a raw
12
+ * envelope, so the domain has to be enforced here instead.
13
+ *
14
+ * Coercion is driven by the declared `kind` rather than inferred from the value's shape, because
15
+ * shape-guessing is wrong in both directions: a `text` knob set to `"12"` is the *string* `"12"`, and
16
+ * a `select` set to `"false"` is the *string* `"false"`, not a number and not a boolean.
17
+ *
18
+ * Throws on the first offending knob. The caller (CLI, MCP tool) surfaces the message; the point is
19
+ * that a bad knob is loud rather than quietly absorbed.
20
+ */
21
+ export declare function validateKnobs(algorithm: Algorithm, raw: Record<string, unknown>): Knobs;
22
+ //# sourceMappingURL=knobs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knobs.d.ts","sourceRoot":"","sources":["../src/knobs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAY,KAAK,EAAE,MAAM,YAAY,CAAC;AAE7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,CAuBvF"}
package/dist/knobs.js ADDED
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Check a caller's knobs against the domain the algorithm declares, and coerce each value to the
3
+ * kind that domain states.
4
+ *
5
+ * Every knob reader in the derivation falls back silently on a value it does not recognize — an
6
+ * unknown `accentStrategy` resolves to the preset's own posture rather than failing — which is right
7
+ * for the *derivation* (a theme must always come out) and catastrophic for an *input surface*. Left
8
+ * unchecked, `--knob accentStrategy=duoo` exits 0 and emits a theme that is not the one asked for: a
9
+ * typo becomes a silently different design. The bench never had this problem, because its controls are
10
+ * built *from* the domain and cannot express a value outside it. A headless caller hands over a raw
11
+ * envelope, so the domain has to be enforced here instead.
12
+ *
13
+ * Coercion is driven by the declared `kind` rather than inferred from the value's shape, because
14
+ * shape-guessing is wrong in both directions: a `text` knob set to `"12"` is the *string* `"12"`, and
15
+ * a `select` set to `"false"` is the *string* `"false"`, not a number and not a boolean.
16
+ *
17
+ * Throws on the first offending knob. The caller (CLI, MCP tool) surfaces the message; the point is
18
+ * that a bad knob is loud rather than quietly absorbed.
19
+ */
20
+ export function validateKnobs(algorithm, raw) {
21
+ const specs = new Map(algorithm.knobSpecs.map((spec) => [spec.name, spec]));
22
+ const out = {};
23
+ for (const [name, value] of Object.entries(raw)) {
24
+ if (value === undefined)
25
+ continue;
26
+ if (!algorithm.knobs.includes(name)) {
27
+ throw new Error(`xtyle: "${algorithm.id}" has no knob "${name}" (has: ${algorithm.knobs.join(", ")})`);
28
+ }
29
+ const spec = specs.get(name);
30
+ // A knob with no scalar domain is a composite group the consumer assembles itself (font stacks,
31
+ // anchor pickers). Its value is a structured object, so there is nothing here to coerce or bound.
32
+ if (!spec || spec.kind === "composite") {
33
+ out[name] = value;
34
+ continue;
35
+ }
36
+ out[name] = coerce(spec, value, algorithm.id);
37
+ }
38
+ return out;
39
+ }
40
+ function coerce(spec, value, algorithmId) {
41
+ const where = `"${algorithmId}" knob "${spec.name}"`;
42
+ if (spec.kind === "range") {
43
+ const n = typeof value === "number" ? value : Number(String(value).trim());
44
+ if (!Number.isFinite(n)) {
45
+ throw new Error(`xtyle: ${where} takes a number, got "${String(value)}"`);
46
+ }
47
+ const { min, max } = spec;
48
+ if ((min !== undefined && n < min) || (max !== undefined && n > max)) {
49
+ throw new Error(`xtyle: ${where} takes ${min ?? "-∞"}..${max ?? "∞"}, got ${n}`);
50
+ }
51
+ return n;
52
+ }
53
+ if (spec.kind === "select") {
54
+ const s = String(value);
55
+ const accepted = (spec.options ?? []).map((o) => o.value);
56
+ if (accepted.length && !accepted.includes(s)) {
57
+ throw new Error(`xtyle: ${where} takes ${accepted.join(" | ")}, got "${s}"`);
58
+ }
59
+ return s;
60
+ }
61
+ return String(value);
62
+ }
63
+ //# sourceMappingURL=knobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knobs.js","sourceRoot":"","sources":["../src/knobs.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,aAAa,CAAC,SAAoB,EAAE,GAA4B;IAC/E,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5E,MAAM,GAAG,GAAU,EAAE,CAAC;IAEtB,KAAK,MAAM,CAAC,IAAI,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C;QAC3E,CAAC;QACD,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;YACtE,MAAM,IAAI,KAAK,CAAC,UAAU,KAAK,UAAU,GAAG,IAAI,IAAI,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,OAAO,CAAC,CAAC;IACV,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QACxB,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC1D,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,UAAU,KAAK,UAAU,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC9E,CAAC;QACD,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC"}
@@ -1,4 +1,11 @@
1
+ import { z } from "zod";
1
2
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
3
  import type { ServerBuildInfo } from "./server.js";
4
+ /**
5
+ * The emit formats a tool accepts, built from the engine's own emitter set rather than a second copy
6
+ * of it — so a newly-added emitter can't be advertised by `xtyle_list_algorithms` and then rejected
7
+ * by `xtyle_derive`. `emitters()` is a runtime list, so the tuple `z.enum` wants is asserted here.
8
+ */
9
+ export declare const formatInput: z.ZodEnum<[string, ...string[]]>;
3
10
  export declare function registerTools(server: McpServer, buildInfo: ServerBuildInfo): void;
4
11
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAuBnD,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI,CA+LjF"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAazE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAkCnD;;;;GAIG;AACH,eAAO,MAAM,WAAW,kCAAuE,CAAC;AAiBhG,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI,CAyMjF"}
package/dist/mcp/tools.js CHANGED
@@ -4,10 +4,11 @@ import { auditRegister } from "../audit.js";
4
4
  import { emit, emitters } from "../emit/index.js";
5
5
  import { coverage, coverComponent, coverComponents } from "../coverage.js";
6
6
  import { gauntlet, GAUNTLET_DEPTH_RUNS, resolveDepth } from "../gauntlet.js";
7
- import { availableAlgorithms, resolveAlgorithm } from "../host/registry.js";
7
+ import { availableAlgorithms, defaultAlgorithm, resolveAlgorithm, HARNESS_TIMEOUT_MS } from "../host/registry.js";
8
8
  import { listComponents, getComponent } from "../manifest/registry.js";
9
- import { buildThemeFile, serializeThemeFile } from "../theme-file.js";
10
- import { bakedAlgorithm } from "../baked.js";
9
+ import { buildThemeFile, migratedTarget, serializeThemeFile } from "../theme-file.js";
10
+ import { validateKnobs } from "../knobs.js";
11
+ import { algorithmDomains, bakedAlgorithm } from "../baked.js";
11
12
  import { constraintsFrom } from "../constraints.js";
12
13
  function text(value, isError = false) {
13
14
  return { content: [{ type: "text", text: value }], isError };
@@ -15,6 +16,33 @@ function text(value, isError = false) {
15
16
  function json(value, isError = false) {
16
17
  return text(JSON.stringify(value, null, 2), isError);
17
18
  }
19
+ /**
20
+ * The `knobs` input every deriving tool takes — an algorithm's own dials (`accentStrategy`,
21
+ * `surfaceRamp`, a novel knob a third-party algorithm declares). Values stay loosely typed because
22
+ * the *domain* is the algorithm's to state, not this schema's: `xtyle_list_algorithms` returns each
23
+ * algorithm's `knobSpecs`, which is where an agent learns what a knob accepts.
24
+ */
25
+ const knobsInput = z
26
+ .record(z.string(), z.union([z.string(), z.number(), z.boolean()]))
27
+ .optional()
28
+ .describe('Algorithm knobs, e.g. { "accentStrategy": "duo" } or { "surfaceRamp": -0.05 }. Call xtyle_list_algorithms for each algorithm\'s knobSpecs (the accepted names, kinds, and ranges).');
29
+ /**
30
+ * The emit formats a tool accepts, built from the engine's own emitter set rather than a second copy
31
+ * of it — so a newly-added emitter can't be advertised by `xtyle_list_algorithms` and then rejected
32
+ * by `xtyle_derive`. `emitters()` is a runtime list, so the tuple `z.enum` wants is asserted here.
33
+ */
34
+ export const formatInput = z.enum([...emitters(), "theme"]);
35
+ /**
36
+ * The resolved algorithm a tool derives with, and the knobs it derives under: the id through
37
+ * {@link migratedTarget}, then the caller's knobs checked against the domain that algorithm declares.
38
+ * Every tool resolves through here rather than off a raw id — and an agent that invents a knob name or
39
+ * a value outside the domain gets told so, instead of a theme that quietly isn't the one it asked for.
40
+ */
41
+ async function resolveTarget(algorithm, knobs) {
42
+ const migrated = migratedTarget(algorithm ?? defaultAlgorithm(), knobs ?? {});
43
+ const resolved = await resolveAlgorithm(migrated.algorithm);
44
+ return { id: migrated.algorithm, algorithm: resolved, knobs: validateKnobs(resolved, migrated.knobs) };
45
+ }
18
46
  export function registerTools(server, buildInfo) {
19
47
  const register = server.registerTool.bind(server);
20
48
  register("xtyle_server_info", {
@@ -23,33 +51,37 @@ export function registerTools(server, buildInfo) {
23
51
  inputSchema: {},
24
52
  }, async () => json({ ...buildInfo, runtime: `node ${process.version}` }));
25
53
  register("xtyle_list_algorithms", {
26
- title: "List algorithms and emit formats",
27
- description: "List the algorithm ids that derive a theme and the emit formats the engine can serialize a register into.",
54
+ title: "List algorithms, their knobs, and emit formats",
55
+ description: "List the algorithms that derive a theme — each with the `knobs` it reads and the `knobSpecs` declaring what those knobs accept (kind, range, options, default) — plus the emit formats the engine can serialize a register into. Read this before passing `knobs` to any other tool: the algorithm owns its knob domain, so this is the only place the accepted values are stated. `accentStrategy` is the one that reshapes the accent family (`fan` / `step` / `shade` / `duo`); a novel knob a third-party algorithm declares shows up here the same way a blessed one does.",
28
56
  inputSchema: {},
29
- }, async () => json({ algorithms: availableAlgorithms(), formats: [...emitters(), "theme"] }));
57
+ }, async () => {
58
+ const algorithms = await algorithmDomains(availableAlgorithms());
59
+ return json({ algorithms, formats: [...emitters(), "theme"] });
60
+ });
30
61
  register("xtyle_derive", {
31
62
  title: "Derive a theme",
32
- description: "Run an algorithm over a set of constraints and emit the resulting token register. Pass seed colors as `bg`/`fg`/`accent`, or pin any token directly via `overrides`. The algorithm runs through xript's sandbox, the canonical derivation path.",
63
+ description: "Run an algorithm over a set of constraints and emit the resulting token register. Pass seed colors as `bg`/`fg`/`accent`, turn the algorithm's own dials via `knobs` (the casual path — `accentStrategy: \"duo\"` for a two-brand theme), or pin any token directly via `overrides` (the escape hatch). Reach for `knobs` before `overrides`: hand-pinning `--accent-2/3/4` to fake an accent family is what `accentStrategy` exists to spare you. The algorithm runs through xript's sandbox, the canonical derivation path.",
33
64
  inputSchema: {
34
65
  algorithm: z.string().optional().describe("Algorithm id. Defaults to xtyle-default. Use xtyle_list_algorithms to see the set."),
35
66
  bg: z.string().optional().describe("Background seed color, the `--bg-0` constraint (any CSS color)."),
36
67
  fg: z.string().optional().describe("Foreground seed color, the `--fg-0` constraint."),
37
68
  accent: z.string().optional().describe("Accent seed color, the `--accent` constraint."),
69
+ knobs: knobsInput,
38
70
  overrides: z.record(z.string(), z.string()).optional().describe("Pin any token directly, e.g. { \"--radius-md\": \"6px\" }. Merged under the seed colors."),
39
- format: z.enum(["css", "json", "theme", "prism", "monaco"]).optional().describe("Emit format. Defaults to css."),
71
+ format: formatInput.optional().describe("Emit format. Defaults to css."),
40
72
  name: z.string().optional().describe("Theme name, used only by the `theme` format."),
41
73
  },
42
- }, async ({ algorithm, bg, fg, accent, overrides, format, name }) => {
43
- const id = algorithm ?? "xtyle-default";
74
+ }, async ({ algorithm, bg, fg, accent, knobs, overrides, format, name }) => {
44
75
  try {
45
- const resolved = await resolveAlgorithm(id);
76
+ const target = await resolveTarget(algorithm, knobs);
77
+ const resolved = target.algorithm;
46
78
  const constraints = constraintsFrom({ bg, fg, accent, overrides });
47
- const register = derive(resolved, { constraints });
79
+ const register = derive(resolved, { constraints, knobs: target.knobs });
48
80
  const fmt = format ?? "css";
49
81
  if (fmt === "theme") {
50
82
  return text(serializeThemeFile(buildThemeFile({
51
- meta: { name: name ?? `${id} theme`, generator: "@xtyle/core" },
52
- recipe: { algorithm: id, overrides: constraints },
83
+ meta: { name: name ?? `${target.id} theme`, generator: "@xtyle/core" },
84
+ recipe: { algorithm: target.id, knobs: target.knobs, overrides: constraints },
53
85
  register,
54
86
  })));
55
87
  }
@@ -67,25 +99,26 @@ export function registerTools(server, buildInfo) {
67
99
  bg: z.string().optional().describe("Background seed color."),
68
100
  fg: z.string().optional().describe("Foreground seed color."),
69
101
  accent: z.string().optional().describe("Accent seed color."),
102
+ knobs: knobsInput,
70
103
  overrides: z.record(z.string(), z.string()).optional().describe("Pin tokens directly before checking."),
71
104
  component: z.string().optional().describe("A component id to check against its declared consumedTokens."),
72
105
  consumed: z.array(z.string()).optional().describe("An explicit list of token names to check."),
73
106
  },
74
- }, async ({ algorithm, bg, fg, accent, overrides, component, consumed }) => {
75
- const id = algorithm ?? "xtyle-default";
107
+ }, async ({ algorithm, bg, fg, accent, knobs, overrides, component, consumed }) => {
76
108
  try {
77
- const resolved = await resolveAlgorithm(id);
78
- const register = derive(resolved, { constraints: constraintsFrom({ bg, fg, accent, overrides }) });
109
+ const target = await resolveTarget(algorithm, knobs);
110
+ const resolved = target.algorithm;
111
+ const register = derive(resolved, { constraints: constraintsFrom({ bg, fg, accent, overrides }), knobs: target.knobs });
79
112
  if (component) {
80
113
  const manifest = getComponent(component);
81
114
  if (!manifest)
82
115
  return text(`unknown component: ${component}`, true);
83
- return json({ algorithm: id, component, ...coverComponent(manifest, register) });
116
+ return json({ algorithm: target.id, component, ...coverComponent(manifest, register) });
84
117
  }
85
118
  if (consumed)
86
- return json({ algorithm: id, ...coverage(consumed, register) });
119
+ return json({ algorithm: target.id, ...coverage(consumed, register) });
87
120
  const all = coverComponents(register);
88
- return json({ algorithm: id, covered: all.every((c) => c.covered), components: all });
121
+ return json({ algorithm: target.id, covered: all.every((c) => c.covered), components: all });
89
122
  }
90
123
  catch (error) {
91
124
  return text(error instanceof Error ? error.message : String(error), true);
@@ -124,15 +157,17 @@ export function registerTools(server, buildInfo) {
124
157
  runs: z.number().int().positive().optional().describe("Explicit run count, overriding depth."),
125
158
  },
126
159
  }, async ({ algorithm, mode, depth, runs }) => {
127
- const id = algorithm ?? "xtyle-default";
160
+ const id = algorithm ?? defaultAlgorithm();
128
161
  const resolvedDepth = resolveDepth(depth);
129
162
  const runCount = runs ?? GAUNTLET_DEPTH_RUNS[resolvedDepth];
130
163
  const resolvedMode = mode ?? "baked";
131
164
  try {
132
- const ids = id === "all" ? availableAlgorithms() : [id];
165
+ const ids = id === "all" ? availableAlgorithms() : [migratedTarget(id).algorithm];
133
166
  const reports = [];
134
167
  for (const algId of ids) {
135
- const resolved = resolvedMode === "hosted" ? await resolveAlgorithm(algId) : await bakedAlgorithm(algId);
168
+ const resolved = resolvedMode === "hosted"
169
+ ? await resolveAlgorithm(algId, { timeoutMs: HARNESS_TIMEOUT_MS })
170
+ : await bakedAlgorithm(algId);
136
171
  reports.push({ ...gauntlet(resolved, { runs: runCount }), algorithm: algId });
137
172
  }
138
173
  const ok = reports.every((r) => r.ok);
@@ -150,17 +185,18 @@ export function registerTools(server, buildInfo) {
150
185
  bg: z.string().optional().describe("Background seed color."),
151
186
  fg: z.string().optional().describe("Foreground seed color."),
152
187
  accent: z.string().optional().describe("Accent seed color."),
188
+ knobs: knobsInput,
153
189
  overrides: z.record(z.string(), z.string()).optional().describe("Pin tokens directly before auditing."),
154
190
  level: z.enum(["AA", "AAA"]).optional().describe("The floor a pair must clear to pass. Defaults to AA."),
155
191
  largeText: z.boolean().optional().describe("Grade against the large-text WCAG floors (AA 3.0 / AAA 4.5)."),
156
192
  },
157
- }, async ({ algorithm, bg, fg, accent, overrides, level, largeText }) => {
158
- const id = algorithm ?? "xtyle-default";
193
+ }, async ({ algorithm, bg, fg, accent, knobs, overrides, level, largeText }) => {
159
194
  try {
160
- const resolved = await resolveAlgorithm(id);
161
- const register = derive(resolved, { constraints: constraintsFrom({ bg, fg, accent, overrides }) });
195
+ const target = await resolveTarget(algorithm, knobs);
196
+ const resolved = target.algorithm;
197
+ const register = derive(resolved, { constraints: constraintsFrom({ bg, fg, accent, overrides }), knobs: target.knobs });
162
198
  const result = auditRegister(register, { level, largeText });
163
- return json({ algorithm: id, ...result }, !result.passes);
199
+ return json({ algorithm: target.id, ...result }, !result.passes);
164
200
  }
165
201
  catch (error) {
166
202
  return text(error instanceof Error ? error.message : String(error), true);