@ikijs/mcp 0.22.0 → 0.23.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.
package/dist/cli.js CHANGED
@@ -438,7 +438,9 @@ function expectInput(label, fn) {
438
438
  var LOSSLESS_PAGE_ROLE = "nose";
439
439
  async function renderAtlasPage(crops, quantizeColors) {
440
440
  const layout = (0, import_editor2.packAtlas)(
441
- crops.map((c) => ({ id: c.id, width: c.width, height: c.height }))
441
+ crops.map((c) => ({ id: c.id, width: c.width, height: c.height })),
442
+ void 0,
443
+ MAX_ATLAS_SIDE
442
444
  );
443
445
  const over = layout.pageWidth > MAX_ATLAS_SIDE ? { side: "width", crop: "widest" } : layout.pageHeight > MAX_ATLAS_SIDE ? { side: "height", crop: "tallest" } : void 0;
444
446
  if (over !== void 0) {
@@ -1333,10 +1335,15 @@ async function splitLipSet(keyedPng, w, h, interior) {
1333
1335
  const gw = holeW + 2;
1334
1336
  const gh = hb.y1 - hb.y0 + 3;
1335
1337
  const { data: fitted } = await (0, import_sharp2.default)(interior.png).resize(gw, gh, { fit: "fill" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
1336
- const faintUpper = (p, x, y) => y < bot[x] && label[p] === main2 && 2 * y < top[x] + bot[x];
1338
+ const hole = (q) => label[q] === main2;
1339
+ const upperHalf = (x, y) => 2 * y < top[x] + bot[x];
1340
+ const faintUpper = (p, x, y) => y < bot[x] && hole(p) && upperHalf(x, y);
1341
+ const besideHole = (p, x, y) => x > 0 && hole(p - 1) || x < w - 1 && hole(p + 1) || y > 0 && hole(p - w) || y < h - 1 && hole(p + w);
1337
1342
  const upper = Buffer.alloc(n * 4);
1338
1343
  const lower = Buffer.alloc(n * 4);
1339
1344
  const inner = Buffer.alloc(n * 4);
1345
+ const tongue = Buffer.alloc(n * 4);
1346
+ const teeth = Buffer.alloc(n * 4);
1340
1347
  const copy = (to, p) => frame.copy(to, p * 4, p * 4, p * 4 + 4);
1341
1348
  for (let y = 0; y < h; y++) {
1342
1349
  for (let x = 0; x < w; x++) {
@@ -1345,7 +1352,14 @@ async function splitLipSet(keyedPng, w, h, interior) {
1345
1352
  if ((!inOpening || y < top[x] || faintUpper(p, x, y)) && !(wall[x] && grown[p]))
1346
1353
  copy(upper, p);
1347
1354
  if (inOpening && skinRow[x] >= 0 && y >= skinRow[x]) copy(lower, p);
1348
- if (!grown[p]) continue;
1355
+ if (!grown[p]) {
1356
+ const a = alpha(p);
1357
+ if (a >= import_editor6.ALPHA_OPAQUE && a < 255 && besideHole(p, x, y)) {
1358
+ inner.set(interior.cavity, p * 4);
1359
+ inner[p * 4 + 3] = 255 - a;
1360
+ }
1361
+ continue;
1362
+ }
1349
1363
  const out = [...interior.cavity];
1350
1364
  const ix = x - gx;
1351
1365
  const iy = y - gy;
@@ -1362,6 +1376,11 @@ async function splitLipSet(keyedPng, w, h, interior) {
1362
1376
  inner[p * 4 + 1] = Math.round(out[1]);
1363
1377
  inner[p * 4 + 2] = Math.round(out[2]);
1364
1378
  inner[p * 4 + 3] = 255;
1379
+ if (hole(p) && luma(inner, p * 4) >= CAVITY_LUMA) {
1380
+ const to = upperHalf(x, y) ? teeth : tongue;
1381
+ inner.copy(to, p * 4, p * 4, p * 4 + 4);
1382
+ inner.set(interior.cavity, p * 4);
1383
+ }
1365
1384
  }
1366
1385
  }
1367
1386
  const opening = assertFoldContract(
@@ -1369,12 +1388,17 @@ async function splitLipSet(keyedPng, w, h, interior) {
1369
1388
  w,
1370
1389
  h
1371
1390
  );
1372
- const [innerPng, lowerPng, upperPng] = await Promise.all([
1373
- encode(inner, w, h),
1374
- encode(lower, w, h),
1375
- encode(upper, w, h)
1376
- ]);
1377
- return { inner: innerPng, lower: lowerPng, upper: upperPng, opening };
1391
+ const [innerPng, lowerPng, upperPng, tonguePng, teethPng] = await Promise.all(
1392
+ [inner, lower, upper, tongue, teeth].map((b) => encode(b, w, h))
1393
+ );
1394
+ return {
1395
+ inner: innerPng,
1396
+ lower: lowerPng,
1397
+ upper: upperPng,
1398
+ tongue: tonguePng,
1399
+ teeth: teethPng,
1400
+ opening
1401
+ };
1378
1402
  }
1379
1403
  async function restShiftOf(layers, width, height) {
1380
1404
  const [mouth_inner, lip_lower, lip_upper] = await Promise.all(
@@ -1397,25 +1421,40 @@ async function restShiftOf(layers, width, height) {
1397
1421
  }
1398
1422
  return (0, import_editor6.mouthRestShift)(byRole);
1399
1423
  }
1400
- async function closedLips(upper, lower, shift, left) {
1424
+ async function closedLips(upper, lower, shift, left, top) {
1401
1425
  const shut = async (png, role) => {
1402
1426
  const { data, info } = await rawOf(png);
1403
1427
  const { width: w, height: h } = info;
1404
1428
  const out = Buffer.alloc(w * h * 4);
1405
1429
  for (let x = 0; x < w; x++) {
1406
- const dy = shift(role, left + x);
1407
- const f = Math.floor(dy);
1408
- const t = dy - f;
1409
1430
  const px2 = (row, c) => row < 0 || row >= h ? 0 : data[(row * w + x) * 4 + c];
1431
+ const landed = [];
1432
+ for (let row = 0; row < h; row++) {
1433
+ const dy = shift(role, left + x, top + row);
1434
+ if (dy !== void 0) landed.push([row, row + 0.5 - dy]);
1435
+ }
1436
+ if (landed.length > 1) {
1437
+ const [a, b] = landed;
1438
+ const [y, z2] = landed.slice(-2);
1439
+ landed.unshift([a[0] - 1, 2 * a[1] - b[1]]);
1440
+ landed.push([z2[0] + 1, 2 * z2[1] - y[1]]);
1441
+ }
1442
+ let i = 0;
1410
1443
  for (let to = 0; to < h; to++) {
1411
- const a0 = px2(to + f, 3);
1412
- const a1 = px2(to + f + 1, 3);
1444
+ const centre = to + 0.5;
1445
+ while (i + 1 < landed.length && landed[i + 1][1] < centre) i++;
1446
+ if (i + 1 >= landed.length || landed[i][1] > centre) continue;
1447
+ const [r0, y0] = landed[i];
1448
+ const [r1, y1] = landed[i + 1];
1449
+ const t = (centre - y0) / (y1 - y0);
1450
+ const a0 = px2(r0, 3);
1451
+ const a1 = px2(r1, 3);
1413
1452
  const a = (1 - t) * a0 + t * a1;
1414
1453
  if (a === 0) continue;
1415
1454
  const o = (to * w + x) * 4;
1416
1455
  for (let c = 0; c < 3; c++)
1417
1456
  out[o + c] = Math.round(
1418
- ((1 - t) * a0 * px2(to + f, c) + t * a1 * px2(to + f + 1, c)) / a
1457
+ ((1 - t) * a0 * px2(r0, c) + t * a1 * px2(r1, c)) / a
1419
1458
  );
1420
1459
  out[o + 3] = Math.round(a);
1421
1460
  }
@@ -1430,7 +1469,7 @@ async function closedLips(upper, lower, shift, left) {
1430
1469
  }
1431
1470
 
1432
1471
  // src/measure-lips.ts
1433
- var isLipRole = (role) => import_editor7.LIP_ROLES.includes(role);
1472
+ var isLipLayerRole = (role) => import_editor7.LIP_ROLES.includes(role) || (0, import_editor7.isLipInsideRole)(role);
1434
1473
  var MIN_OPENING_ROWS = 8;
1435
1474
  var MIN_LINE_ROWS = 2;
1436
1475
  var GREEN_EXCESS = 40;
@@ -1439,7 +1478,15 @@ var columns = (cols) => `${cols.length} column${cols.length === 1 ? "" : "s"} (f
1439
1478
  async function lipWarnings(absDir, layers) {
1440
1479
  const warnings = [];
1441
1480
  const present = import_editor7.LIP_ROLES.filter((role) => layers[role] !== void 0);
1442
- if (present.length === 0) return { warnings };
1481
+ const inside = import_editor7.LIP_INSIDE_ROLES.filter((role) => layers[role] !== void 0);
1482
+ if (present.length === 0) {
1483
+ if (inside.length > 0) {
1484
+ warnings.push(
1485
+ `${inside.join("/")}: a lip set's inside layer with no lip set \u2014 auto_rig_from_layers refuses it (it is cut from the interior and clipped to it). Recompose from mouth_keyed.png + mouth_interior.png, or remove it.`
1486
+ );
1487
+ }
1488
+ return { warnings };
1489
+ }
1443
1490
  const legacy = ["mouth", "mouth_open"].filter(
1444
1491
  (role) => layers[role] !== void 0
1445
1492
  );
@@ -1456,7 +1503,7 @@ async function lipWarnings(absDir, layers) {
1456
1503
  return { warnings };
1457
1504
  }
1458
1505
  const { mouth_inner: inner, lip_upper: upper } = layers;
1459
- for (const role of ["lip_lower", "lip_upper"]) {
1506
+ for (const role of ["lip_lower", "lip_upper", ...inside]) {
1460
1507
  const stats = layers[role];
1461
1508
  if (stats.canvasW !== inner.canvasW || stats.canvasH !== inner.canvasH) {
1462
1509
  warnings.push(
@@ -1465,6 +1512,21 @@ async function lipWarnings(absDir, layers) {
1465
1512
  return { warnings };
1466
1513
  }
1467
1514
  }
1515
+ const box = (m) => ({
1516
+ x0: m.bboxCx - m.w / 2,
1517
+ x1: m.bboxCx + m.w / 2,
1518
+ y0: m.bboxCy - m.h / 2,
1519
+ y1: m.bboxCy + m.h / 2
1520
+ });
1521
+ const cavity = box(inner);
1522
+ for (const role of inside) {
1523
+ const b = box(layers[role]);
1524
+ if (b.x0 < cavity.x0 || b.x1 > cavity.x1 || b.y0 < cavity.y0 || b.y1 > cavity.y1) {
1525
+ warnings.push(
1526
+ `${role}: its box leaves mouth_inner's \u2014 the cavity clips it away there. Recompose from mouth_keyed.png + mouth_interior.png (free).`
1527
+ );
1528
+ }
1529
+ }
1468
1530
  const measurer = (0, import_editor7.createLayerSetMeasurer)({
1469
1531
  width: inner.canvasW,
1470
1532
  height: inner.canvasH
@@ -2066,7 +2128,7 @@ async function measureDir(absDir, noseSpeck) {
2066
2128
  }
2067
2129
  const warnings = [];
2068
2130
  for (const [role, m] of Object.entries(layers)) {
2069
- if (isLipRole(role)) continue;
2131
+ if (isLipLayerRole(role)) continue;
2070
2132
  const edges = [
2071
2133
  ["top", m.edgeTop, m.w, m.marginTop],
2072
2134
  ["left", m.edgeLeft, m.h, m.marginLeft],
@@ -2096,7 +2158,7 @@ async function measureDir(absDir, noseSpeck) {
2096
2158
  }
2097
2159
  }
2098
2160
  for (const [role, m] of Object.entries(layers)) {
2099
- if (role === "body" || isLipRole(role)) continue;
2161
+ if (role === "body" || isLipLayerRole(role)) continue;
2100
2162
  if (m.flatCutRun > FLAT_CUT_MAX_FRAC * m.w && m.flatCutRun >= FLAT_CUT_MIN_PX) {
2101
2163
  warnings.push(
2102
2164
  `${role}: ${m.flatCutRun}px of straight flat edge at y=${m.flatCutY} (${pct(m.flatCutRun / m.w)} of its width) \u2014 the source art is cut through there. ` + (isArm(role) ? `It hides at rest and opens into a seam once the arm raises. ` : `It hides while the head faces front and opens into a seam on turn. `) + `Regenerate this part with the whole subject inside the frame.`
@@ -2373,10 +2435,11 @@ var DEFAULT_LAYOUT = {
2373
2435
  optional: true
2374
2436
  },
2375
2437
  // The lip set's ONE frame, mouth_open's place: the keyed mouth is split into
2376
- // mouth_inner / lip_lower / lip_upper and all three land here, so a retune
2377
- // moves them together. lip_lower and lip_upper have no key of their own
2378
- // (LIP_FRAME). OPTIONAL and opt-in: with mouth_keyed.png + mouth_interior.png
2379
- // it stands in for mouth and mouth_open.
2438
+ // mouth_inner / lip_lower / lip_upper, the interior's light paint into
2439
+ // mouth_tongue / mouth_teeth, and all of them land here, so a retune moves
2440
+ // them together. The other four have no key of their own (LIP_FRAME).
2441
+ // OPTIONAL and opt-in: with mouth_keyed.png + mouth_interior.png it stands
2442
+ // in for mouth and mouth_open.
2380
2443
  mouth_inner: {
2381
2444
  src: KEYED_SRC,
2382
2445
  cx: 550,
@@ -2431,6 +2494,8 @@ var ORDER = [
2431
2494
  "mouth",
2432
2495
  "mouth_open",
2433
2496
  "mouth_inner",
2497
+ "mouth_tongue",
2498
+ "mouth_teeth",
2434
2499
  "lip_lower",
2435
2500
  "lip_upper",
2436
2501
  "eye_L",
@@ -2933,10 +2998,19 @@ async function composeLayersFromParts(input) {
2933
2998
  });
2934
2999
  continue;
2935
3000
  }
2936
- if (role === "lip_lower" || role === "lip_upper") {
3001
+ if (role === "mouth_tongue" || role === "mouth_teeth" || role === "lip_lower" || role === "lip_upper") {
2937
3002
  if (lipSplit === void 0) continue;
2938
3003
  const { split: split2, w, h, left: left2, top: top2 } = lipSplit;
2939
- const buf = role === "lip_lower" ? split2.lower : split2.upper;
3004
+ const buf = {
3005
+ mouth_tongue: split2.tongue,
3006
+ mouth_teeth: split2.teeth,
3007
+ lip_lower: split2.lower,
3008
+ lip_upper: split2.upper
3009
+ }[role];
3010
+ if ((0, import_editor11.isLipInsideRole)(role) && !await hasCoverage(buf)) {
3011
+ skipped.push(role);
3012
+ continue;
3013
+ }
2940
3014
  placed.push({ role, part: { buf, w, h }, left: left2, top: top2 });
2941
3015
  continue;
2942
3016
  }
@@ -3103,7 +3177,8 @@ async function composeLayersFromParts(input) {
3103
3177
  canvas.width,
3104
3178
  canvas.height
3105
3179
  ),
3106
- lipSplit.left
3180
+ lipSplit.left,
3181
+ lipSplit.top
3107
3182
  );
3108
3183
  for (const role of ORDER) {
3109
3184
  if (placed.some((p) => p.role === role)) continue;
@@ -3127,7 +3202,7 @@ async function composeLayersFromParts(input) {
3127
3202
  });
3128
3203
  }
3129
3204
  const restInput = (role, buf) => {
3130
- if (role === "mouth_inner") return null;
3205
+ if (role === "mouth_inner" || (0, import_editor11.isLipInsideRole)(role)) return null;
3131
3206
  if (closed === void 0) return buf;
3132
3207
  if (role === "lip_upper") return closed.upper;
3133
3208
  if (role === "lip_lower") return closed.lower;
@@ -3196,7 +3271,7 @@ async function composeLayersFromParts(input) {
3196
3271
 
3197
3272
  // src/server.ts
3198
3273
  function createIkiMcpServer() {
3199
- const server = new import_mcp.McpServer({ name: "iki", version: "0.22.0" });
3274
+ const server = new import_mcp.McpServer({ name: "iki", version: "0.23.1" });
3200
3275
  server.registerTool(
3201
3276
  "validate_iki",
3202
3277
  {
@@ -3261,7 +3336,7 @@ function createIkiMcpServer() {
3261
3336
  server.registerTool(
3262
3337
  "auto_rig_from_layers",
3263
3338
  {
3264
- description: "Auto-rigs role-named PNG layers (face, eye_L/eye_R and either mouth or the lip set (mouth_inner + lip_lower + lip_upper, a mouth that folds open instead of crossfading) required; iris_L/R, brow_L/R, hair_front, body, arm_L/arm_R, forearm_pose_L/forearm_pose_R, etc. optional; an arm needs the body, a pose forearm needs its arm, and a partial lip set or one mixed with mouth/mouth_open is refused) into a renderable .iki written to disk. Pass full-canvas PNG file paths; returns the output path + summary (the model is NOT inlined). Filenames map to roles unless `fileName` is given.",
3339
+ description: "Auto-rigs role-named PNG layers (face, eye_L/eye_R and either mouth or the lip set (mouth_inner + lip_lower + lip_upper, a mouth that folds open instead of crossfading) required; iris_L/R, brow_L/R, hair_front, body, arm_L/arm_R, forearm_pose_L/forearm_pose_R, mouth_tongue/mouth_teeth (only with the lip set: drawn under its lips and clipped to mouth_inner), etc. optional; an arm needs the body, a pose forearm needs its arm, and a partial lip set, one mixed with mouth/mouth_open, or mouth_tongue/mouth_teeth without it is refused) into a renderable .iki written to disk. Pass full-canvas PNG file paths; returns the output path + summary (the model is NOT inlined). Filenames map to roles unless `fileName` is given.",
3265
3340
  inputSchema: {
3266
3341
  layers: import_zod.z.array(
3267
3342
  import_zod.z.object({
@@ -3316,7 +3391,7 @@ function createIkiMcpServer() {
3316
3391
  server.registerTool(
3317
3392
  "compose_layers_from_parts",
3318
3393
  {
3319
- description: "Composes AI-generated part PNGs into canvas-aligned, role-named PNG layers on disk, ready for auto_rig_from_layers (the eyewhite split, alpha-trim/white-key, and placement pipeline the character-generation skill needs), with the same geometry report measure_layers returns standalone included inline. face, eyewhite, iris, brow, hair_front are required, with mouth.png \u2014 or the lip set's mouth_keyed.png (the open mouth, its inside painted flat #00FF00) + mouth_interior.png (the cavity, teeth and tongue alone), which the composer keys and splits into mouth_inner / lip_lower / lip_upper on one frame so auto_rig_from_layers folds the mouth open like the eyelid; the two routes cannot be mixed, one keyed file without the other is refused, and a key that fails (no green, green outside the opening, an outline not closed round it, more than one opening, no skin under the opening, an interior that is only lips, or one drawn opaque on a non-white or noisy ground) is refused naming the regeneration; with the lip set neither mouth nor mouth_open is written and preview.png shows the mouth closed, as the rig draws the rest pose. hair_back, body, mouth_open (legacy route only), blush (one blush.png makes the blush_L/blush_R pair) and nose are optional \u2014 without a nose layer the head still turns on the rig's default profile, but it has no nose to lead the turn, and `auto_rig_from_layers` fits no turn to the art (`turnTargets` is inert, no `turn` report). One arm.png \u2014 the arm on the screen LEFT, drawn hanging with its shoulder at the top \u2014 makes both arms of a full body: arm_R takes it as drawn and arm_L mirrored. The arms are opt-in: without arm.png the compose is a bust's and `skipped` never lists them. arm.png needs body.png, and each arm is hung on the body's shoulder by default (see `layout`). One forearm_pose.png \u2014 the arm's forearm raised, on the screen LEFT, standing up from its elbow with the hand at the top \u2014 makes both pose forearms (forearm_pose_R as drawn, forearm_pose_L mirrored): each is scaled so its elbow end is as wide as its arm's elbow run and pinned on that arm's elbow (see `layout`), and it needs arm.png. With one, preview-pose.png shows the switch at 1 as the rig draws it (the hanging forearms hidden below the elbow, the pose forearms over everything) while preview.png stays the rest pose; without one it is removed. The inline report carries the full-body checks too: a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge, and a pose forearm without its arm or off its arm's elbow in pivot, width or length. A nose whose dense core is a speck \u2014 under a quarter of its trimmed part's width or height, such as a lone nostril mark or highlight \u2014 is sized and placed whole, and the inline report warns of it. A light mark drawn detached above the eye white, such as a double-eyelid crease, is dropped from the sclera (the iris's clip); dark strokes there stay lash ink. The eyewhite's dark lower lid \u2014 its line and lashes \u2014 becomes lash_lower_L/lash_lower_R, drawn over the iris; a white with none writes none and lists them in `skipped`.",
3394
+ description: "Composes AI-generated part PNGs into canvas-aligned, role-named PNG layers on disk, ready for auto_rig_from_layers (the eyewhite split, alpha-trim/white-key, and placement pipeline the character-generation skill needs), with the same geometry report measure_layers returns standalone included inline. face, eyewhite, iris, brow, hair_front are required, with mouth.png \u2014 or the lip set's mouth_keyed.png (the open mouth, its inside painted flat #00FF00) + mouth_interior.png (the cavity, teeth and tongue alone), which the composer keys and splits into mouth_inner / lip_lower / lip_upper on one frame so auto_rig_from_layers folds the mouth open like the eyelid, the interior's light paint (luma 100 and over) written as mouth_tongue and mouth_teeth on the same frame, riding the opening's bottom and the upper line and clipped to the cavity (listed in `skipped` when the interior has none); the two routes cannot be mixed, one keyed file without the other is refused, and a key that fails (no green, green outside the opening, an outline not closed round it, more than one opening, no skin under the opening, an interior that is only lips, or one drawn opaque on a non-white or noisy ground) is refused naming the regeneration; with the lip set neither mouth nor mouth_open is written and preview.png shows the mouth closed, as the rig draws the rest pose. hair_back, body, mouth_open (legacy route only), blush (one blush.png makes the blush_L/blush_R pair) and nose are optional \u2014 without a nose layer the head still turns on the rig's default profile, but it has no nose to lead the turn, and `auto_rig_from_layers` fits no turn to the art (`turnTargets` is inert, no `turn` report). One arm.png \u2014 the arm on the screen LEFT, drawn hanging with its shoulder at the top \u2014 makes both arms of a full body: arm_R takes it as drawn and arm_L mirrored. The arms are opt-in: without arm.png the compose is a bust's and `skipped` never lists them. arm.png needs body.png, and each arm is hung on the body's shoulder by default (see `layout`). One forearm_pose.png \u2014 the arm's forearm raised, on the screen LEFT, standing up from its elbow with the hand at the top \u2014 makes both pose forearms (forearm_pose_R as drawn, forearm_pose_L mirrored): each is scaled so its elbow end is as wide as its arm's elbow run and pinned on that arm's elbow (see `layout`), and it needs arm.png. With one, preview-pose.png shows the switch at 1 as the rig draws it (the hanging forearms hidden below the elbow, the pose forearms over everything) while preview.png stays the rest pose; without one it is removed. The inline report carries the full-body checks too: a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge, and a pose forearm without its arm or off its arm's elbow in pivot, width or length. A nose whose dense core is a speck \u2014 under a quarter of its trimmed part's width or height, such as a lone nostril mark or highlight \u2014 is sized and placed whole, and the inline report warns of it. A light mark drawn detached above the eye white, such as a double-eyelid crease, is dropped from the sclera (the iris's clip); dark strokes there stay lash ink. The eyewhite's dark lower lid \u2014 its line and lashes \u2014 becomes lash_lower_L/lash_lower_R, drawn over the iris; a white with none writes none and lists them in `skipped`.",
3320
3395
  inputSchema: {
3321
3396
  partsDir: import_zod.z.string().describe(
3322
3397
  "Directory of the source part PNGs (resolved against cwd)."
@@ -3333,7 +3408,7 @@ function createIkiMcpServer() {
3333
3408
  h: import_zod.z.number()
3334
3409
  }).partial()
3335
3410
  ).optional().describe(
3336
- "Per-role override merged over the built-in defaults, keyed by role \u2014 hair_back, body, arm_L, arm_R, face, blush_L, blush_R, nose, mouth, mouth_open, mouth_inner, eye_L, eye_R, iris_L, iris_R, lash_L, lash_R, brow_L, brow_R, hair_front, forearm_pose_L, forearm_pose_R \u2014 e.g. `{ eye_L: { cx: 660 } }`. `w` is an integer in 1..1100 (the canvas width) and `h` in 1..canvasHeight; omit `h` to keep the part's own aspect, set it to stretch. The defaults of the face's features \u2014 blush, nose, mouth, mouth_open, mouth_inner, eyes, irises, lashes, brows \u2014 are proportions of the face: an override of face.cx, face.cy or face.w carries them with it (scaled by the width; face.h stretches the face alone), while a feature's own override names canvas px. The nose is sized and placed by its dense core (its pixels at alpha >= 128, the drawing inside a soft nose's feather), not its whole part: `w`/`h` size the core, `cx` centres it, and a set `cy` centres its rows. A nose whose core is a speck \u2014 under a quarter of the trimmed part's width or height, such as a lone nostril mark or highlight \u2014 is sized and placed whole instead, and the report warns of it. Its `cy` defaults to unset, which lands the core's bottom row (the tip) 0.66 of the way from the eye row down to the mouth's, so the nose follows a retuned eye or mouth row. 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. lash_lower_L/lash_lower_R are cut from it too and have no key: they land on their eye's frame. mouth_inner is the lip set's one frame (mouth_open's place by default; lip_lower and lip_upper have no key and land on it, so a retune moves the three together), and with the lip set the nose's tip rule reads layout.mouth_inner.cy. arm_L/arm_R have no cx/cy/w defaults: an unset `w` is 0.4 of the placed body's width, and an unset `cx` or `cy` hangs the arm's shoulder pivot \u2014 the one auto_rig_from_layers turns it about \u2014 on the body box's shoulder corner on that axis: its left edge for arm_R, its right edge for arm_L, 0.12 of its height under its top. A set one centres the arm as for every other role. forearm_pose_L/forearm_pose_R have no cx/cy/w defaults either: an unset `w` scales the forearm so its elbow end (the shoulder rule run from its bottom) is as wide as the placed arm's elbow run, and an unset `cx` or `cy` pins that elbow end's pivot on the arm's elbow \u2014 the one auto_rig_from_layers hangs it from."
3411
+ "Per-role override merged over the built-in defaults, keyed by role \u2014 hair_back, body, arm_L, arm_R, face, blush_L, blush_R, nose, mouth, mouth_open, mouth_inner, eye_L, eye_R, iris_L, iris_R, lash_L, lash_R, brow_L, brow_R, hair_front, forearm_pose_L, forearm_pose_R \u2014 e.g. `{ eye_L: { cx: 660 } }`. `w` is an integer in 1..1100 (the canvas width) and `h` in 1..canvasHeight; omit `h` to keep the part's own aspect, set it to stretch. The defaults of the face's features \u2014 blush, nose, mouth, mouth_open, mouth_inner, eyes, irises, lashes, brows \u2014 are proportions of the face: an override of face.cx, face.cy or face.w carries them with it (scaled by the width; face.h stretches the face alone), while a feature's own override names canvas px. The nose is sized and placed by its dense core (its pixels at alpha >= 128, the drawing inside a soft nose's feather), not its whole part: `w`/`h` size the core, `cx` centres it, and a set `cy` centres its rows. A nose whose core is a speck \u2014 under a quarter of the trimmed part's width or height, such as a lone nostril mark or highlight \u2014 is sized and placed whole instead, and the report warns of it. Its `cy` defaults to unset, which lands the core's bottom row (the tip) 0.66 of the way from the eye row down to the mouth's, so the nose follows a retuned eye or mouth row. 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. lash_lower_L/lash_lower_R are cut from it too and have no key: they land on their eye's frame. mouth_inner is the lip set's one frame (mouth_open's place by default; lip_lower, lip_upper, mouth_tongue and mouth_teeth have no key and land on it, so a retune moves them together), and with the lip set the nose's tip rule reads layout.mouth_inner.cy. arm_L/arm_R have no cx/cy/w defaults: an unset `w` is 0.4 of the placed body's width, and an unset `cx` or `cy` hangs the arm's shoulder pivot \u2014 the one auto_rig_from_layers turns it about \u2014 on the body box's shoulder corner on that axis: its left edge for arm_R, its right edge for arm_L, 0.12 of its height under its top. A set one centres the arm as for every other role. forearm_pose_L/forearm_pose_R have no cx/cy/w defaults either: an unset `w` scales the forearm so its elbow end (the shoulder rule run from its bottom) is as wide as the placed arm's elbow run, and an unset `cx` or `cy` pins that elbow end's pivot on the arm's elbow \u2014 the one auto_rig_from_layers hangs it from."
3337
3412
  ),
3338
3413
  mirrorParts: import_zod.z.array(import_zod.z.string()).optional().describe(
3339
3414
  "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), brow.png as the brow on the screen RIGHT (thick head at the image's left end, tail at its right), blush.png as the blush on the screen LEFT (outer end, toward the face's edge, at the image's left end, inner end at its right), arm.png as the arm on the screen LEFT (the character's right, hanging, its shoulder at the image's top), and forearm_pose.png as the raised forearm on the screen LEFT (standing up from its elbow, the hand at the image's top, the thumb toward the body at the image's 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."
@@ -3364,7 +3439,7 @@ function createIkiMcpServer() {
3364
3439
  server.registerTool(
3365
3440
  "measure_layers",
3366
3441
  {
3367
- description: "Reports read-only geometry checks over an already-composed layers directory \u2014 the same checks compose_layers_from_parts returns inline (iris ratio/offset, eye aspect, cropped/cut edges, a nose whose dense core is a speck of its crop, missing optional roles, a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge on its shoulder pivot's row, a pose forearm without its arm or whose elbow end is off its arm's elbow in pivot, width or length, and the lip set: a partial one or one beside mouth/mouth_open, the fold's contract per column of the opening, an opening too narrow or short, a line too thin, green left, an interior with holes \u2014 with the opening's size and the MouthOpen below which no slit shows). Every preview*.png is skipped. Use to re-check a layers dir without recomposing. Its nose check reads the composed file against its crop, which is what auto_rig_from_layers acts on. Compose's inline report does the same unless the composer found the source part's core a speck, which it reports instead \u2014 so a speck that resampling erased from the layer shows there and not here.",
3442
+ description: "Reports read-only geometry checks over an already-composed layers directory \u2014 the same checks compose_layers_from_parts returns inline (iris ratio/offset, eye aspect, cropped/cut edges, a nose whose dense core is a speck of its crop, missing optional roles, a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge on its shoulder pivot's row, a pose forearm without its arm or whose elbow end is off its arm's elbow in pivot, width or length, and the lip set: a partial one or one beside mouth/mouth_open, the fold's contract per column of the opening, an opening too narrow or short, a line too thin, green left, an interior with holes, and of mouth_tongue/mouth_teeth: one with no lip set, one on another canvas, one whose box leaves mouth_inner's \u2014 with the opening's size and the MouthOpen below which no slit shows). Every preview*.png is skipped. Use to re-check a layers dir without recomposing. Its nose check reads the composed file against its crop, which is what auto_rig_from_layers acts on. Compose's inline report does the same unless the composer found the source part's core a speck, which it reports instead \u2014 so a speck that resampling erased from the layer shows there and not here.",
3368
3443
  inputSchema: {
3369
3444
  layersDir: import_zod.z.string().describe(
3370
3445
  "Directory of role-named layer PNGs (resolved against cwd)."