@ikijs/mcp 0.8.1 → 0.10.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/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createIkiMcpServer
4
- } from "./chunk-LIWK4PQV.mjs";
4
+ } from "./chunk-OCIICRUA.mjs";
5
5
 
6
6
  // src/cli.ts
7
7
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { TurnTargets, TurnSolveReport } from '@ikijs/editor';
1
+ import { TurnTargets, IrisStrand, TurnSolveReport } from '@ikijs/editor';
2
2
  export { TurnSolveReport } from '@ikijs/editor';
3
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
 
@@ -115,9 +115,25 @@ type AutoRigResult = {
115
115
  x: number;
116
116
  }[];
117
117
  };
118
- /** What the turn solve settled on — the cues the rig reaches and the
119
- * defaulted targets it had to cut down. Absent for a layer set with no
120
- * nose, which solves no turn at all. */
118
+ /** Each side's iris and the `hair_front` run it would slide under on
119
+ * the turn, as pixel edges on the row holding that iris's centre, in
120
+ * model coordinates (`IrisStrand`: canvas x minus half the canvas
121
+ * width) — measured whenever the layer set has `hair_front`, `iris_L`
122
+ * and `iris_R`, and passed to the generator as `options.strandEdges`.
123
+ * A run narrower than half that iris's painted width on the row is
124
+ * hair detail, not a strand, and is skipped as if clear. A side is
125
+ * absent only when its iris has no opaque pixel on that row, or when no
126
+ * run it keeps covers the pixel on that side of the iris's centre or
127
+ * lies outward of it; the whole field only when neither side has one. */
128
+ strandEdges?: {
129
+ left?: IrisStrand;
130
+ right?: IrisStrand;
131
+ };
132
+ /** What the turn solve settled on — the cues the rig reaches, the
133
+ * targets it had to cut down (`clamped`) and, per side whose far iris
134
+ * the bangs' run still covers at some far stop, how much of it
135
+ * (`strandOverlap`). Absent for a layer set with no nose, which solves
136
+ * no turn at all. */
121
137
  turn?: TurnSolveReport;
