@ikijs/mcp 0.11.3 → 0.12.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
@@ -408,6 +408,17 @@ async function autoRigFromLayers(input) {
408
408
  `quantizeColors must be an integer in 2..256, got ${String(quantizeColors)}`
409
409
  );
410
410
  }
411
+ const turnTargets = input.turnTargets;
412
+ if (turnTargets !== void 0) {
413
+ if (typeof turnTargets !== "object" || turnTargets === null || Array.isArray(turnTargets)) {
414
+ throw new AutoRigInputError("turnTargets must be a plain object");
415
+ }
416
+ if (turnTargets.headHalfWidth !== void 0) {
417
+ throw new AutoRigInputError(
418
+ "turnTargets.headHalfWidth is measured off the layers, not accepted as input"
419
+ );
420
+ }
421
+ }
411
422
  const resolvedLayers = layers.map((layer) => {
412
423
  const resolved = resolveInputPath(layer.path);
413
424
  return { resolved, fileName: layer.fileName ?? import_node_path2.default.basename(resolved) };
@@ -473,22 +484,18 @@ async function autoRigFromLayers(input) {
473
484
  let turn;
474
485
  let model;
475
486
  try {
476
- const { eyeShift, farEyeRatio, silhouetteRatio, noseShift, mouthShift } = input.turnTargets ?? {};
477
487
  model = (0, import_editor2.generateIkiFromLayerSet)(
478
488
  measurement.layers,
479
489
  { width: canvasW, height: canvasH },
480
490
  {
481
491
  turnTargets: {
482
- eyeShift,
483
- farEyeRatio,
484
- silhouetteRatio,
485
- noseShift,
486
- mouthShift,
492
+ ...input.turnTargets,
487
493
  ...turnOptions.turnTargets
488
494
  },
489
495
  onTurnSolved: (report) => {
490
496
  turn = report;
491
497
  },
498
+ ...input.style === void 0 ? {} : { style: input.style },
492
499
  ...headEdges === void 0 ? {} : { headEdges },
493
500
  ...strandEdges === void 0 ? {} : { strandEdges }
494
501
  }
@@ -1216,9 +1223,8 @@ var DEFAULT_LAYOUT = {
1216
1223
  // Back hair and body sit behind the face. Both are OPTIONAL: a parts dir
1217
1224
  // without them still composes (head-only character).
1218
1225
  hair_back: { src: "hair_back.png", cx: 550, cy: 523, w: 800, optional: true },
1219
- // The torso, cut off by the canvas bottom. It rides its own `bodyDeformer`: a
1220
- // light share of the head turn and half its breath bob, so the character is
1221
- // not a floating head.
1226
+ // The torso, cut off by the canvas bottom, so the character is not a
1227
+ // floating head. It rides its own `bodyDeformer`, which only breathes.
1222
1228
  body: { src: "body.png", cx: 550, cy: 1017, w: 840, optional: true },
1223
1229
  face: { src: "face.png", cx: 550, cy: 475, w: 400 },
1224
1230
  // The nose, drawn on its own (the face is drawn without one): the auto-rig
@@ -1599,7 +1605,7 @@ async function composeLayersFromParts(input) {
1599
1605
 
1600
1606
  // src/server.ts
1601
1607
  function createIkiMcpServer() {
1602
- const server = new import_mcp.McpServer({ name: "iki", version: "0.11.3" });
1608
+ const server = new import_mcp.McpServer({ name: "iki", version: "0.12.0" });
1603
1609
  server.registerTool(
1604
1610
  "validate_iki",
1605
1611
  {
@@ -1686,8 +1692,18 @@ function createIkiMcpServer() {
1686
1692
  silhouetteRatio: import_zod.z.number().optional(),
1687
1693
  noseShift: import_zod.z.number().optional(),
1688
1694
  mouthShift: import_zod.z.number().optional()
1689
- }).optional().describe(
1690
- "What the head turn is fitted to, as `measure_turn_reference` reports it off a front/turned reference pair. `eyeShift` (and the optional `noseShift`/`mouthShift`, derived from it when absent) is how far that feature slides across the head at full turn, as a fraction of the head's half-width \u2014 a MAGNITUDE: the rig turns both ways, so the sign is ignored. `farEyeRatio` is the far/near eye width at full turn over that same ratio at rest, `silhouetteRatio` the head's half-width turned over at rest. The half-width the shifts are fractions of is measured off the layers themselves, so it is not an input. An omitted field falls back to a default, which is clamped to what this layer set can do, and so is a passed `eyeShift` past the room the art leaves the far eye \u2014 the face plate's edge, or the bangs' side strand over the far iris (the result's `turn.clamped` lists every clamped field, `turn.achieved` what the rig reaches, and `turn.strandOverlap` how much of a far iris the bangs still cover). Any other passed target this layer set cannot reach, including an `eyeShift` smaller than the slide the face's own turn already gives the eyes, comes back as `INVALID: \u2026` naming the field and the attainable range, since it is a measurement rather than a preference \u2014 except a passed `silhouetteRatio` when no ratio in its whole accepted range renders on this layer set: that refusal reads `\u2026 is unreachable for this layer set, and so is every silhouetteRatio in [0.5, 1.5]` and names no range, so leave the field out, since a defaulted one clamps."
1695
+ }).passthrough().optional().describe(
1696
+ "What the head turn is fitted to, as `measure_turn_reference` reports it off a front/turned reference pair. `eyeShift` (and the optional `noseShift`/`mouthShift`) is how far that feature slides across the head at full turn, as a fraction of the head's half-width \u2014 a MAGNITUDE: the rig turns both ways, so the sign is ignored. `farEyeRatio` is the far/near eye width at full turn over that same ratio at rest, `silhouetteRatio` the head's half-width turned over at rest. The half-width the shifts are fractions of is measured off the layers themselves, so it is not an input. An omitted field leaves that part of the turn at the Live2D profile the rig defaults to. A passed `eyeShift` is fitted by the turn's amount and clamped to the room the art leaves the far eye \u2014 the face plate's edge, or the bangs' side strand over the far iris (the result's `turn.clamped` lists every clamped field, `turn.achieved` what the rig reaches, and `turn.strandOverlap` how much of a far iris the bangs still cover). Any other passed target this layer set cannot reach comes back as `INVALID: \u2026` naming the field and the attainable range, since it is a measurement rather than a preference. A field not named here is refused the same way."
1697
+ ),
1698
+ style: import_zod.z.object({
1699
+ turn: import_zod.z.number().optional(),
1700
+ featureLead: import_zod.z.number().optional(),
1701
+ hairFollow: import_zod.z.number().optional(),
1702
+ outlineFollow: import_zod.z.number().optional(),
1703
+ blink: import_zod.z.number().optional(),
1704
+ sway: import_zod.z.number().optional()
1705
+ }).passthrough().optional().describe(
1706
+ "Per-character tuning from the Live2D profile the rig defaults to \u2014 only what the Live2D samples themselves disagree on: `turn` scales the whole head turn (plate, features, hair and the eyes' foreshortening; 0..3, 1 = the profile; ignored when `turnTargets.eyeShift` is given), `featureLead` how far the features lead the face plate (0..3, 1 = the profile), `hairFollow` the front hair's share of the face's turn (0..2, profile 1.1), `outlineFollow` its outer edge's share where the front hair draws the head's outline (0..2, profile 0: the outline holds), `blink` how far the upper lid comes down over the eye's height (0.1..1, profile 0.58), `sway` the hair sway amplitude (0..5, 1 = the profile). A value out of range, or a knob not named here, comes back as `INVALID: \u2026`."
1691
1707
  )
1692
1708
  }
1693
1709
  },