@ikijs/mcp 0.22.0 → 0.23.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-SWRVRVYV.mjs";
4
+ } from "./chunk-YQECLFI4.mjs";
5
5
 
6
6
  // src/cli.ts
7
7
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/dist/index.d.mts CHANGED
@@ -199,8 +199,10 @@ declare function autoRigFromLayers(input: AutoRigInput): Promise<AutoRigResult>;
199
199
  * construction; these checks are for a set it did not cut (hand-prepared
200
200
  * layers, a re-cut) and for the drawings the contract cannot save: a mouth too
201
201
  * small to fold, a line too thin to close on, green the key left, an interior
202
- * with holes. The lip layers' straight edges are the split's cuts, so the
203
- * generic edge and flat-cut checks skip them (`isLipRole`).
202
+ * with holes. The lip layers' straight edges are the split's cuts, and so are
203
+ * the inside layers' (`mouth_tongue`, `mouth_teeth`), so the generic edge and
204
+ * flat-cut checks skip them all (`isLipLayerRole`). Of an inside layer the rig reads
205
+ * only its box, so it is checked for the set it needs, its canvas and its box.
204
206
  */
205
207
 
206
208
  /** What the report says of the opening, for judging a half-open mouth. */
@@ -262,7 +264,7 @@ interface MeasureReport {
262
264
  * The lip set's opening as the rig reads it, set whenever the three lip
263
265
  * layers are present and readable. The fold's dead zone `deadZone` is the
264
266
  * `MouthOpen` below which the slit between the lips has not opened, and
265
- * it varies with the drawing (0.04 on one opening, 0.33 on another), so a
267
+ * it varies with the drawing (0.03 on one opening, 0.26 on another), so a
266
268
  * half-open mouth that shows no slit is judged against it, not against a
267
269
  * fixed number.
268
270
  */
@@ -314,7 +316,8 @@ declare function formatMeasureReport(result: MeasureReport & {
314
316
  * closed drawing and an open one that cross-fade. `mouth_keyed.png` (the open
315
317
  * mouth, its inside flat #00FF00) + `mouth_interior.png` is the lip set: the
316
318
  * composer keys and splits it into `mouth_inner` / `lip_lower` / `lip_upper` on
317
- * one frame (./compose-lips), which the rig folds open like an eyelid.
319
+ * one frame (./compose-lips), which the rig folds open like an eyelid, and the
320
+ * interior's light paint into `mouth_tongue` / `mouth_teeth` clipped to it.
318
321
  *
319
322
  * `sharp` must stay confined to @ikijs/mcp; part decoding goes through
320
323
  * ./node-images, this package's single image-decode boundary.
@@ -476,8 +479,10 @@ declare const LOWER_LASH: {
476
479
  readonly lash_lower_L: "eye_L";
477
480
  readonly lash_lower_R: "eye_R";
478
481
  };
479
- /** The lip set's other two layers, and the role whose frame they are cut on. */
482
+ /** The lip set's other layers, and the role whose frame they are cut on. */
480
483
  declare const LIP_FRAME: {
484
+ readonly mouth_tongue: "mouth_inner";
485
+ readonly mouth_teeth: "mouth_inner";
481
486
  readonly lip_lower: "mouth_inner";
482
487
  readonly lip_upper: "mouth_inner";
483
488
  };
package/dist/index.d.ts CHANGED
@@ -199,8 +199,10 @@ declare function autoRigFromLayers(input: AutoRigInput): Promise<AutoRigResult>;
199
199
  * construction; these checks are for a set it did not cut (hand-prepared
200
200
  * layers, a re-cut) and for the drawings the contract cannot save: a mouth too
201
201
  * small to fold, a line too thin to close on, green the key left, an interior
202
- * with holes. The lip layers' straight edges are the split's cuts, so the
203
- * generic edge and flat-cut checks skip them (`isLipRole`).
202
+ * with holes. The lip layers' straight edges are the split's cuts, and so are
203
+ * the inside layers' (`mouth_tongue`, `mouth_teeth`), so the generic edge and
204
+ * flat-cut checks skip them all (`isLipLayerRole`). Of an inside layer the rig reads
205
+ * only its box, so it is checked for the set it needs, its canvas and its box.
204
206
  */
205
207
 
206
208
  /** What the report says of the opening, for judging a half-open mouth. */
@@ -262,7 +264,7 @@ interface MeasureReport {
262
264
  * The lip set's opening as the rig reads it, set whenever the three lip
263
265
  * layers are present and readable. The fold's dead zone `deadZone` is the
264
266
  * `MouthOpen` below which the slit between the lips has not opened, and
265
- * it varies with the drawing (0.04 on one opening, 0.33 on another), so a
267
+ * it varies with the drawing (0.03 on one opening, 0.26 on another), so a
266
268
  * half-open mouth that shows no slit is judged against it, not against a
267
269
  * fixed number.
268
270
  */
@@ -314,7 +316,8 @@ declare function formatMeasureReport(result: MeasureReport & {
314
316
  * closed drawing and an open one that cross-fade. `mouth_keyed.png` (the open
315
317
  * mouth, its inside flat #00FF00) + `mouth_interior.png` is the lip set: the
316
318
  * composer keys and splits it into `mouth_inner` / `lip_lower` / `lip_upper` on
317
- * one frame (./compose-lips), which the rig folds open like an eyelid.
319
+ * one frame (./compose-lips), which the rig folds open like an eyelid, and the
320
+ * interior's light paint into `mouth_tongue` / `mouth_teeth` clipped to it.
318
321
  *
319
322
  * `sharp` must stay confined to @ikijs/mcp; part decoding goes through
320
323
  * ./node-images, this package's single image-decode boundary.
@@ -476,8 +479,10 @@ declare const LOWER_LASH: {
476
479
  readonly lash_lower_L: "eye_L";
477
480
  readonly lash_lower_R: "eye_R";
478
481
  };
479
- /** The lip set's other two layers, and the role whose frame they are cut on. */
482
+ /** The lip set's other layers, and the role whose frame they are cut on. */
480
483
  declare const LIP_FRAME: {
484
+ readonly mouth_tongue: "mouth_inner";
485
+ readonly mouth_teeth: "mouth_inner";
481
486
  readonly lip_lower: "mouth_inner";
482
487
  readonly lip_upper: "mouth_inner";
483
488
  };
package/dist/index.js CHANGED
@@ -1349,10 +1349,15 @@ async function splitLipSet(keyedPng, w, h, interior) {
1349
1349
  const gw = holeW + 2;
1350
1350
  const gh = hb.y1 - hb.y0 + 3;
1351
1351
  const { data: fitted } = await (0, import_sharp2.default)(interior.png).resize(gw, gh, { fit: "fill" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
1352
- const faintUpper = (p, x, y) => y < bot[x] && label[p] === main && 2 * y < top[x] + bot[x];
1352
+ const hole = (q) => label[q] === main;
1353
+ const upperHalf = (x, y) => 2 * y < top[x] + bot[x];
1354
+ const faintUpper = (p, x, y) => y < bot[x] && hole(p) && upperHalf(x, y);
1355
+ 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);
1353
1356
  const upper = Buffer.alloc(n * 4);
1354
1357
  const lower = Buffer.alloc(n * 4);
1355
1358
  const inner = Buffer.alloc(n * 4);
1359
+ const tongue = Buffer.alloc(n * 4);
1360
+ const teeth = Buffer.alloc(n * 4);
1356
1361
  const copy = (to, p) => frame.copy(to, p * 4, p * 4, p * 4 + 4);
1357
1362
  for (let y = 0; y < h; y++) {
1358
1363
  for (let x = 0; x < w; x++) {
@@ -1361,7 +1366,14 @@ async function splitLipSet(keyedPng, w, h, interior) {
1361
1366
  if ((!inOpening || y < top[x] || faintUpper(p, x, y)) && !(wall[x] && grown[p]))
1362
1367
  copy(upper, p);
1363
1368
  if (inOpening && skinRow[x] >= 0 && y >= skinRow[x]) copy(lower, p);
1364
- if (!grown[p]) continue;
1369
+ if (!grown[p]) {
1370
+ const a = alpha(p);
1371
+ if (a >= import_editor6.ALPHA_OPAQUE && a < 255 && besideHole(p, x, y)) {
1372
+ inner.set(interior.cavity, p * 4);
1373
+ inner[p * 4 + 3] = 255 - a;
1374
+ }
1375
+ continue;
1376
+ }
1365
1377
  const out = [...interior.cavity];
1366
1378
  const ix = x - gx;
1367
1379
  const iy = y - gy;
@@ -1378,6 +1390,11 @@ async function splitLipSet(keyedPng, w, h, interior) {
1378
1390
  inner[p * 4 + 1] = Math.round(out[1]);
1379
1391
  inner[p * 4 + 2] = Math.round(out[2]);
1380
1392
  inner[p * 4 + 3] = 255;
1393
+ if (hole(p) && luma(inner, p * 4) >= CAVITY_LUMA) {
1394
+ const to = upperHalf(x, y) ? teeth : tongue;
1395
+ inner.copy(to, p * 4, p * 4, p * 4 + 4);
1396
+ inner.set(interior.cavity, p * 4);
1397
+ }
1381
1398
  }
1382
1399
  }
1383
1400
  const opening = assertFoldContract(
@@ -1385,12 +1402,17 @@ async function splitLipSet(keyedPng, w, h, interior) {
1385
1402
  w,
1386
1403
  h
1387
1404
  );
1388
- const [innerPng, lowerPng, upperPng] = await Promise.all([
1389
- encode(inner, w, h),
1390
- encode(lower, w, h),
1391
- encode(upper, w, h)
1392
- ]);
1393
- return { inner: innerPng, lower: lowerPng, upper: upperPng, opening };
1405
+ const [innerPng, lowerPng, upperPng, tonguePng, teethPng] = await Promise.all(
1406
+ [inner, lower, upper, tongue, teeth].map((b) => encode(b, w, h))
1407
+ );
1408
+ return {
1409
+ inner: innerPng,
1410
+ lower: lowerPng,
1411
+ upper: upperPng,
1412
+ tongue: tonguePng,
1413
+ teeth: teethPng,
1414
+ opening
1415
+ };
1394
1416
  }
1395
1417
  async function restShiftOf(layers, width, height) {
1396
1418
  const [mouth_inner, lip_lower, lip_upper] = await Promise.all(
@@ -1413,25 +1435,40 @@ async function restShiftOf(layers, width, height) {
1413
1435
  }
1414
1436
  return (0, import_editor6.mouthRestShift)(byRole);
1415
1437
  }
1416
- async function closedLips(upper, lower, shift, left) {
1438
+ async function closedLips(upper, lower, shift, left, top) {
1417
1439
  const shut = async (png, role) => {
1418
1440
  const { data, info } = await rawOf(png);
1419
1441
  const { width: w, height: h } = info;
1420
1442
  const out = Buffer.alloc(w * h * 4);
1421
1443
  for (let x = 0; x < w; x++) {
1422
- const dy = shift(role, left + x);
1423
- const f = Math.floor(dy);
1424
- const t = dy - f;
1425
1444
  const px2 = (row, c) => row < 0 || row >= h ? 0 : data[(row * w + x) * 4 + c];
1445
+ const landed = [];
1446
+ for (let row = 0; row < h; row++) {
1447
+ const dy = shift(role, left + x, top + row);
1448
+ if (dy !== void 0) landed.push([row, row + 0.5 - dy]);
1449
+ }
1450
+ if (landed.length > 1) {
1451
+ const [a, b] = landed;
1452
+ const [y, z2] = landed.slice(-2);
1453
+ landed.unshift([a[0] - 1, 2 * a[1] - b[1]]);
1454
+ landed.push([z2[0] + 1, 2 * z2[1] - y[1]]);
1455
+ }
1456
+ let i = 0;
1426
1457
  for (let to = 0; to < h; to++) {
1427
- const a0 = px2(to + f, 3);
1428
- const a1 = px2(to + f + 1, 3);
1458
+ const centre = to + 0.5;
1459
+ while (i + 1 < landed.length && landed[i + 1][1] < centre) i++;
1460
+ if (i + 1 >= landed.length || landed[i][1] > centre) continue;
1461
+ const [r0, y0] = landed[i];
1462
+ const [r1, y1] = landed[i + 1];
1463
+ const t = (centre - y0) / (y1 - y0);
1464
+ const a0 = px2(r0, 3);
1465
+ const a1 = px2(r1, 3);
1429
1466
  const a = (1 - t) * a0 + t * a1;
1430
1467
  if (a === 0) continue;
1431
1468
  const o = (to * w + x) * 4;
1432
1469
  for (let c = 0; c < 3; c++)
1433
1470
  out[o + c] = Math.round(
1434
- ((1 - t) * a0 * px2(to + f, c) + t * a1 * px2(to + f + 1, c)) / a
1471
+ ((1 - t) * a0 * px2(r0, c) + t * a1 * px2(r1, c)) / a
1435
1472
  );
1436
1473
  out[o + 3] = Math.round(a);
1437
1474
  }
@@ -1446,7 +1483,7 @@ async function closedLips(upper, lower, shift, left) {
1446
1483
  }
1447
1484
 
1448
1485
  // src/measure-lips.ts
1449
- var isLipRole = (role) => import_editor7.LIP_ROLES.includes(role);
1486
+ var isLipLayerRole = (role) => import_editor7.LIP_ROLES.includes(role) || (0, import_editor7.isLipInsideRole)(role);
1450
1487
  var MIN_OPENING_ROWS = 8;
1451
1488
  var MIN_LINE_ROWS = 2;
1452
1489
  var GREEN_EXCESS = 40;
@@ -1455,7 +1492,15 @@ var columns = (cols) => `${cols.length} column${cols.length === 1 ? "" : "s"} (f
1455
1492
  async function lipWarnings(absDir, layers) {
1456
1493
  const warnings = [];
1457
1494
  const present = import_editor7.LIP_ROLES.filter((role) => layers[role] !== void 0);
1458
- if (present.length === 0) return { warnings };
1495
+ const inside = import_editor7.LIP_INSIDE_ROLES.filter((role) => layers[role] !== void 0);
1496
+ if (present.length === 0) {
1497
+ if (inside.length > 0) {
1498
+ warnings.push(
1499
+ `${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.`
1500
+ );
1501
+ }
1502
+ return { warnings };
1503
+ }
1459
1504
  const legacy = ["mouth", "mouth_open"].filter(
1460
1505
  (role) => layers[role] !== void 0
1461
1506
  );
@@ -1472,7 +1517,7 @@ async function lipWarnings(absDir, layers) {
1472
1517
  return { warnings };
1473
1518
  }
1474
1519
  const { mouth_inner: inner, lip_upper: upper } = layers;
1475
- for (const role of ["lip_lower", "lip_upper"]) {
1520
+ for (const role of ["lip_lower", "lip_upper", ...inside]) {
1476
1521
  const stats = layers[role];
1477
1522
  if (stats.canvasW !== inner.canvasW || stats.canvasH !== inner.canvasH) {
1478
1523
  warnings.push(
@@ -1481,6 +1526,21 @@ async function lipWarnings(absDir, layers) {
1481
1526
  return { warnings };
1482
1527
  }
1483
1528
  }
1529
+ const box = (m) => ({
1530
+ x0: m.bboxCx - m.w / 2,
1531
+ x1: m.bboxCx + m.w / 2,
1532
+ y0: m.bboxCy - m.h / 2,
1533
+ y1: m.bboxCy + m.h / 2
1534
+ });
1535
+ const cavity = box(inner);
1536
+ for (const role of inside) {
1537
+ const b = box(layers[role]);
1538
+ if (b.x0 < cavity.x0 || b.x1 > cavity.x1 || b.y0 < cavity.y0 || b.y1 > cavity.y1) {
1539
+ warnings.push(
1540
+ `${role}: its box leaves mouth_inner's \u2014 the cavity clips it away there. Recompose from mouth_keyed.png + mouth_interior.png (free).`
1541
+ );
1542
+ }
1543
+ }
1484
1544
  const measurer = (0, import_editor7.createLayerSetMeasurer)({
1485
1545
  width: inner.canvasW,
1486
1546
  height: inner.canvasH
@@ -2082,7 +2142,7 @@ async function measureDir(absDir, noseSpeck) {
2082
2142
  }
2083
2143
  const warnings = [];
2084
2144
  for (const [role, m] of Object.entries(layers)) {
2085
- if (isLipRole(role)) continue;
2145
+ if (isLipLayerRole(role)) continue;
2086
2146
  const edges = [
2087
2147
  ["top", m.edgeTop, m.w, m.marginTop],
2088
2148
  ["left", m.edgeLeft, m.h, m.marginLeft],
@@ -2112,7 +2172,7 @@ async function measureDir(absDir, noseSpeck) {
2112
2172
  }
2113
2173
  }
2114
2174
  for (const [role, m] of Object.entries(layers)) {
2115
- if (role === "body" || isLipRole(role)) continue;
2175
+ if (role === "body" || isLipLayerRole(role)) continue;
2116
2176
  if (m.flatCutRun > FLAT_CUT_MAX_FRAC * m.w && m.flatCutRun >= FLAT_CUT_MIN_PX) {
2117
2177
  warnings.push(
2118
2178
  `${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.`
@@ -2389,10 +2449,11 @@ var DEFAULT_LAYOUT = {
2389
2449
  optional: true
2390
2450
  },
2391
2451
  // The lip set's ONE frame, mouth_open's place: the keyed mouth is split into
2392
- // mouth_inner / lip_lower / lip_upper and all three land here, so a retune
2393
- // moves them together. lip_lower and lip_upper have no key of their own
2394
- // (LIP_FRAME). OPTIONAL and opt-in: with mouth_keyed.png + mouth_interior.png
2395
- // it stands in for mouth and mouth_open.
2452
+ // mouth_inner / lip_lower / lip_upper, the interior's light paint into
2453
+ // mouth_tongue / mouth_teeth, and all of them land here, so a retune moves
2454
+ // them together. The other four have no key of their own (LIP_FRAME).
2455
+ // OPTIONAL and opt-in: with mouth_keyed.png + mouth_interior.png it stands
2456
+ // in for mouth and mouth_open.
2396
2457
  mouth_inner: {
2397
2458
  src: KEYED_SRC,
2398
2459
  cx: 550,
@@ -2447,6 +2508,8 @@ var ORDER = [
2447
2508
  "mouth",
2448
2509
  "mouth_open",
2449
2510
  "mouth_inner",
2511
+ "mouth_tongue",
2512
+ "mouth_teeth",
2450
2513
  "lip_lower",
2451
2514
  "lip_upper",
2452
2515
  "eye_L",
@@ -2949,10 +3012,19 @@ async function composeLayersFromParts(input) {
2949
3012
  });
2950
3013
  continue;
2951
3014
  }
2952
- if (role === "lip_lower" || role === "lip_upper") {
3015
+ if (role === "mouth_tongue" || role === "mouth_teeth" || role === "lip_lower" || role === "lip_upper") {
2953
3016
  if (lipSplit === void 0) continue;
2954
3017
  const { split: split2, w, h, left: left2, top: top2 } = lipSplit;
2955
- const buf = role === "lip_lower" ? split2.lower : split2.upper;
3018
+ const buf = {
3019
+ mouth_tongue: split2.tongue,
3020
+ mouth_teeth: split2.teeth,
3021
+ lip_lower: split2.lower,
3022
+ lip_upper: split2.upper
3023
+ }[role];
3024
+ if ((0, import_editor11.isLipInsideRole)(role) && !await hasCoverage(buf)) {
3025
+ skipped.push(role);
3026
+ continue;
3027
+ }
2956
3028
  placed.push({ role, part: { buf, w, h }, left: left2, top: top2 });
2957
3029
  continue;
2958
3030
  }
@@ -3119,7 +3191,8 @@ async function composeLayersFromParts(input) {
3119
3191
  canvas.width,
3120
3192
  canvas.height
3121
3193
  ),
3122
- lipSplit.left
3194
+ lipSplit.left,
3195
+ lipSplit.top
3123
3196
  );
3124
3197
  for (const role of ORDER) {
3125
3198
  if (placed.some((p) => p.role === role)) continue;
@@ -3143,7 +3216,7 @@ async function composeLayersFromParts(input) {
3143
3216
  });
3144
3217
  }
3145
3218
  const restInput = (role, buf) => {
3146
- if (role === "mouth_inner") return null;
3219
+ if (role === "mouth_inner" || (0, import_editor11.isLipInsideRole)(role)) return null;
3147
3220
  if (closed === void 0) return buf;
3148
3221
  if (role === "lip_upper") return closed.upper;
3149
3222
  if (role === "lip_lower") return closed.lower;
@@ -3214,7 +3287,7 @@ async function composeLayersFromParts(input) {
3214
3287
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
3215
3288
  var import_zod = require("zod");
3216
3289
  function createIkiMcpServer() {
3217
- const server = new import_mcp.McpServer({ name: "iki", version: "0.22.0" });
3290
+ const server = new import_mcp.McpServer({ name: "iki", version: "0.23.0" });
3218
3291
  server.registerTool(
3219
3292
  "validate_iki",
3220
3293
  {
@@ -3279,7 +3352,7 @@ function createIkiMcpServer() {
3279
3352
  server.registerTool(
3280
3353
  "auto_rig_from_layers",
3281
3354
  {
3282
- 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.",
3355
+ 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.",
3283
3356
  inputSchema: {
3284
3357
  layers: import_zod.z.array(
3285
3358
  import_zod.z.object({
@@ -3334,7 +3407,7 @@ function createIkiMcpServer() {
3334
3407
  server.registerTool(
3335
3408
  "compose_layers_from_parts",
3336
3409
  {
3337
- 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`.",
3410
+ 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`.",
3338
3411
  inputSchema: {
3339
3412
  partsDir: import_zod.z.string().describe(
3340
3413
  "Directory of the source part PNGs (resolved against cwd)."
@@ -3351,7 +3424,7 @@ function createIkiMcpServer() {
3351
3424
  h: import_zod.z.number()
3352
3425
  }).partial()
3353
3426
  ).optional().describe(
3354
- "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."
3427
+ "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."
3355
3428
  ),
3356
3429
  mirrorParts: import_zod.z.array(import_zod.z.string()).optional().describe(
3357
3430
  "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."
@@ -3382,7 +3455,7 @@ function createIkiMcpServer() {
3382
3455
  server.registerTool(
3383
3456
  "measure_layers",
3384
3457
  {
3385
- 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.",
3458
+ 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.",
3386
3459
  inputSchema: {
3387
3460
  layersDir: import_zod.z.string().describe(
3388
3461
  "Directory of role-named layer PNGs (resolved against cwd)."