122
138
  } | {
123
139
  ok: false;
@@ -134,7 +150,11 @@ type AutoRigResult = {
134
150
  * `turn`. The face layer alone also gets its per-row painted half-widths
135
151
  * (`LayerInput.rowHalfWidths`), which bend the face plate on a row-dependent
136
152
  * radius: the generator reads no other role's, so measuring any other layer's
137
- * would only hand it bytes it discards.
153
+ * would only hand it bytes it discards. Each iris's opaque span and the bangs'
154
+ * run it would slide under are measured on the iris's own centre row too
155
+ * (`strandEdges`), so the turn keeps the far iris from sliding under the bangs
156
+ * any further than it is painted; a run narrower than half the iris there is
157
+ * hair detail the iris may cross, and is skipped.
138
158
  *
139
159
  * Re-host of examples/editor/src/store.ts `importLayerSet` with the three DOM
140
160
  * pixel functions swapped for the sharp-backed ./node-images helpers; the pure
@@ -360,6 +380,13 @@ interface ComposeInput {
360
380
  */
361
381
  outDir: string;
362
382
  layout?: LayoutOverride;
383
+ /**
384
+ * Part files to flip left-right as they are read, e.g. `["eyewhite.png"]`
385
+ * for an eye drawn facing the other way. It flips the SOURCE, so every role
386
+ * cut from it flips together — the eye pair's sclera and lash stay in one
387
+ * frame, which a per-role flag would leave to the caller to keep in sync.
388
+ */
389
+ mirrorParts?: string[];
363
390
  }
364
391
  interface ComposedLayer {
365
392
  role: Role;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TurnTargets, TurnSolveReport } from '@ikijs/editor';
1
+ import { TurnTargets, IrisStrand, TurnSolveReport } from '@ikijs/editor';
2
2
  export { TurnSolveReport } from '@ikijs/editor';
3
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
 
@@ -115,9 +115,25 @@ type AutoRigResult = {
115
115
  x: number;
116
116
  }[];
117
117
  };
118
- /** What the turn solve settled on — the cues the rig reaches and the
119
- * defaulted targets it had to cut down. Absent for a layer set with no
120
- * nose, which solves no turn at all. */
118
+ /** Each side's iris and the `hair_front` run it would slide under on
119
+ * the turn, as pixel edges on the row holding that iris's centre, in
120
+ * model coordinates (`IrisStrand`: canvas x minus half the canvas
121
+ * width) — measured whenever the layer set has `hair_front`, `iris_L`
122
+ * and `iris_R`, and passed to the generator as `options.strandEdges`.
123
+ * A run narrower than half that iris's painted width on the row is
124
+ * hair detail, not a strand, and is skipped as if clear. A side is
125
+ * absent only when its iris has no opaque pixel on that row, or when no
126
+ * run it keeps covers the pixel on that side of the iris's centre or
127
+ * lies outward of it; the whole field only when neither side has one. */
128
+ strandEdges?: {
129
+ left?: IrisStrand;
130
+ right?: IrisStrand;
131
+ };
132
+ /** What the turn solve settled on — the cues the rig reaches, the
133
+ * targets it had to cut down (`clamped`) and, per side whose far iris
134
+ * the bangs' run still covers at some far stop, how much of it
135
+ * (`strandOverlap`). Absent for a layer set with no nose, which solves
136
+ * no turn at all. */
121
137
  turn?: TurnSolveReport;
122
138
  } | {
123
139
  ok: false;
@@ -134,7 +150,11 @@ type AutoRigResult = {
134
150
  * `turn`. The face layer alone also gets its per-row painted half-widths
135
151
  * (`LayerInput.rowHalfWidths`), which bend the face plate on a row-dependent
136
152
  * radius: the generator reads no other role's, so measuring any other layer's
137
- * would only hand it bytes it discards.
153
+ * would only hand it bytes it discards. Each iris's opaque span and the bangs'
154
+ * run it would slide under are measured on the iris's own centre row too
155
+ * (`strandEdges`), so the turn keeps the far iris from sliding under the bangs
156
+ * any further than it is painted; a run narrower than half the iris there is
157
+ * hair detail the iris may cross, and is skipped.
138
158
  *
139
159
  * Re-host of examples/editor/src/store.ts `importLayerSet` with the three DOM
140
160
  * pixel functions swapped for the sharp-backed ./node-images helpers; the pure
@@ -360,6 +380,13 @@ interface ComposeInput {
360
380
  */
361
381
  outDir: string;
362
382
  layout?: LayoutOverride;
383
+ /**
384
+ * Part files to flip left-right as they are read, e.g. `["eyewhite.png"]`
385
+ * for an eye drawn facing the other way. It flips the SOURCE, so every role
386
+ * cut from it flips together — the eye pair's sclera and lash stay in one
387
+ * frame, which a per-role flag would leave to the caller to keep in sync.
388
+ */
389
+ mirrorParts?: string[];
363
390
  }
364
391
  interface ComposedLayer {
365
392
  role: Role;
package/dist/index.js CHANGED
@@ -790,6 +790,7 @@ function facePlateHalfOf(layers) {
790
790
  }
791
791
  return face.cropW / 2;
792
792
  }
793
+ var STRAND_MIN_RUN_FRACTION = 0.5;
793
794
  async function autoRigFromLayers(input) {
794
795
  try {
795
796
  const layers = input.layers;
@@ -826,6 +827,7 @@ async function autoRigFromLayers(input) {
826
827
  const layerInputs = [];
827
828
  const crops = [];
828
829
  const rowSpansByRole = [];
830
+ let hairFrontMask;
829
831
  for (let i = 0; i < resolvedLayers.length; i++) {
830
832
  const { resolved, fileName } = resolvedLayers[i];
831
833
  const png = await decodePng(resolved);
@@ -870,16 +872,19 @@ async function autoRigFromLayers(input) {
870
872
  const buffer = await cropToBuffer(png.rgba, png.width, png.height, bbox);
871
873
  const rowLeft = new Int32Array(canvasH).fill(canvasW);
872
874
  const rowRight = new Int32Array(canvasH).fill(-1);
875
+ const ownMask = role === "hair_front" ? new Uint8Array(canvasW * canvasH) : void 0;
873
876
  for (let y = 0; y < canvasH; y++) {
874
877
  for (let x = 0; x < canvasW; x++) {
875
878
  const p = y * canvasW + x;
876
879
  if (png.rgba[p * 4 + 3] < ALPHA_OPAQUE) continue;
877
880
  opaque[p] = 1;
881
+ if (ownMask !== void 0) ownMask[p] = 1;
878
882
  if (x < rowLeft[y]) rowLeft[y] = x;
879
883
  if (x > rowRight[y]) rowRight[y] = x;
880
884
  }
881
885
  }
882
886
  rowSpansByRole.push({ role, rowLeft, rowRight });
887
+ if (ownMask !== void 0) hairFrontMask = ownMask;
883
888
  const layer = {
884
889
  role,
885
890
  fileName,
@@ -925,6 +930,63 @@ async function autoRigFromLayers(input) {
925
930
  }
926
931
  headEdges = { left, right };
927
932
  }
933
+ let strandEdges;
934
+ const irisLayers = layerInputs.filter((l) => l.role === "iris_L" || l.role === "iris_R").sort((a, b) => a.bbox.x + a.bbox.w / 2 - (b.bbox.x + b.bbox.w / 2));
935
+ if (hairFrontMask !== void 0 && irisLayers.length === 2) {
936
+ const mask = hairFrontMask;
937
+ const half = canvasW / 2;
938
+ const strandOn = (iris, other, side) => {
939
+ const r = Math.floor(iris.bbox.y + iris.bbox.h / 2);
940
+ const centre = iris.bbox.x + iris.bbox.w / 2;
941
+ const otherX = other.bbox.x + other.bbox.w / 2 - half;
942
+ const c = side < 0 ? Math.ceil(centre) - 1 : Math.floor(centre);
943
+ const span2 = rowSpansByRole.find((s) => s.role === iris.role);
944
+ if (span2.rowRight[r] < span2.rowLeft[r]) return void 0;
945
+ const minRun = STRAND_MIN_RUN_FRACTION * (span2.rowRight[r] + 1 - span2.rowLeft[r]);
946
+ const strand = new Uint8Array(canvasW);
947
+ for (let a = 0; a < canvasW; ) {
948
+ if (mask[r * canvasW + a] !== 1) {
949
+ a++;
950
+ continue;
951
+ }
952
+ let b = a;
953
+ while (b < canvasW && mask[r * canvasW + b] === 1) b++;
954
+ if (b - a >= minRun) strand.fill(1, a, b);
955
+ a = b;
956
+ }
957
+ const strandAt = (x2) => x2 >= 0 && x2 < canvasW && strand[x2] === 1;
958
+ const outerBoundary = (x2) => (side < 0 ? x2 : x2 + 1) - half;
959
+ let x = c;
960
+ let runFace;
961
+ if (!strandAt(c)) {
962
+ while (x >= 0 && x < canvasW && !strandAt(x)) x += side;
963
+ if (x < 0 || x >= canvasW) return void 0;
964
+ runFace = outerBoundary(x - side);
965
+ } else {
966
+ let f = c - side;
967
+ while (strandAt(f)) f -= side;
968
+ const face = outerBoundary(f);
969
+ runFace = side * (face - otherX) > 0 ? face : null;
970
+ }
971
+ while (strandAt(x)) x += side;
972
+ return {
973
+ y: canvasH / 2 - (r + 0.5),
974
+ irisOuter: (side < 0 ? span2.rowLeft[r] : span2.rowRight[r] + 1) - half,
975
+ irisInner: (side < 0 ? span2.rowRight[r] + 1 : span2.rowLeft[r]) - half,
976
+ runOuter: outerBoundary(x - side),
977
+ runFace
978
+ };
979
+ };
980
+ const [low, high] = irisLayers;
981
+ const left = strandOn(low, high, -1);
982
+ const right = strandOn(high, low, 1);
983
+ if (left !== void 0 || right !== void 0) {
984
+ strandEdges = {
985
+ ...left === void 0 ? {} : { left },
986
+ ...right === void 0 ? {} : { right }
987
+ };
988
+ }
989
+ }
928
990
  let turn;
929
991
  let model;
930
992
  try {
@@ -944,7 +1006,8 @@ async function autoRigFromLayers(input) {
944
1006
  onTurnSolved: (report) => {
945
1007
  turn = report;
946
1008
  },
947
- ...headEdges === void 0 ? {} : { headEdges }
1009
+ ...headEdges === void 0 ? {} : { headEdges },
1010
+ ...strandEdges === void 0 ? {} : { strandEdges }
948
1011
  }
949
1012
  );
950
1013
  } catch (e) {
@@ -991,6 +1054,7 @@ async function autoRigFromLayers(input) {
991
1054
  ...headHalfWidth === void 0 ? {} : { headHalfWidth },
992
1055
  headHalfWidthApplied,
993
1056
  ...headEdges === void 0 ? {} : { headEdges },
1057
+ ...strandEdges === void 0 ? {} : { strandEdges },
994
1058
  ...turn === void 0 ? {} : { turn }
995
1059
  };
996
1060
  } catch (err) {
@@ -1014,7 +1078,8 @@ var EYE_ASPECT_MIN = 0.5;
1014
1078
  var IRIS_OFFSET_MAX_X = 3;
1015
1079
  var IRIS_OFFSET_MAX_Y = 10;
1016
1080
  var EDGE_SOLID_MAX = 0.5;
1017
- var LASH_CENTRE_TOL_FRAC = 0.03;
1081
+ var LASH_STRAY_TOL_FRAC = 0.02;
1082
+ var EYE_FACING_TOL_FRAC = 0.02;
1018
1083
  var EDGE_RUN_MIN_PX = 40;
1019
1084
  var FLAT_CUT_MAX_FRAC = 0.1;
1020
1085
  var FLAT_CUT_MIN_PX = 40;
@@ -1095,6 +1160,21 @@ async function layerStats(filePath) {
1095
1160
  };
1096
1161
  }
1097
1162
  var pct = (v) => `${(v * 100).toFixed(0)}%`;
1163
+ async function lashOffSclera(eyePath, lashPath) {
1164
+ const eye = await decodePng(eyePath);
1165
+ const lash = await decodePng(lashPath);
1166
+ let opaque = 0;
1167
+ let off = 0;
1168
+ for (let y = 0; y < lash.height; y++) {
1169
+ for (let x = 0; x < lash.width; x++) {
1170
+ if (lash.rgba[(y * lash.width + x) * 4 + 3] < 128) continue;
1171
+ opaque++;
1172
+ const onEye = x < eye.width && y < eye.height;
1173
+ if (!onEye || eye.rgba[(y * eye.width + x) * 4 + 3] <= 8) off++;
1174
+ }
1175
+ }
1176
+ return { opaque, off };
1177
+ }
1098
1178
  async function measureDir(absDir) {
1099
1179
  const files = import_node_fs2.default.readdirSync(absDir).filter((f) => f.endsWith(".png") && f !== "preview.png").sort();
1100
1180
  if (files.length === 0) {
@@ -1176,12 +1256,28 @@ async function measureDir(absDir) {
1176
1256
  }
1177
1257
  }
1178
1258
  if (lash) {
1179
- const dx = lash.bboxCx - eye.bboxCx;
1259
+ const { opaque, off } = await lashOffSclera(
1260
+ import_node_path4.default.join(absDir, `eye_${side}.png`),
1261
+ import_node_path4.default.join(absDir, `lash_${side}.png`)
1262
+ );
1180
1263
  const dTop = lash.marginTop - eye.marginTop;
1181
- if (Math.abs(dx) > eye.w * LASH_CENTRE_TOL_FRAC || Math.abs(dTop) > 0.5) {
1264
+ const faults = [
1265
+ ...off > opaque * LASH_STRAY_TOL_FRAC ? [`${off} of its ${opaque} opaque px lie off eye_${side}'s sclera`] : [],
1266
+ ...Math.abs(dTop) > 0.5 ? [`its top edge is ${dTop.toFixed(1)} px off the sclera's`] : []
1267
+ ];
1268
+ if (faults.length > 0) {
1182
1269
  warnings.push(
1183
- `lash_${side}: centre is ${dx.toFixed(1)} px and top edge ${dTop.toFixed(1)} px off eye_${side}. They are split from one source and MUST share cx/cy/w in layout, or the blink fold tears. Retune to match.`
1270
+ `lash_${side}: ${faults.join(" and ")} \u2014 they are split from one source and MUST share cx/cy/w/h in layout, or the blink fold tears. Retune to match.`
1184
1271
  );
1272
+ } else {
1273
+ const bareLeft = lash.marginLeft - eye.marginLeft;
1274
+ const bareRight = lash.marginRight - eye.marginRight;
1275
+ const [bareOuter, bareInner] = side === "R" ? [bareLeft, bareRight] : [bareRight, bareLeft];
1276
+ if ((bareOuter - bareInner) / eye.w > EYE_FACING_TOL_FRAC) {
1277
+ warnings.push(
1278
+ `eye_${side}: its lash stops ${pct(bareOuter / eye.w)} of the eye width short of the outer corner and ${pct(bareInner / eye.w)} short of the nose side \u2014 the eyewhite is drawn facing the other way, lash wing at the inner corner. The composer reads eyewhite.png as the eye on the screen LEFT: lash wing at the image's left end, lash-free tear duct at its right. Free fix: compose again with mirrorParts: ["eyewhite.png"] \u2014 no regeneration.`
1279
+ );
1280
+ }
1185
1281
  }
1186
1282
  }
1187
1283
  }
@@ -1313,6 +1409,12 @@ var ORDER = [
1313
1409
  "brow_R",
1314
1410
  "hair_front"
1315
1411
  ];
1412
+ var PART_FILES = [
1413
+ ...new Set(
1414
+ Object.values(DEFAULT_LAYOUT).map((cfg) => cfg.src).filter((src) => !src.startsWith("eyewhite_"))
1415
+ ),
1416
+ EYEWHITE_SRC
1417
+ ];
1316
1418
  function resolveLayout(overrides) {
1317
1419
  const resolved = { ...DEFAULT_LAYOUT };
1318
1420
  if (overrides === void 0) return resolved;
@@ -1348,6 +1450,18 @@ function resolveLayout(overrides) {
1348
1450
  }
1349
1451
  return resolved;
1350
1452
  }
1453
+ function resolveMirrorParts(names) {
1454
+ const mirrored = /* @__PURE__ */ new Set();
1455
+ for (const [i, name] of (names ?? []).entries()) {
1456
+ if (!PART_FILES.includes(name)) {
1457
+ throw new AutoRigInputError(
1458
+ `mirrorParts[${i}]: unknown part ${JSON.stringify(name)} \u2014 expected one of ${PART_FILES.join(", ")}`
1459
+ );
1460
+ }
1461
+ mirrored.add(name);
1462
+ }
1463
+ return mirrored;
1464
+ }
1351
1465
  function keyWhiteToAlpha(rgba) {
1352
1466
  const keyed = Buffer.from(rgba);
1353
1467
  for (let i = 0; i < keyed.length; i += 4) {
@@ -1357,7 +1471,7 @@ function keyWhiteToAlpha(rgba) {
1357
1471
  }
1358
1472
  return keyed;
1359
1473
  }
1360
- async function partBuffer(role, cfg, partsDir, inMemory) {
1474
+ async function partBuffer(role, cfg, partsDir, inMemory, flipSource) {
1361
1475
  let img;
1362
1476
  if (inMemory !== void 0) {
1363
1477
  img = (0, import_sharp2.default)(inMemory);
@@ -1375,7 +1489,7 @@ async function partBuffer(role, cfg, partsDir, inMemory) {
1375
1489
  });
1376
1490
  }
1377
1491
  if (!cfg.noTrim) img = img.trim({ threshold: 12 });
1378
- if (cfg.mirror) img = img.flop();
1492
+ if ((cfg.mirror ?? false) !== flipSource) img = img.flop();
1379
1493
  const trimmed = await img.png().toBuffer({ resolveWithObject: true });
1380
1494
  if (cfg.h === void 0) {
1381
1495
  const scaledH = Math.round(
@@ -1472,28 +1586,47 @@ async function composeLayersFromParts(input) {
1472
1586
  );
1473
1587
  }
1474
1588
  const layout = resolveLayout(input.layout);
1589
+ const mirrored = resolveMirrorParts(input.mirrorParts);
1475
1590
  const split = await prepEyeSplit(partsDir);
1476
1591
  const splitSources = /* @__PURE__ */ new Map([
1477
1592
  ["eyewhite_sclera.png", split.sclera],
1478
1593
  ["eyewhite_lash.png", split.lash]
1479
1594
  ]);
1480
- const layers = [];
1595
+ const placed = [];
1481
1596
  const skipped = [];
1482
- const preview = [];
1483
1597
  for (const role of ORDER) {
1484
1598
  const cfg = layout[role];
1599
+ const inMemory = splitSources.get(cfg.src);
1485
1600
  const part = await partBuffer(
1486
1601
  role,
1487
1602
  cfg,
1488
1603
  partsDir,
1489
- splitSources.get(cfg.src)
1604
+ inMemory,
1605
+ // The split halves are cut from eyewhite.png, the file a caller names.
1606
+ mirrored.has(inMemory === void 0 ? cfg.src : EYEWHITE_SRC)
1490
1607
  );
1491
1608
  if (part === null) {
1492
1609
  skipped.push(role);
1493
- import_node_fs3.default.rmSync(import_node_path5.default.join(outDir, `${role}.png`), { force: true });
1494
1610
  continue;
1495
1611
  }
1496
1612
  const { left, top } = placement(role, cfg, part.w, part.h);
1613
+ if (role === "lash_L" || role === "lash_R") {
1614
+ const eyeRole = role === "lash_L" ? "eye_L" : "eye_R";
1615
+ const eye = placed.find((p) => p.role === eyeRole);
1616
+ if (eye !== void 0 && (eye.left !== left || eye.top !== top || eye.part.w !== part.w || eye.part.h !== part.h)) {
1617
+ throw new AutoRigInputError(
1618
+ `layout.${role} places the lash at ${part.w}x${part.h} (${left},${top}), but layout.${eyeRole} places its sclera at ${eye.part.w}x${eye.part.h} (${eye.left},${eye.top}) \u2014 they are cut from one eyewhite into one frame, and the blink fold tears where they part. Set cx/cy/w/h the same on both.`
1619
+ );
1620
+ }
1621
+ }
1622
+ placed.push({ role, part, left, top });
1623
+ }
1624
+ for (const role of skipped) {
1625
+ import_node_fs3.default.rmSync(import_node_path5.default.join(outDir, `${role}.png`), { force: true });
1626
+ }
1627
+ const layers = [];
1628
+ const preview = [];
1629
+ for (const { role, part, left, top } of placed) {
1497
1630
  const layer = await blankCanvas().composite([{ input: part.buf, left, top }]).png().toBuffer();
1498
1631
  const outPath = import_node_path5.default.join(outDir, `${role}.png`);
1499
1632
  writeFileAtomic(outPath, layer);
@@ -1536,7 +1669,7 @@ async function composeLayersFromParts(input) {
1536
1669
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
1537
1670
  var import_zod = require("zod");
1538
1671
  function createIkiMcpServer() {
1539
- const server = new import_mcp.McpServer({ name: "iki", version: "0.8.1" });
1672
+ const server = new import_mcp.McpServer({ name: "iki", version: "0.10.0" });
1540
1673
  server.registerTool(
1541
1674
  "validate_iki",
1542
1675
  {
@@ -1624,7 +1757,7 @@ function createIkiMcpServer() {
1624
1757
  noseShift: import_zod.z.number().optional(),
1625
1758
  mouthShift: import_zod.z.number().optional()
1626
1759
  }).optional().describe(
1627
- "What the head turn is fitted to, as `measure_turn_reference` reports it off a front/turned reference pair. `eyeShift` (and the optional `noseShift`/`mouthShift`, derived from it when absent) is how far that feature slides across the head at full turn, as a fraction of the head's half-width \u2014 a MAGNITUDE: the rig turns both ways, so the sign is ignored. `farEyeRatio` is the far/near eye width at full turn over that same ratio at rest, `silhouetteRatio` the head's half-width turned over at rest. The half-width the shifts are fractions of is measured off the layers themselves, so it is not an input. An omitted field falls back to a default, which is clamped to what this layer set can do (the result's `turn.clamped` lists the ones that were, `turn.achieved` what the rig reaches); a target you DO pass that this layer set cannot reach comes back as `INVALID: \u2026` naming the field and the attainable range, since it is a measurement rather than a preference."
1760
+ "What the head turn is fitted to, as `measure_turn_reference` reports it off a front/turned reference pair. `eyeShift` (and the optional `noseShift`/`mouthShift`, derived from it when absent) is how far that feature slides across the head at full turn, as a fraction of the head's half-width \u2014 a MAGNITUDE: the rig turns both ways, so the sign is ignored. `farEyeRatio` is the far/near eye width at full turn over that same ratio at rest, `silhouetteRatio` the head's half-width turned over at rest. The half-width the shifts are fractions of is measured off the layers themselves, so it is not an input. An omitted field falls back to a default, which is clamped to what this layer set can do, and so is a passed `eyeShift` past the room the art leaves the far eye \u2014 the face plate's edge, or the bangs' side strand over the far iris (the result's `turn.clamped` lists every clamped field, `turn.achieved` what the rig reaches, and `turn.strandOverlap` how much of a far iris the bangs still cover). Any other passed target this layer set cannot reach, including an `eyeShift` smaller than the slide the face's own turn already gives the eyes, comes back as `INVALID: \u2026` naming the field and the attainable range, since it is a measurement rather than a preference."
1628
1761
  )
1629
1762
  }
1630
1763
  },
@@ -1663,7 +1796,10 @@ function createIkiMcpServer() {
1663
1796
  h: import_zod.z.number()
1664
1797
  }).partial()
1665
1798
  ).optional().describe(
1666
- "Per-role override merged over the built-in defaults, keyed by role \u2014 hair_back, body, face, nose, mouth, mouth_open, eye_L, eye_R, iris_L, iris_R, lash_L, lash_R, brow_L, brow_R, hair_front \u2014 e.g. `{ eye_L: { cx: 660 } }`. `w` and `h` are integers in 1..1100; omit `h` to keep the part's own aspect, set it to stretch (set it on a sclera and its lash together, or the blink fold tears)."
1799
+ "Per-role override merged over the built-in defaults, keyed by role \u2014 hair_back, body, face, nose, mouth, mouth_open, eye_L, eye_R, iris_L, iris_R, lash_L, lash_R, brow_L, brow_R, hair_front \u2014 e.g. `{ eye_L: { cx: 660 } }`. `w` and `h` are integers in 1..1100; omit `h` to keep the part's own aspect, set it to stretch. eye_L/lash_L and eye_R/lash_R are cut from one eyewhite into one frame, so each pair must land on the same frame \u2014 a pair set to land apart is rejected."
1800
+ ),
1801
+ mirrorParts: import_zod.z.array(import_zod.z.string()).optional().describe(
1802
+ "Part files to flip left-right as they are read, e.g. `[\"eyewhite.png\"]`. The composer reads eyewhite.png as the eye on the screen LEFT (lash wing at the image's left end, lash-free tear duct at its right) and brow.png as the brow on the screen RIGHT (thick head at the image's left end, tail at its right); a part drawn the other way round is fixed here for free. It flips the source, so every role cut from it flips together and an eye's sclera and lash stay in one frame."
1667
1803
  )
1668
1804
  }
1669
1805
  },