@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/README.md +3 -3
- package/dist/{chunk-V2FRFOKX.mjs → chunk-NNFD636K.mjs} +86 -33
- package/dist/chunk-NNFD636K.mjs.map +1 -0
- package/dist/cli.js +85 -32
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +85 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-V2FRFOKX.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -26,6 +26,13 @@ interface IkiSummary {
|
|
|
26
26
|
deformer?: string;
|
|
27
27
|
}[];
|
|
28
28
|
deformers: DeformerSummary[];
|
|
29
|
+
/** Each expression's id and the description a host picks it by. */
|
|
30
|
+
expressions: {
|
|
31
|
+
id: string;
|
|
32
|
+
description: string;
|
|
33
|
+
}[];
|
|
34
|
+
/** Each motion group's clip descriptions, by clip index. */
|
|
35
|
+
motions: Record<string, string[]>;
|
|
29
36
|
}
|
|
30
37
|
interface DeformerSummary {
|
|
31
38
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,13 @@ interface IkiSummary {
|
|
|
26
26
|
deformer?: string;
|
|
27
27
|
}[];
|
|
28
28
|
deformers: DeformerSummary[];
|
|
29
|
+
/** Each expression's id and the description a host picks it by. */
|
|
30
|
+
expressions: {
|
|
31
|
+
id: string;
|
|
32
|
+
description: string;
|
|
33
|
+
}[];
|
|
34
|
+
/** Each motion group's clip descriptions, by clip index. */
|
|
35
|
+
motions: Record<string, string[]>;
|
|
29
36
|
}
|
|
30
37
|
interface DeformerSummary {
|
|
31
38
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -304,12 +304,24 @@ function describeIki(model) {
|
|
|
304
304
|
return entry;
|
|
305
305
|
}
|
|
306
306
|
);
|
|
307
|
+
const expressions = (m.expressions ?? []).map((e) => ({
|
|
308
|
+
id: e.id,
|
|
309
|
+
description: e.description
|
|
310
|
+
}));
|
|
311
|
+
const motions = Object.fromEntries(
|
|
312
|
+
Object.entries(m.motions ?? {}).map(([group, clips]) => [
|
|
313
|
+
group,
|
|
314
|
+
clips.map((c) => c.description)
|
|
315
|
+
])
|
|
316
|
+
);
|
|
307
317
|
const summary = {
|
|
308
318
|
name: m.name,
|
|
309
319
|
canvas: { width: m.canvas.width, height: m.canvas.height },
|
|
310
320
|
parameters,
|
|
311
321
|
parts,
|
|
312
|
-
deformers
|
|
322
|
+
deformers,
|
|
323
|
+
expressions,
|
|
324
|
+
motions
|
|
313
325
|
};
|
|
314
326
|
return { ok: true, summary };
|
|
315
327
|
}
|
|
@@ -370,6 +382,10 @@ var STANDARD_PARAMETER_INFO = [
|
|
|
370
382
|
id: import_format.StandardParameter.BrowRightAngle,
|
|
371
383
|
description: "Right brow tilt/angle (-1 .. 1)."
|
|
372
384
|
},
|
|
385
|
+
{
|
|
386
|
+
id: import_format.StandardParameter.Cheek,
|
|
387
|
+
description: "Cheek blush strength (0 .. 1), raised by an expression."
|
|
388
|
+
},
|
|
373
389
|
{
|
|
374
390
|
id: import_format.StandardParameter.HairSwayX,
|
|
375
391
|
description: "Horizontal hair-sway driver. Physics OUTPUT \u2014 driven by the spring, hosts should not set it directly."
|
|
@@ -1230,14 +1246,14 @@ function formatMeasureReport(result) {
|
|
|
1230
1246
|
|
|
1231
1247
|
// src/compose.ts
|
|
1232
1248
|
var CANVAS = 1100;
|
|
1233
|
-
var EYE_W =
|
|
1234
|
-
var IRIS_W =
|
|
1249
|
+
var EYE_W = 98;
|
|
1250
|
+
var IRIS_W = 50;
|
|
1235
1251
|
var EYEWHITE_SRC = "eyewhite.png";
|
|
1236
1252
|
var EYE_LASH_LUMA = 120;
|
|
1237
1253
|
var LASH_KEEP_FRACTION = 0.5;
|
|
1238
1254
|
var TRIM_THRESHOLD = 12;
|
|
1239
1255
|
var STRAY_SPECK_FRACTION = 0.01;
|
|
1240
|
-
var NOSE_TIP_AT = 0.
|
|
1256
|
+
var NOSE_TIP_AT = 0.66;
|
|
1241
1257
|
var DEFAULT_LAYOUT = {
|
|
1242
1258
|
// Back hair and body sit behind the face. Both are OPTIONAL: a parts dir
|
|
1243
1259
|
// without them still composes (head-only character).
|
|
@@ -1245,19 +1261,19 @@ var DEFAULT_LAYOUT = {
|
|
|
1245
1261
|
// The torso, cut off by the canvas bottom, so the character is not a
|
|
1246
1262
|
// floating head. It rides its own `bodyDeformer`, which only breathes.
|
|
1247
1263
|
body: { src: "body.png", cx: 550, cy: 1017, w: 840, optional: true },
|
|
1248
|
-
face
|
|
1264
|
+
// The face is drawn without a neck, so its box is the skull and centres
|
|
1265
|
+
// above the eye row (bob's skull at 437 against his eyes' 475).
|
|
1266
|
+
face: { src: "face.png", cx: 550, cy: 437, w: 400 },
|
|
1249
1267
|
// The cheek blush, one part for both cheeks: blush_R (screen left) takes it
|
|
1250
1268
|
// as drawn and blush_L mirrors it, like the eyewhite. It draws over the face
|
|
1251
|
-
// and under the nose. Its box sits below each eye, centred
|
|
1252
|
-
// eye's centre and above the nose tip
|
|
1253
|
-
//
|
|
1254
|
-
//
|
|
1255
|
-
//
|
|
1256
|
-
|
|
1257
|
-
// nothing reports it missing.
|
|
1258
|
-
blush_L: { src: "blush.png", cx: 662, cy: 530, w: 56, optional: true, mirror: true },
|
|
1269
|
+
// and under the nose. Its box sits below each eye, centred 5 px outside the
|
|
1270
|
+
// eye's centre and 55 px under its row, above the nose tip: on bob's face,
|
|
1271
|
+
// which narrows fast below the eye row, a 2:1 blush there stays on the
|
|
1272
|
+
// cheek through the turn, where one 26 px further out reached the ears.
|
|
1273
|
+
// OPTIONAL: a parts dir without it composes, and nothing reports it missing.
|
|
1274
|
+
blush_L: { src: "blush.png", cx: 641, cy: 530, w: 56, optional: true, mirror: true },
|
|
1259
1275
|
// prettier-ignore
|
|
1260
|
-
blush_R: { src: "blush.png", cx:
|
|
1276
|
+
blush_R: { src: "blush.png", cx: 459, cy: 530, w: 56, optional: true, mirror: false },
|
|
1261
1277
|
// prettier-ignore
|
|
1262
1278
|
// The nose, drawn on its own (the face is drawn without one): the auto-rig
|
|
1263
1279
|
// leads the head turn with it and keys the other features' slide on its
|
|
@@ -1265,8 +1281,8 @@ var DEFAULT_LAYOUT = {
|
|
|
1265
1281
|
// width of its dense core, and it has no `cy`: its row comes from the tip
|
|
1266
1282
|
// rule (NOSE_TIP_AT), between the eyes and the mouth, so it follows them
|
|
1267
1283
|
// when they are retuned. OPTIONAL: a parts dir without it composes.
|
|
1268
|
-
nose: { src: "nose.png", cx: 550, w:
|
|
1269
|
-
mouth: { src: "mouth.png", cx: 550, cy:
|
|
1284
|
+
nose: { src: "nose.png", cx: 550, w: 20, optional: true },
|
|
1285
|
+
mouth: { src: "mouth.png", cx: 550, cy: 594, w: 76 },
|
|
1270
1286
|
// Cross-fades with `mouth` on ParamMouthOpenY (opacity, not scaleY) once the
|
|
1271
1287
|
// auto-rig sees both roles. Same cx/w as `mouth` so the lip width matches;
|
|
1272
1288
|
// its top edge (not center) lines up with the closed mouth's top edge since
|
|
@@ -1275,32 +1291,33 @@ var DEFAULT_LAYOUT = {
|
|
|
1275
1291
|
mouth_open: {
|
|
1276
1292
|
src: "mouth_open.png",
|
|
1277
1293
|
cx: 550,
|
|
1278
|
-
cy:
|
|
1279
|
-
w:
|
|
1294
|
+
cy: 596,
|
|
1295
|
+
w: 76,
|
|
1280
1296
|
optional: true
|
|
1281
1297
|
},
|
|
1282
1298
|
// eye_* (sclera) and lash_* share the eyewhite's cropped frame via noTrim (so
|
|
1283
1299
|
// they are NOT re-bboxed independently): the upper lash stays anchored ABOVE
|
|
1284
1300
|
// the sclera center, so on blink it folds DOWN over the eye like the sample
|
|
1285
1301
|
// model instead of the whole eye shrinking in place. Same cx/cy/w.
|
|
1286
|
-
eye_L: { src: "eyewhite_sclera.png", cx:
|
|
1302
|
+
eye_L: { src: "eyewhite_sclera.png", cx: 636, cy: 475, w: EYE_W, mirror: true, noTrim: true },
|
|
1287
1303
|
// prettier-ignore
|
|
1288
|
-
eye_R: { src: "eyewhite_sclera.png", cx:
|
|
1304
|
+
eye_R: { src: "eyewhite_sclera.png", cx: 464, cy: 475, w: EYE_W, mirror: false, noTrim: true },
|
|
1289
1305
|
// prettier-ignore
|
|
1290
|
-
|
|
1291
|
-
|
|
1306
|
+
// A little under the white's centre and toward the nose, as bob's sits.
|
|
1307
|
+
iris_L: { src: "iris.png", cx: 631, cy: 480, w: IRIS_W, mirror: false },
|
|
1308
|
+
iris_R: { src: "iris.png", cx: 469, cy: 480, w: IRIS_W, mirror: false },
|
|
1292
1309
|
lash_L: {
|
|
1293
1310
|
src: "eyewhite_lash.png",
|
|
1294
|
-
cx:
|
|
1311
|
+
cx: 636,
|
|
1295
1312
|
cy: 475,
|
|
1296
1313
|
w: EYE_W,
|
|
1297
1314
|
mirror: true,
|
|
1298
1315
|
noTrim: true
|
|
1299
1316
|
},
|
|
1300
|
-
lash_R: { src: "eyewhite_lash.png", cx:
|
|
1317
|
+
lash_R: { src: "eyewhite_lash.png", cx: 464, cy: 475, w: EYE_W, mirror: false, noTrim: true },
|
|
1301
1318
|
// prettier-ignore
|
|
1302
|
-
brow_L: { src: "brow.png", cx: 645, cy: 405, w:
|
|
1303
|
-
brow_R: { src: "brow.png", cx: 455, cy: 405, w:
|
|
1319
|
+
brow_L: { src: "brow.png", cx: 645, cy: 405, w: 105, mirror: false },
|
|
1320
|
+
brow_R: { src: "brow.png", cx: 455, cy: 405, w: 105, mirror: true },
|
|
1304
1321
|
hair_front: { src: "hair_front.png", cx: 550, cy: 425, w: 660 }
|
|
1305
1322
|
};
|
|
1306
1323
|
var LOWER_LASH = { lash_lower_L: "eye_L", lash_lower_R: "eye_R" };
|
|
@@ -1332,9 +1349,24 @@ var PART_FILES = [
|
|
|
1332
1349
|
),
|
|
1333
1350
|
EYEWHITE_SRC
|
|
1334
1351
|
];
|
|
1352
|
+
var FACE_FEATURES = [
|
|
1353
|
+
"blush_L",
|
|
1354
|
+
"blush_R",
|
|
1355
|
+
"mouth",
|
|
1356
|
+
"mouth_open",
|
|
1357
|
+
"eye_L",
|
|
1358
|
+
"eye_R",
|
|
1359
|
+
"iris_L",
|
|
1360
|
+
"iris_R",
|
|
1361
|
+
"lash_L",
|
|
1362
|
+
"lash_R",
|
|
1363
|
+
"brow_L",
|
|
1364
|
+
"brow_R"
|
|
1365
|
+
];
|
|
1335
1366
|
function resolveLayout(overrides) {
|
|
1336
1367
|
const resolved = { ...DEFAULT_LAYOUT };
|
|
1337
1368
|
if (overrides === void 0) return resolved;
|
|
1369
|
+
const sets = /* @__PURE__ */ new Map();
|
|
1338
1370
|
for (const [role, override] of Object.entries(overrides)) {
|
|
1339
1371
|
if (!Object.prototype.hasOwnProperty.call(DEFAULT_LAYOUT, role)) {
|
|
1340
1372
|
throw new AutoRigInputError(
|
|
@@ -1363,9 +1395,30 @@ function resolveLayout(overrides) {
|
|
|
1363
1395
|
}
|
|
1364
1396
|
set[field] = value;
|
|
1365
1397
|
}
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1398
|
+
sets.set(role, set);
|
|
1399
|
+
}
|
|
1400
|
+
const face = { ...resolved.face, ...sets.get("face") };
|
|
1401
|
+
resolved.face = face;
|
|
1402
|
+
const base = DEFAULT_LAYOUT.face;
|
|
1403
|
+
const scale = face.w / base.w;
|
|
1404
|
+
const x = (cx) => face.cx + (cx - base.cx) * scale;
|
|
1405
|
+
const w = (width) => Math.max(1, Math.round(width * scale));
|
|
1406
|
+
for (const role of FACE_FEATURES) {
|
|
1407
|
+
const d = DEFAULT_LAYOUT[role];
|
|
1408
|
+
const cy = face.cy + (d.cy - base.cy) * scale;
|
|
1409
|
+
resolved[role] = { ...d, cx: x(d.cx), cy, w: w(d.w), ...sets.get(role) };
|
|
1410
|
+
}
|
|
1411
|
+
const nose = DEFAULT_LAYOUT.nose;
|
|
1412
|
+
resolved.nose = {
|
|
1413
|
+
...nose,
|
|
1414
|
+
cx: x(nose.cx),
|
|
1415
|
+
w: w(nose.w),
|
|
1416
|
+
...sets.get("nose")
|
|
1417
|
+
};
|
|
1418
|
+
for (const [role, set] of sets) {
|
|
1419
|
+
if (role === "face" || role === "nose") continue;
|
|
1420
|
+
if (FACE_FEATURES.includes(role)) continue;
|
|
1421
|
+
resolved[role] = { ...resolved[role], ...set };
|
|
1369
1422
|
}
|
|
1370
1423
|
return resolved;
|
|
1371
1424
|
}
|
|
@@ -1819,7 +1872,7 @@ async function composeLayersFromParts(input) {
|
|
|
1819
1872
|
var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
1820
1873
|
var import_zod = require("zod");
|
|
1821
1874
|
function createIkiMcpServer() {
|
|
1822
|
-
const server = new import_mcp.McpServer({ name: "iki", version: "0.
|
|
1875
|
+
const server = new import_mcp.McpServer({ name: "iki", version: "0.17.0" });
|
|
1823
1876
|
server.registerTool(
|
|
1824
1877
|
"validate_iki",
|
|
1825
1878
|
{
|
|
@@ -1846,7 +1899,7 @@ function createIkiMcpServer() {
|
|
|
1846
1899
|
server.registerTool(
|
|
1847
1900
|
"describe_iki",
|
|
1848
1901
|
{
|
|
1849
|
-
description: "Summarizes a valid model's canvas/params/parts/deformers; returns an error for an invalid model.",
|
|
1902
|
+
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.",
|
|
1850
1903
|
inputSchema: {
|
|
1851
1904
|
model: import_zod.z.unknown().describe("Raw .iki model JSON (object or JSON string)")
|
|
1852
1905
|
}
|
|
@@ -1956,7 +2009,7 @@ function createIkiMcpServer() {
|
|
|
1956
2009
|
h: import_zod.z.number()
|
|
1957
2010
|
}).partial()
|
|
1958
2011
|
).optional().describe(
|
|
1959
|
-
"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.
|
|
2012
|
+
"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."
|
|
1960
2013
|
),
|
|
1961
2014
|
mirrorParts: import_zod.z.array(import_zod.z.string()).optional().describe(
|
|
1962
2015
|
"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."
|