@ikijs/mcp 0.15.0 → 0.16.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 +1 -1
- package/dist/{chunk-V2FRFOKX.mjs → chunk-J4J3D4ZR.mjs} +69 -31
- package/dist/chunk-J4J3D4ZR.mjs.map +1 -0
- package/dist/cli.js +68 -30
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.js +68 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-V2FRFOKX.mjs.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1214,14 +1214,14 @@ function formatMeasureReport(result) {
|
|
|
1214
1214
|
|
|
1215
1215
|
// src/compose.ts
|
|
1216
1216
|
var CANVAS = 1100;
|
|
1217
|
-
var EYE_W =
|
|
1218
|
-
var IRIS_W =
|
|
1217
|
+
var EYE_W = 98;
|
|
1218
|
+
var IRIS_W = 50;
|
|
1219
1219
|
var EYEWHITE_SRC = "eyewhite.png";
|
|
1220
1220
|
var EYE_LASH_LUMA = 120;
|
|
1221
1221
|
var LASH_KEEP_FRACTION = 0.5;
|
|
1222
1222
|
var TRIM_THRESHOLD = 12;
|
|
1223
1223
|
var STRAY_SPECK_FRACTION = 0.01;
|
|
1224
|
-
var NOSE_TIP_AT = 0.
|
|
1224
|
+
var NOSE_TIP_AT = 0.66;
|
|
1225
1225
|
var DEFAULT_LAYOUT = {
|
|
1226
1226
|
// Back hair and body sit behind the face. Both are OPTIONAL: a parts dir
|
|
1227
1227
|
// without them still composes (head-only character).
|
|
@@ -1229,19 +1229,20 @@ var DEFAULT_LAYOUT = {
|
|
|
1229
1229
|
// The torso, cut off by the canvas bottom, so the character is not a
|
|
1230
1230
|
// floating head. It rides its own `bodyDeformer`, which only breathes.
|
|
1231
1231
|
body: { src: "body.png", cx: 550, cy: 1017, w: 840, optional: true },
|
|
1232
|
-
face
|
|
1232
|
+
// The face is drawn without a neck, so its box is the skull and centres
|
|
1233
|
+
// above the eye row (bob's skull at 437 against his eyes' 475).
|
|
1234
|
+
face: { src: "face.png", cx: 550, cy: 437, w: 400 },
|
|
1233
1235
|
// The cheek blush, one part for both cheeks: blush_R (screen left) takes it
|
|
1234
1236
|
// as drawn and blush_L mirrors it, like the eyewhite. It draws over the face
|
|
1235
|
-
// and under the nose. Its box sits below each eye, centred
|
|
1236
|
-
// eye's centre and above the nose tip
|
|
1237
|
-
//
|
|
1238
|
-
//
|
|
1239
|
-
// and
|
|
1240
|
-
//
|
|
1241
|
-
|
|
1242
|
-
blush_L: { src: "blush.png", cx: 662, cy: 530, w: 56, optional: true, mirror: true },
|
|
1237
|
+
// and under the nose. Its box sits below each eye, centred 5 px outside the
|
|
1238
|
+
// eye's centre and 55 px under its row, above the nose tip: on bob's face,
|
|
1239
|
+
// which narrows fast below the eye row, a 2:1 blush there stays on the
|
|
1240
|
+
// cheek through the turn, where one 26 px further out reached the ears.
|
|
1241
|
+
// OPTIONAL, and decoration: a parts dir without it composes, and nothing
|
|
1242
|
+
// reports it missing.
|
|
1243
|
+
blush_L: { src: "blush.png", cx: 641, cy: 530, w: 56, optional: true, mirror: true },
|
|
1243
1244
|
// prettier-ignore
|
|
1244
|
-
blush_R: { src: "blush.png", cx:
|
|
1245
|
+
blush_R: { src: "blush.png", cx: 459, cy: 530, w: 56, optional: true, mirror: false },
|
|
1245
1246
|
// prettier-ignore
|
|
1246
1247
|
// The nose, drawn on its own (the face is drawn without one): the auto-rig
|
|
1247
1248
|
// leads the head turn with it and keys the other features' slide on its
|
|
@@ -1249,8 +1250,8 @@ var DEFAULT_LAYOUT = {
|
|
|
1249
1250
|
// width of its dense core, and it has no `cy`: its row comes from the tip
|
|
1250
1251
|
// rule (NOSE_TIP_AT), between the eyes and the mouth, so it follows them
|
|
1251
1252
|
// when they are retuned. OPTIONAL: a parts dir without it composes.
|
|
1252
|
-
nose: { src: "nose.png", cx: 550, w:
|
|
1253
|
-
mouth: { src: "mouth.png", cx: 550, cy:
|
|
1253
|
+
nose: { src: "nose.png", cx: 550, w: 20, optional: true },
|
|
1254
|
+
mouth: { src: "mouth.png", cx: 550, cy: 594, w: 76 },
|
|
1254
1255
|
// Cross-fades with `mouth` on ParamMouthOpenY (opacity, not scaleY) once the
|
|
1255
1256
|
// auto-rig sees both roles. Same cx/w as `mouth` so the lip width matches;
|
|
1256
1257
|
// its top edge (not center) lines up with the closed mouth's top edge since
|
|
@@ -1259,32 +1260,33 @@ var DEFAULT_LAYOUT = {
|
|
|
1259
1260
|
mouth_open: {
|
|
1260
1261
|
src: "mouth_open.png",
|
|
1261
1262
|
cx: 550,
|
|
1262
|
-
cy:
|
|
1263
|
-
w:
|
|
1263
|
+
cy: 596,
|
|
1264
|
+
w: 76,
|
|
1264
1265
|
optional: true
|
|
1265
1266
|
},
|
|
1266
1267
|
// eye_* (sclera) and lash_* share the eyewhite's cropped frame via noTrim (so
|
|
1267
1268
|
// they are NOT re-bboxed independently): the upper lash stays anchored ABOVE
|
|
1268
1269
|
// the sclera center, so on blink it folds DOWN over the eye like the sample
|
|
1269
1270
|
// model instead of the whole eye shrinking in place. Same cx/cy/w.
|
|
1270
|
-
eye_L: { src: "eyewhite_sclera.png", cx:
|
|
1271
|
+
eye_L: { src: "eyewhite_sclera.png", cx: 636, cy: 475, w: EYE_W, mirror: true, noTrim: true },
|
|
1271
1272
|
// prettier-ignore
|
|
1272
|
-
eye_R: { src: "eyewhite_sclera.png", cx:
|
|
1273
|
+
eye_R: { src: "eyewhite_sclera.png", cx: 464, cy: 475, w: EYE_W, mirror: false, noTrim: true },
|
|
1273
1274
|
// prettier-ignore
|
|
1274
|
-
|
|
1275
|
-
|
|
1275
|
+
// A little under the white's centre and toward the nose, as bob's sits.
|
|
1276
|
+
iris_L: { src: "iris.png", cx: 631, cy: 480, w: IRIS_W, mirror: false },
|
|
1277
|
+
iris_R: { src: "iris.png", cx: 469, cy: 480, w: IRIS_W, mirror: false },
|
|
1276
1278
|
lash_L: {
|
|
1277
1279
|
src: "eyewhite_lash.png",
|
|
1278
|
-
cx:
|
|
1280
|
+
cx: 636,
|
|
1279
1281
|
cy: 475,
|
|
1280
1282
|
w: EYE_W,
|
|
1281
1283
|
mirror: true,
|
|
1282
1284
|
noTrim: true
|
|
1283
1285
|
},
|
|
1284
|
-
lash_R: { src: "eyewhite_lash.png", cx:
|
|
1286
|
+
lash_R: { src: "eyewhite_lash.png", cx: 464, cy: 475, w: EYE_W, mirror: false, noTrim: true },
|
|
1285
1287
|
// prettier-ignore
|
|
1286
|
-
brow_L: { src: "brow.png", cx: 645, cy: 405, w:
|
|
1287
|
-
brow_R: { src: "brow.png", cx: 455, cy: 405, w:
|
|
1288
|
+
brow_L: { src: "brow.png", cx: 645, cy: 405, w: 105, mirror: false },
|
|
1289
|
+
brow_R: { src: "brow.png", cx: 455, cy: 405, w: 105, mirror: true },
|
|
1288
1290
|
hair_front: { src: "hair_front.png", cx: 550, cy: 425, w: 660 }
|
|
1289
1291
|
};
|
|
1290
1292
|
var LOWER_LASH = { lash_lower_L: "eye_L", lash_lower_R: "eye_R" };
|
|
@@ -1316,9 +1318,24 @@ var PART_FILES = [
|
|
|
1316
1318
|
),
|
|
1317
1319
|
EYEWHITE_SRC
|
|
1318
1320
|
];
|
|
1321
|
+
var FACE_FEATURES = [
|
|
1322
|
+
"blush_L",
|
|
1323
|
+
"blush_R",
|
|
1324
|
+
"mouth",
|
|
1325
|
+
"mouth_open",
|
|
1326
|
+
"eye_L",
|
|
1327
|
+
"eye_R",
|
|
1328
|
+
"iris_L",
|
|
1329
|
+
"iris_R",
|
|
1330
|
+
"lash_L",
|
|
1331
|
+
"lash_R",
|
|
1332
|
+
"brow_L",
|
|
1333
|
+
"brow_R"
|
|
1334
|
+
];
|
|
1319
1335
|
function resolveLayout(overrides) {
|
|
1320
1336
|
const resolved = { ...DEFAULT_LAYOUT };
|
|
1321
1337
|
if (overrides === void 0) return resolved;
|
|
1338
|
+
const sets = /* @__PURE__ */ new Map();
|
|
1322
1339
|
for (const [role, override] of Object.entries(overrides)) {
|
|
1323
1340
|
if (!Object.prototype.hasOwnProperty.call(DEFAULT_LAYOUT, role)) {
|
|
1324
1341
|
throw new AutoRigInputError(
|
|
@@ -1347,9 +1364,30 @@ function resolveLayout(overrides) {
|
|
|
1347
1364
|
}
|
|
1348
1365
|
set[field] = value;
|
|
1349
1366
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1367
|
+
sets.set(role, set);
|
|
1368
|
+
}
|
|
1369
|
+
const face = { ...resolved.face, ...sets.get("face") };
|
|
1370
|
+
resolved.face = face;
|
|
1371
|
+
const base = DEFAULT_LAYOUT.face;
|
|
1372
|
+
const scale = face.w / base.w;
|
|
1373
|
+
const x = (cx) => face.cx + (cx - base.cx) * scale;
|
|
1374
|
+
const w = (width) => Math.max(1, Math.round(width * scale));
|
|
1375
|
+
for (const role of FACE_FEATURES) {
|
|
1376
|
+
const d = DEFAULT_LAYOUT[role];
|
|
1377
|
+
const cy = face.cy + (d.cy - base.cy) * scale;
|
|
1378
|
+
resolved[role] = { ...d, cx: x(d.cx), cy, w: w(d.w), ...sets.get(role) };
|
|
1379
|
+
}
|
|
1380
|
+
const nose = DEFAULT_LAYOUT.nose;
|
|
1381
|
+
resolved.nose = {
|
|
1382
|
+
...nose,
|
|
1383
|
+
cx: x(nose.cx),
|
|
1384
|
+
w: w(nose.w),
|
|
1385
|
+
...sets.get("nose")
|
|
1386
|
+
};
|
|
1387
|
+
for (const [role, set] of sets) {
|
|
1388
|
+
if (role === "face" || role === "nose") continue;
|
|
1389
|
+
if (FACE_FEATURES.includes(role)) continue;
|
|
1390
|
+
resolved[role] = { ...resolved[role], ...set };
|
|
1353
1391
|
}
|
|
1354
1392
|
return resolved;
|
|
1355
1393
|
}
|
|
@@ -1801,7 +1839,7 @@ async function composeLayersFromParts(input) {
|
|
|
1801
1839
|
|
|
1802
1840
|
// src/server.ts
|
|
1803
1841
|
function createIkiMcpServer() {
|
|
1804
|
-
const server = new import_mcp.McpServer({ name: "iki", version: "0.
|
|
1842
|
+
const server = new import_mcp.McpServer({ name: "iki", version: "0.16.0" });
|
|
1805
1843
|
server.registerTool(
|
|
1806
1844
|
"validate_iki",
|
|
1807
1845
|
{
|
|
@@ -1938,7 +1976,7 @@ function createIkiMcpServer() {
|
|
|
1938
1976
|
h: import_zod.z.number()
|
|
1939
1977
|
}).partial()
|
|
1940
1978
|
).optional().describe(
|
|
1941
|
-
"Per-role override merged over the built-in defaults, keyed by role \u2014 hair_back, body, face, blush_L, blush_R, nose, mouth, mouth_open, eye_L, eye_R, iris_L, iris_R, lash_L, lash_R, brow_L, brow_R, hair_front \u2014 e.g. `{ eye_L: { cx: 660 } }`. `w` and `h` are integers in 1..1100; omit `h` to keep the part's own aspect, set it to stretch. 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.
|
|
1979
|
+
"Per-role override merged over the built-in defaults, keyed by role \u2014 hair_back, body, face, blush_L, blush_R, nose, mouth, mouth_open, eye_L, eye_R, iris_L, iris_R, lash_L, lash_R, brow_L, brow_R, hair_front \u2014 e.g. `{ eye_L: { cx: 660 } }`. `w` and `h` are integers in 1..1100; omit `h` to keep the part's own aspect, set it to stretch. The defaults of the face's features \u2014 blush, nose, mouth, mouth_open, 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."
|
|
1942
1980
|
),
|
|
1943
1981
|
mirrorParts: import_zod.z.array(import_zod.z.string()).optional().describe(
|
|
1944
1982
|
"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), and 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); 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."
|