@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/README.md +5 -5
- package/dist/{chunk-SWRVRVYV.mjs → chunk-YQECLFI4.mjs} +114 -35
- package/dist/chunk-YQECLFI4.mjs.map +1 -0
- package/dist/cli.js +106 -33
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +10 -5
- package/dist/index.d.ts +10 -5
- package/dist/index.js +106 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-SWRVRVYV.mjs.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1333,10 +1333,15 @@ async function splitLipSet(keyedPng, w, h, interior) {
|
|
|
1333
1333
|
const gw = holeW + 2;
|
|
1334
1334
|
const gh = hb.y1 - hb.y0 + 3;
|
|
1335
1335
|
const { data: fitted } = await (0, import_sharp2.default)(interior.png).resize(gw, gh, { fit: "fill" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
1336
|
-
const
|
|
1336
|
+
const hole = (q) => label[q] === main2;
|
|
1337
|
+
const upperHalf = (x, y) => 2 * y < top[x] + bot[x];
|
|
1338
|
+
const faintUpper = (p, x, y) => y < bot[x] && hole(p) && upperHalf(x, y);
|
|
1339
|
+
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
1340
|
const upper = Buffer.alloc(n * 4);
|
|
1338
1341
|
const lower = Buffer.alloc(n * 4);
|
|
1339
1342
|
const inner = Buffer.alloc(n * 4);
|
|
1343
|
+
const tongue = Buffer.alloc(n * 4);
|
|
1344
|
+
const teeth = Buffer.alloc(n * 4);
|
|
1340
1345
|
const copy = (to, p) => frame.copy(to, p * 4, p * 4, p * 4 + 4);
|
|
1341
1346
|
for (let y = 0; y < h; y++) {
|
|
1342
1347
|
for (let x = 0; x < w; x++) {
|
|
@@ -1345,7 +1350,14 @@ async function splitLipSet(keyedPng, w, h, interior) {
|
|
|
1345
1350
|
if ((!inOpening || y < top[x] || faintUpper(p, x, y)) && !(wall[x] && grown[p]))
|
|
1346
1351
|
copy(upper, p);
|
|
1347
1352
|
if (inOpening && skinRow[x] >= 0 && y >= skinRow[x]) copy(lower, p);
|
|
1348
|
-
if (!grown[p])
|
|
1353
|
+
if (!grown[p]) {
|
|
1354
|
+
const a = alpha(p);
|
|
1355
|
+
if (a >= import_editor6.ALPHA_OPAQUE && a < 255 && besideHole(p, x, y)) {
|
|
1356
|
+
inner.set(interior.cavity, p * 4);
|
|
1357
|
+
inner[p * 4 + 3] = 255 - a;
|
|
1358
|
+
}
|
|
1359
|
+
continue;
|
|
1360
|
+
}
|
|
1349
1361
|
const out = [...interior.cavity];
|
|
1350
1362
|
const ix = x - gx;
|
|
1351
1363
|
const iy = y - gy;
|
|
@@ -1362,6 +1374,11 @@ async function splitLipSet(keyedPng, w, h, interior) {
|
|
|
1362
1374
|
inner[p * 4 + 1] = Math.round(out[1]);
|
|
1363
1375
|
inner[p * 4 + 2] = Math.round(out[2]);
|
|
1364
1376
|
inner[p * 4 + 3] = 255;
|
|
1377
|
+
if (hole(p) && luma(inner, p * 4) >= CAVITY_LUMA) {
|
|
1378
|
+
const to = upperHalf(x, y) ? teeth : tongue;
|
|
1379
|
+
inner.copy(to, p * 4, p * 4, p * 4 + 4);
|
|
1380
|
+
inner.set(interior.cavity, p * 4);
|
|
1381
|
+
}
|
|
1365
1382
|
}
|
|
1366
1383
|
}
|
|
1367
1384
|
const opening = assertFoldContract(
|
|
@@ -1369,12 +1386,17 @@ async function splitLipSet(keyedPng, w, h, interior) {
|
|
|
1369
1386
|
w,
|
|
1370
1387
|
h
|
|
1371
1388
|
);
|
|
1372
|
-
const [innerPng, lowerPng, upperPng] = await Promise.all(
|
|
1373
|
-
encode(
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1389
|
+
const [innerPng, lowerPng, upperPng, tonguePng, teethPng] = await Promise.all(
|
|
1390
|
+
[inner, lower, upper, tongue, teeth].map((b) => encode(b, w, h))
|
|
1391
|
+
);
|
|
1392
|
+
return {
|
|
1393
|
+
inner: innerPng,
|
|
1394
|
+
lower: lowerPng,
|
|
1395
|
+
upper: upperPng,
|
|
1396
|
+
tongue: tonguePng,
|
|
1397
|
+
teeth: teethPng,
|
|
1398
|
+
opening
|
|
1399
|
+
};
|
|
1378
1400
|
}
|
|
1379
1401
|
async function restShiftOf(layers, width, height) {
|
|
1380
1402
|
const [mouth_inner, lip_lower, lip_upper] = await Promise.all(
|
|
@@ -1397,25 +1419,40 @@ async function restShiftOf(layers, width, height) {
|
|
|
1397
1419
|
}
|
|
1398
1420
|
return (0, import_editor6.mouthRestShift)(byRole);
|
|
1399
1421
|
}
|
|
1400
|
-
async function closedLips(upper, lower, shift, left) {
|
|
1422
|
+
async function closedLips(upper, lower, shift, left, top) {
|
|
1401
1423
|
const shut = async (png, role) => {
|
|
1402
1424
|
const { data, info } = await rawOf(png);
|
|
1403
1425
|
const { width: w, height: h } = info;
|
|
1404
1426
|
const out = Buffer.alloc(w * h * 4);
|
|
1405
1427
|
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
1428
|
const px2 = (row, c) => row < 0 || row >= h ? 0 : data[(row * w + x) * 4 + c];
|
|
1429
|
+
const landed = [];
|
|
1430
|
+
for (let row = 0; row < h; row++) {
|
|
1431
|
+
const dy = shift(role, left + x, top + row);
|
|
1432
|
+
if (dy !== void 0) landed.push([row, row + 0.5 - dy]);
|
|
1433
|
+
}
|
|
1434
|
+
if (landed.length > 1) {
|
|
1435
|
+
const [a, b] = landed;
|
|
1436
|
+
const [y, z2] = landed.slice(-2);
|
|
1437
|
+
landed.unshift([a[0] - 1, 2 * a[1] - b[1]]);
|
|
1438
|
+
landed.push([z2[0] + 1, 2 * z2[1] - y[1]]);
|
|
1439
|
+
}
|
|
1440
|
+
let i = 0;
|
|
1410
1441
|
for (let to = 0; to < h; to++) {
|
|
1411
|
-
const
|
|
1412
|
-
|
|
1442
|
+
const centre = to + 0.5;
|
|
1443
|
+
while (i + 1 < landed.length && landed[i + 1][1] < centre) i++;
|
|
1444
|
+
if (i + 1 >= landed.length || landed[i][1] > centre) continue;
|
|
1445
|
+
const [r0, y0] = landed[i];
|
|
1446
|
+
const [r1, y1] = landed[i + 1];
|
|
1447
|
+
const t = (centre - y0) / (y1 - y0);
|
|
1448
|
+
const a0 = px2(r0, 3);
|
|
1449
|
+
const a1 = px2(r1, 3);
|
|
1413
1450
|
const a = (1 - t) * a0 + t * a1;
|
|
1414
1451
|
if (a === 0) continue;
|
|
1415
1452
|
const o = (to * w + x) * 4;
|
|
1416
1453
|
for (let c = 0; c < 3; c++)
|
|
1417
1454
|
out[o + c] = Math.round(
|
|
1418
|
-
((1 - t) * a0 * px2(
|
|
1455
|
+
((1 - t) * a0 * px2(r0, c) + t * a1 * px2(r1, c)) / a
|
|
1419
1456
|
);
|
|
1420
1457
|
out[o + 3] = Math.round(a);
|
|
1421
1458
|
}
|
|
@@ -1430,7 +1467,7 @@ async function closedLips(upper, lower, shift, left) {
|
|
|
1430
1467
|
}
|
|
1431
1468
|
|
|
1432
1469
|
// src/measure-lips.ts
|
|
1433
|
-
var
|
|
1470
|
+
var isLipLayerRole = (role) => import_editor7.LIP_ROLES.includes(role) || (0, import_editor7.isLipInsideRole)(role);
|
|
1434
1471
|
var MIN_OPENING_ROWS = 8;
|
|
1435
1472
|
var MIN_LINE_ROWS = 2;
|
|
1436
1473
|
var GREEN_EXCESS = 40;
|
|
@@ -1439,7 +1476,15 @@ var columns = (cols) => `${cols.length} column${cols.length === 1 ? "" : "s"} (f
|
|
|
1439
1476
|
async function lipWarnings(absDir, layers) {
|
|
1440
1477
|
const warnings = [];
|
|
1441
1478
|
const present = import_editor7.LIP_ROLES.filter((role) => layers[role] !== void 0);
|
|
1442
|
-
|
|
1479
|
+
const inside = import_editor7.LIP_INSIDE_ROLES.filter((role) => layers[role] !== void 0);
|
|
1480
|
+
if (present.length === 0) {
|
|
1481
|
+
if (inside.length > 0) {
|
|
1482
|
+
warnings.push(
|
|
1483
|
+
`${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.`
|
|
1484
|
+
);
|
|
1485
|
+
}
|
|
1486
|
+
return { warnings };
|
|
1487
|
+
}
|
|
1443
1488
|
const legacy = ["mouth", "mouth_open"].filter(
|
|
1444
1489
|
(role) => layers[role] !== void 0
|
|
1445
1490
|
);
|
|
@@ -1456,7 +1501,7 @@ async function lipWarnings(absDir, layers) {
|
|
|
1456
1501
|
return { warnings };
|
|
1457
1502
|
}
|
|
1458
1503
|
const { mouth_inner: inner, lip_upper: upper } = layers;
|
|
1459
|
-
for (const role of ["lip_lower", "lip_upper"]) {
|
|
1504
|
+
for (const role of ["lip_lower", "lip_upper", ...inside]) {
|
|
1460
1505
|
const stats = layers[role];
|
|
1461
1506
|
if (stats.canvasW !== inner.canvasW || stats.canvasH !== inner.canvasH) {
|
|
1462
1507
|
warnings.push(
|
|
@@ -1465,6 +1510,21 @@ async function lipWarnings(absDir, layers) {
|
|
|
1465
1510
|
return { warnings };
|
|
1466
1511
|
}
|
|
1467
1512
|
}
|
|
1513
|
+
const box = (m) => ({
|
|
1514
|
+
x0: m.bboxCx - m.w / 2,
|
|
1515
|
+
x1: m.bboxCx + m.w / 2,
|
|
1516
|
+
y0: m.bboxCy - m.h / 2,
|
|
1517
|
+
y1: m.bboxCy + m.h / 2
|
|
1518
|
+
});
|
|
1519
|
+
const cavity = box(inner);
|
|
1520
|
+
for (const role of inside) {
|
|
1521
|
+
const b = box(layers[role]);
|
|
1522
|
+
if (b.x0 < cavity.x0 || b.x1 > cavity.x1 || b.y0 < cavity.y0 || b.y1 > cavity.y1) {
|
|
1523
|
+
warnings.push(
|
|
1524
|
+
`${role}: its box leaves mouth_inner's \u2014 the cavity clips it away there. Recompose from mouth_keyed.png + mouth_interior.png (free).`
|
|
1525
|
+
);
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1468
1528
|
const measurer = (0, import_editor7.createLayerSetMeasurer)({
|
|
1469
1529
|
width: inner.canvasW,
|
|
1470
1530
|
height: inner.canvasH
|
|
@@ -2066,7 +2126,7 @@ async function measureDir(absDir, noseSpeck) {
|
|
|
2066
2126
|
}
|
|
2067
2127
|
const warnings = [];
|
|
2068
2128
|
for (const [role, m] of Object.entries(layers)) {
|
|
2069
|
-
if (
|
|
2129
|
+
if (isLipLayerRole(role)) continue;
|
|
2070
2130
|
const edges = [
|
|
2071
2131
|
["top", m.edgeTop, m.w, m.marginTop],
|
|
2072
2132
|
["left", m.edgeLeft, m.h, m.marginLeft],
|
|
@@ -2096,7 +2156,7 @@ async function measureDir(absDir, noseSpeck) {
|
|
|
2096
2156
|
}
|
|
2097
2157
|
}
|
|
2098
2158
|
for (const [role, m] of Object.entries(layers)) {
|
|
2099
|
-
if (role === "body" ||
|
|
2159
|
+
if (role === "body" || isLipLayerRole(role)) continue;
|
|
2100
2160
|
if (m.flatCutRun > FLAT_CUT_MAX_FRAC * m.w && m.flatCutRun >= FLAT_CUT_MIN_PX) {
|
|
2101
2161
|
warnings.push(
|
|
2102
2162
|
`${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 +2433,11 @@ var DEFAULT_LAYOUT = {
|
|
|
2373
2433
|
optional: true
|
|
2374
2434
|
},
|
|
2375
2435
|
// The lip set's ONE frame, mouth_open's place: the keyed mouth is split into
|
|
2376
|
-
// mouth_inner / lip_lower / lip_upper
|
|
2377
|
-
//
|
|
2378
|
-
//
|
|
2379
|
-
//
|
|
2436
|
+
// mouth_inner / lip_lower / lip_upper, the interior's light paint into
|
|
2437
|
+
// mouth_tongue / mouth_teeth, and all of them land here, so a retune moves
|
|
2438
|
+
// them together. The other four have no key of their own (LIP_FRAME).
|
|
2439
|
+
// OPTIONAL and opt-in: with mouth_keyed.png + mouth_interior.png it stands
|
|
2440
|
+
// in for mouth and mouth_open.
|
|
2380
2441
|
mouth_inner: {
|
|
2381
2442
|
src: KEYED_SRC,
|
|
2382
2443
|
cx: 550,
|
|
@@ -2431,6 +2492,8 @@ var ORDER = [
|
|
|
2431
2492
|
"mouth",
|
|
2432
2493
|
"mouth_open",
|
|
2433
2494
|
"mouth_inner",
|
|
2495
|
+
"mouth_tongue",
|
|
2496
|
+
"mouth_teeth",
|
|
2434
2497
|
"lip_lower",
|
|
2435
2498
|
"lip_upper",
|
|
2436
2499
|
"eye_L",
|
|
@@ -2933,10 +2996,19 @@ async function composeLayersFromParts(input) {
|
|
|
2933
2996
|
});
|
|
2934
2997
|
continue;
|
|
2935
2998
|
}
|
|
2936
|
-
if (role === "lip_lower" || role === "lip_upper") {
|
|
2999
|
+
if (role === "mouth_tongue" || role === "mouth_teeth" || role === "lip_lower" || role === "lip_upper") {
|
|
2937
3000
|
if (lipSplit === void 0) continue;
|
|
2938
3001
|
const { split: split2, w, h, left: left2, top: top2 } = lipSplit;
|
|
2939
|
-
const buf =
|
|
3002
|
+
const buf = {
|
|
3003
|
+
mouth_tongue: split2.tongue,
|
|
3004
|
+
mouth_teeth: split2.teeth,
|
|
3005
|
+
lip_lower: split2.lower,
|
|
3006
|
+
lip_upper: split2.upper
|
|
3007
|
+
}[role];
|
|
3008
|
+
if ((0, import_editor11.isLipInsideRole)(role) && !await hasCoverage(buf)) {
|
|
3009
|
+
skipped.push(role);
|
|
3010
|
+
continue;
|
|
3011
|
+
}
|
|
2940
3012
|
placed.push({ role, part: { buf, w, h }, left: left2, top: top2 });
|
|
2941
3013
|
continue;
|
|
2942
3014
|
}
|
|
@@ -3103,7 +3175,8 @@ async function composeLayersFromParts(input) {
|
|
|
3103
3175
|
canvas.width,
|
|
3104
3176
|
canvas.height
|
|
3105
3177
|
),
|
|
3106
|
-
lipSplit.left
|
|
3178
|
+
lipSplit.left,
|
|
3179
|
+
lipSplit.top
|
|
3107
3180
|
);
|
|
3108
3181
|
for (const role of ORDER) {
|
|
3109
3182
|
if (placed.some((p) => p.role === role)) continue;
|
|
@@ -3127,7 +3200,7 @@ async function composeLayersFromParts(input) {
|
|
|
3127
3200
|
});
|
|
3128
3201
|
}
|
|
3129
3202
|
const restInput = (role, buf) => {
|
|
3130
|
-
if (role === "mouth_inner") return null;
|
|
3203
|
+
if (role === "mouth_inner" || (0, import_editor11.isLipInsideRole)(role)) return null;
|
|
3131
3204
|
if (closed === void 0) return buf;
|
|
3132
3205
|
if (role === "lip_upper") return closed.upper;
|
|
3133
3206
|
if (role === "lip_lower") return closed.lower;
|
|
@@ -3196,7 +3269,7 @@ async function composeLayersFromParts(input) {
|
|
|
3196
3269
|
|
|
3197
3270
|
// src/server.ts
|
|
3198
3271
|
function createIkiMcpServer() {
|
|
3199
|
-
const server = new import_mcp.McpServer({ name: "iki", version: "0.
|
|
3272
|
+
const server = new import_mcp.McpServer({ name: "iki", version: "0.23.0" });
|
|
3200
3273
|
server.registerTool(
|
|
3201
3274
|
"validate_iki",
|
|
3202
3275
|
{
|
|
@@ -3261,7 +3334,7 @@ function createIkiMcpServer() {
|
|
|
3261
3334
|
server.registerTool(
|
|
3262
3335
|
"auto_rig_from_layers",
|
|
3263
3336
|
{
|
|
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
|
|
3337
|
+
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
3338
|
inputSchema: {
|
|
3266
3339
|
layers: import_zod.z.array(
|
|
3267
3340
|
import_zod.z.object({
|
|
@@ -3316,7 +3389,7 @@ function createIkiMcpServer() {
|
|
|
3316
3389
|
server.registerTool(
|
|
3317
3390
|
"compose_layers_from_parts",
|
|
3318
3391
|
{
|
|
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`.",
|
|
3392
|
+
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
3393
|
inputSchema: {
|
|
3321
3394
|
partsDir: import_zod.z.string().describe(
|
|
3322
3395
|
"Directory of the source part PNGs (resolved against cwd)."
|
|
@@ -3333,7 +3406,7 @@ function createIkiMcpServer() {
|
|
|
3333
3406
|
h: import_zod.z.number()
|
|
3334
3407
|
}).partial()
|
|
3335
3408
|
).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
|
|
3409
|
+
"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
3410
|
),
|
|
3338
3411
|
mirrorParts: import_zod.z.array(import_zod.z.string()).optional().describe(
|
|
3339
3412
|
"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 +3437,7 @@ function createIkiMcpServer() {
|
|
|
3364
3437
|
server.registerTool(
|
|
3365
3438
|
"measure_layers",
|
|
3366
3439
|
{
|
|
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.",
|
|
3440
|
+
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
3441
|
inputSchema: {
|
|
3369
3442
|
layersDir: import_zod.z.string().describe(
|
|
3370
3443
|
"Directory of role-named layer PNGs (resolved against cwd)."
|