@ikijs/mcp 0.15.0 → 0.17.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.js CHANGED
@@ -288,12 +288,24 @@ function describeIki(model) {
288
288
  return entry;
289
289
  }
290
290
  );
291
+ const expressions = (m.expressions ?? []).map((e) => ({
292
+ id: e.id,
293
+ description: e.description
294
+ }));
295
+ const motions = Object.fromEntries(
296
+ Object.entries(m.motions ?? {}).map(([group, clips]) => [
297
+ group,
298
+ clips.map((c) => c.description)
299
+ ])
300
+ );
291
301
  const summary = {
292
302
  name: m.name,
293
303
  canvas: { width: m.canvas.width, height: m.canvas.height },
294
304
  parameters,
295
305
  parts,
296
- deformers
306
+ deformers,
307
+ expressions,
308
+ motions
297
309
  };
298
310
  return { ok: true, summary };
299
311
  }
@@ -354,6 +366,10 @@ var STANDARD_PARAMETER_INFO = [
354
366
  id: import_format.StandardParameter.BrowRightAngle,
355
367
  description: "Right brow tilt/angle (-1 .. 1)."
356
368
  },
369
+ {
370
+ id: import_format.StandardParameter.Cheek,
371
+ description: "Cheek blush strength (0 .. 1), raised by an expression."
372
+ },
357
373
  {
358
374
  id: import_format.StandardParameter.HairSwayX,
359
375
  description: "Horizontal hair-sway driver. Physics OUTPUT \u2014 driven by the spring, hosts should not set it directly."
@@ -1214,14 +1230,14 @@ function formatMeasureReport(result) {
1214
1230
 
1215
1231
  // src/compose.ts
1216
1232
  var CANVAS = 1100;
1217
- var EYE_W = 128;
1218
- var IRIS_W = Math.round(EYE_W * 0.5625);
1233
+ var EYE_W = 98;
1234
+ var IRIS_W = 50;
1219
1235
  var EYEWHITE_SRC = "eyewhite.png";
1220
1236
  var EYE_LASH_LUMA = 120;
1221
1237
  var LASH_KEEP_FRACTION = 0.5;
1222
1238
  var TRIM_THRESHOLD = 12;
1223
1239
  var STRAY_SPECK_FRACTION = 0.01;
1224
- var NOSE_TIP_AT = 0.86;
1240
+ var NOSE_TIP_AT = 0.66;
1225
1241
  var DEFAULT_LAYOUT = {
1226
1242
  // Back hair and body sit behind the face. Both are OPTIONAL: a parts dir
1227
1243
  // without them still composes (head-only character).
@@ -1229,19 +1245,19 @@ var DEFAULT_LAYOUT = {
1229
1245
  // The torso, cut off by the canvas bottom, so the character is not a
1230
1246
  // floating head. It rides its own `bodyDeformer`, which only breathes.
1231
1247
  body: { src: "body.png", cx: 550, cy: 1017, w: 840, optional: true },
1232
- face: { src: "face.png", cx: 550, cy: 475, w: 400 },
1248
+ // The face is drawn without a neck, so its box is the skull and centres
1249
+ // above the eye row (bob's skull at 437 against his eyes' 475).
1250
+ face: { src: "face.png", cx: 550, cy: 437, w: 400 },
1233
1251
  // The cheek blush, one part for both cheeks: blush_R (screen left) takes it
1234
1252
  // 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 just outside the
1236
- // eye's centre and above the nose tip. Tuned on the hero's face at its
1237
- // default placement, which narrows fast below the eye row: a 96-wide box at
1238
- // row 552 ran up to 24 px past the cheek's drawn outline (inside the ears),
1239
- // and this one, for a 2:1 blush, stays inside it by 1 px at its lower outer
1240
- // corner. OPTIONAL, and decoration: a parts dir without it composes, and
1241
- // nothing reports it missing.
1242
- blush_L: { src: "blush.png", cx: 662, cy: 530, w: 56, optional: true, mirror: true },
1253
+ // and under the nose. Its box sits below each eye, centred 5 px outside the
1254
+ // eye's centre and 55 px under its row, above the nose tip: on bob's face,
1255
+ // which narrows fast below the eye row, a 2:1 blush there stays on the
1256
+ // cheek through the turn, where one 26 px further out reached the ears.
1257
+ // OPTIONAL: a parts dir without it composes, and nothing reports it missing.
1258
+ blush_L: { src: "blush.png", cx: 641, cy: 530, w: 56, optional: true, mirror: true },
1243
1259
  // prettier-ignore
1244
- blush_R: { src: "blush.png", cx: 438, cy: 530, w: 56, optional: true, mirror: false },
1260
+ blush_R: { src: "blush.png", cx: 459, cy: 530, w: 56, optional: true, mirror: false },
1245
1261
  // prettier-ignore
1246
1262
  // The nose, drawn on its own (the face is drawn without one): the auto-rig
1247
1263
  // leads the head turn with it and keys the other features' slide on its
@@ -1249,8 +1265,8 @@ var DEFAULT_LAYOUT = {
1249
1265
  // width of its dense core, and it has no `cy`: its row comes from the tip
1250
1266
  // rule (NOSE_TIP_AT), between the eyes and the mouth, so it follows them
1251
1267
  // when they are retuned. OPTIONAL: a parts dir without it composes.
1252
- nose: { src: "nose.png", cx: 550, w: 40, optional: true },
1253
- mouth: { src: "mouth.png", cx: 550, cy: 619, w: 68 },
1268
+ nose: { src: "nose.png", cx: 550, w: 20, optional: true },
1269
+ mouth: { src: "mouth.png", cx: 550, cy: 594, w: 76 },
1254
1270
  // Cross-fades with `mouth` on ParamMouthOpenY (opacity, not scaleY) once the
1255
1271
  // auto-rig sees both roles. Same cx/w as `mouth` so the lip width matches;
1256
1272
  // its top edge (not center) lines up with the closed mouth's top edge since
@@ -1259,32 +1275,33 @@ var DEFAULT_LAYOUT = {
1259
1275
  mouth_open: {
1260
1276
  src: "mouth_open.png",
1261
1277
  cx: 550,
1262
- cy: 621,
1263
- w: 68,
1278
+ cy: 596,
1279
+ w: 76,
1264
1280
  optional: true
1265
1281
  },
1266
1282
  // eye_* (sclera) and lash_* share the eyewhite's cropped frame via noTrim (so
1267
1283
  // they are NOT re-bboxed independently): the upper lash stays anchored ABOVE
1268
1284
  // the sclera center, so on blink it folds DOWN over the eye like the sample
1269
1285
  // model instead of the whole eye shrinking in place. Same cx/cy/w.
1270
- eye_L: { src: "eyewhite_sclera.png", cx: 657, cy: 475, w: EYE_W, mirror: true, noTrim: true },
1286
+ eye_L: { src: "eyewhite_sclera.png", cx: 636, cy: 475, w: EYE_W, mirror: true, noTrim: true },
1271
1287
  // prettier-ignore
1272
- eye_R: { src: "eyewhite_sclera.png", cx: 443, cy: 475, w: EYE_W, mirror: false, noTrim: true },
1288
+ eye_R: { src: "eyewhite_sclera.png", cx: 464, cy: 475, w: EYE_W, mirror: false, noTrim: true },
1273
1289
  // prettier-ignore
1274
- iris_L: { src: "iris.png", cx: 653, cy: 475, w: IRIS_W, mirror: false },
1275
- iris_R: { src: "iris.png", cx: 447, cy: 475, w: IRIS_W, mirror: false },
1290
+ // A little under the white's centre and toward the nose, as bob's sits.
1291
+ iris_L: { src: "iris.png", cx: 631, cy: 480, w: IRIS_W, mirror: false },
1292
+ iris_R: { src: "iris.png", cx: 469, cy: 480, w: IRIS_W, mirror: false },
1276
1293
  lash_L: {
1277
1294
  src: "eyewhite_lash.png",
1278
- cx: 657,
1295
+ cx: 636,
1279
1296
  cy: 475,
1280
1297
  w: EYE_W,
1281
1298
  mirror: true,
1282
1299
  noTrim: true
1283
1300
  },
1284
- lash_R: { src: "eyewhite_lash.png", cx: 443, cy: 475, w: EYE_W, mirror: false, noTrim: true },
1301
+ lash_R: { src: "eyewhite_lash.png", cx: 464, cy: 475, w: EYE_W, mirror: false, noTrim: true },
1285
1302
  // prettier-ignore
1286
- brow_L: { src: "brow.png", cx: 645, cy: 405, w: 135, mirror: false },
1287
- brow_R: { src: "brow.png", cx: 455, cy: 405, w: 135, mirror: true },
1303
+ brow_L: { src: "brow.png", cx: 645, cy: 405, w: 105, mirror: false },
1304
+ brow_R: { src: "brow.png", cx: 455, cy: 405, w: 105, mirror: true },
1288
1305
  hair_front: { src: "hair_front.png", cx: 550, cy: 425, w: 660 }
1289
1306
  };
1290
1307
  var LOWER_LASH = { lash_lower_L: "eye_L", lash_lower_R: "eye_R" };
@@ -1316,9 +1333,24 @@ var PART_FILES = [
1316
1333
  ),
1317
1334
  EYEWHITE_SRC
1318
1335
  ];
1336
+ var FACE_FEATURES = [
1337
+ "blush_L",
1338
+ "blush_R",
1339
+ "mouth",
1340
+ "mouth_open",
1341
+ "eye_L",
1342
+ "eye_R",
1343
+ "iris_L",
1344
+ "iris_R",
1345
+ "lash_L",
1346
+ "lash_R",
1347
+ "brow_L",
1348
+ "brow_R"
1349
+ ];
1319
1350
  function resolveLayout(overrides) {
1320
1351
  const resolved = { ...DEFAULT_LAYOUT };
1321
1352
  if (overrides === void 0) return resolved;
1353
+ const sets = /* @__PURE__ */ new Map();
1322
1354
  for (const [role, override] of Object.entries(overrides)) {
1323
1355
  if (!Object.prototype.hasOwnProperty.call(DEFAULT_LAYOUT, role)) {
1324
1356
  throw new AutoRigInputError(
@@ -1347,9 +1379,30 @@ function resolveLayout(overrides) {
1347
1379
  }
1348
1380
  set[field] = value;
1349
1381
  }
1350
- const key = role;
1351
- if (key === "nose") resolved.nose = { ...resolved.nose, ...set };
1352
- else resolved[key] = { ...resolved[key], ...set };
1382
+ sets.set(role, set);
1383
+ }
1384
+ const face = { ...resolved.face, ...sets.get("face") };
1385
+ resolved.face = face;
1386
+ const base = DEFAULT_LAYOUT.face;
1387
+ const scale = face.w / base.w;
1388
+ const x = (cx) => face.cx + (cx - base.cx) * scale;
1389
+ const w = (width) => Math.max(1, Math.round(width * scale));
1390
+ for (const role of FACE_FEATURES) {
1391
+ const d = DEFAULT_LAYOUT[role];
1392
+ const cy = face.cy + (d.cy - base.cy) * scale;
1393
+ resolved[role] = { ...d, cx: x(d.cx), cy, w: w(d.w), ...sets.get(role) };
1394
+ }
1395
+ const nose = DEFAULT_LAYOUT.nose;
1396
+ resolved.nose = {
1397
+ ...nose,
1398
+ cx: x(nose.cx),
1399
+ w: w(nose.w),
1400
+ ...sets.get("nose")
1401
+ };
1402
+ for (const [role, set] of sets) {
1403
+ if (role === "face" || role === "nose") continue;
1404
+ if (FACE_FEATURES.includes(role)) continue;
1405
+ resolved[role] = { ...resolved[role], ...set };
1353
1406
  }
1354
1407
  return resolved;
1355
1408
  }
@@ -1801,7 +1854,7 @@ async function composeLayersFromParts(input) {
1801
1854
 
1802
1855
  // src/server.ts
1803
1856
  function createIkiMcpServer() {
1804
- const server = new import_mcp.McpServer({ name: "iki", version: "0.15.0" });
1857
+ const server = new import_mcp.McpServer({ name: "iki", version: "0.17.0" });
1805
1858
  server.registerTool(
1806
1859
  "validate_iki",
1807
1860
  {
@@ -1828,7 +1881,7 @@ function createIkiMcpServer() {
1828
1881
  server.registerTool(
1829
1882
  "describe_iki",
1830
1883
  {
1831
- description: "Summarizes a valid model's canvas/params/parts/deformers; returns an error for an invalid model.",
1884
+ description: "Summarizes a valid model's canvas/params/parts/deformers and its expressions and motion clips (with the descriptions a host picks them by); returns an error for an invalid model.",
1832
1885
  inputSchema: {
1833
1886
  model: import_zod.z.unknown().describe("Raw .iki model JSON (object or JSON string)")
1834
1887
  }
@@ -1938,7 +1991,7 @@ function createIkiMcpServer() {
1938
1991
  h: import_zod.z.number()
1939
1992
  }).partial()
1940
1993
  ).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.86 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."
1994
+ "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
1995
  ),
1943
1996
  mirrorParts: import_zod.z.array(import_zod.z.string()).optional().describe(
1944
1997
  "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."