@ikijs/mcp 0.11.3 → 0.12.1

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.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createIkiMcpServer
4
- } from "./chunk-CFP3KTDY.mjs";
4
+ } from "./chunk-EY3AMMEG.mjs";
5
5
 
6
6
  // src/cli.ts
7
7
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { TurnTargets, IrisStrand, TurnSolveReport } from '@ikijs/editor';
1
+ import { TurnTargets, RigStyle, IrisStrand, TurnSolveReport } from '@ikijs/editor';
2
2
  export { TurnSolveReport } from '@ikijs/editor';
3
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
 
@@ -73,6 +73,9 @@ interface AutoRigInput {
73
73
  /** Head-turn cues to fit the rig to, as `measure_turn_reference` reports
74
74
  * them. */
75
75
  turnTargets?: AutoRigTurnTargets;
76
+ /** Per-character tuning from the Live2D profile's defaults (see
77
+ * @ikijs/editor's `RigStyle`). */
78
+ style?: RigStyle;
76
79
  }
77
80
  /** The turn cues a caller may pass, which is every one but `headHalfWidth`:
78
81
  * the pixels the shift fractions are fractions of are measured off the layers
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TurnTargets, IrisStrand, TurnSolveReport } from '@ikijs/editor';
1
+ import { TurnTargets, RigStyle, IrisStrand, TurnSolveReport } from '@ikijs/editor';
2
2
  export { TurnSolveReport } from '@ikijs/editor';
3
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
 
@@ -73,6 +73,9 @@ interface AutoRigInput {
73
73
  /** Head-turn cues to fit the rig to, as `measure_turn_reference` reports
74
74
  * them. */
75
75
  turnTargets?: AutoRigTurnTargets;
76
+ /** Per-character tuning from the Live2D profile's defaults (see
77
+ * @ikijs/editor's `RigStyle`). */
78
+ style?: RigStyle;
76
79
  }
77
80
  /** The turn cues a caller may pass, which is every one but `headHalfWidth`:
78
81
  * the pixels the shift fractions are fractions of are measured off the layers
package/dist/index.js CHANGED
@@ -424,6 +424,17 @@ async function autoRigFromLayers(input) {
424
424
  `quantizeColors must be an integer in 2..256, got ${String(quantizeColors)}`
425
425
  );
426
426
  }
427
+ const turnTargets = input.turnTargets;
428
+ if (turnTargets !== void 0) {
429
+ if (typeof turnTargets !== "object" || turnTargets === null || Array.isArray(turnTargets)) {
430
+ throw new AutoRigInputError("turnTargets must be a plain object");
431
+ }
432
+ if (turnTargets.headHalfWidth !== void 0) {
433
+ throw new AutoRigInputError(
434
+ "turnTargets.headHalfWidth is measured off the layers, not accepted as input"
435
+ );
436
+ }
437
+ }
427
438
  const resolvedLayers = layers.map((layer) => {
428
439
  const resolved = resolveInputPath(layer.path);
429
440
  return { resolved, fileName: layer.fileName ?? import_node_path2.default.basename(resolved) };
@@ -489,22 +500,18 @@ async function autoRigFromLayers(input) {
489
500
  let turn;
490
501
  let model;
491
502
  try {
492
- const { eyeShift, farEyeRatio, silhouetteRatio, noseShift, mouthShift } = input.turnTargets ?? {};
493
503
  model = (0, import_editor2.generateIkiFromLayerSet)(
494
504
  measurement.layers,
495
505
  { width: canvasW, height: canvasH },
496
506
  {
497
507
  turnTargets: {
498
- eyeShift,
499
- farEyeRatio,
500
- silhouetteRatio,
501
- noseShift,
502
- mouthShift,
508
+ ...input.turnTargets,
503
509
  ...turnOptions.turnTargets
504
510
  },
505
511
  onTurnSolved: (report) => {
506
512
  turn = report;
507
513
  },
514
+ ...input.style === void 0 ? {} : { style: input.style },
508
515
  ...headEdges === void 0 ? {} : { headEdges },
509
516
  ...strandEdges === void 0 ? {} : { strandEdges }
510
517
  }
@@ -1172,7 +1179,7 @@ async function measureDir(absDir, noseSpeck) {
1172
1179
  ["hair_back", "without it the silhouette is flat behind the face"],
1173
1180
  [
1174
1181
  "nose",
1175
- "without it nothing on the face slides on the head turn \u2014 the features stay on the plate"
1182
+ "without it the head still turns on the Live2D profile, but there is no nose to lead it, and no turn fit to the art (`turnTargets` is inert, no `turn` report)"
1176
1183
  ]
1177
1184
  ]) {
1178
1185
  if (layers[role] === void 0) warnings.push(`${role}: missing \u2014 ${why}.`);
@@ -1232,9 +1239,8 @@ var DEFAULT_LAYOUT = {
1232
1239
  // Back hair and body sit behind the face. Both are OPTIONAL: a parts dir
1233
1240
  // without them still composes (head-only character).
1234
1241
  hair_back: { src: "hair_back.png", cx: 550, cy: 523, w: 800, optional: true },
1235
- // The torso, cut off by the canvas bottom. It rides its own `bodyDeformer`: a
1236
- // light share of the head turn and half its breath bob, so the character is
1237
- // not a floating head.
1242
+ // The torso, cut off by the canvas bottom, so the character is not a
1243
+ // floating head. It rides its own `bodyDeformer`, which only breathes.
1238
1244
  body: { src: "body.png", cx: 550, cy: 1017, w: 840, optional: true },
1239
1245
  face: { src: "face.png", cx: 550, cy: 475, w: 400 },
1240
1246
  // The nose, drawn on its own (the face is drawn without one): the auto-rig
@@ -1617,7 +1623,7 @@ async function composeLayersFromParts(input) {
1617
1623
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
1618
1624
  var import_zod = require("zod");
1619
1625
  function createIkiMcpServer() {
1620
- const server = new import_mcp.McpServer({ name: "iki", version: "0.11.3" });
1626
+ const server = new import_mcp.McpServer({ name: "iki", version: "0.12.1" });
1621
1627
  server.registerTool(
1622
1628
  "validate_iki",
1623
1629
  {
@@ -1704,8 +1710,18 @@ function createIkiMcpServer() {
1704
1710
  silhouetteRatio: import_zod.z.number().optional(),
1705
1711
  noseShift: import_zod.z.number().optional(),
1706
1712
  mouthShift: import_zod.z.number().optional()
1707
- }).optional().describe(
1708
- "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."
1713
+ }).passthrough().optional().describe(
1714
+ "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."
1715
+ ),
1716
+ style: import_zod.z.object({
1717
+ turn: import_zod.z.number().optional(),
1718
+ featureLead: import_zod.z.number().optional(),
1719
+ hairFollow: import_zod.z.number().optional(),
1720
+ outlineFollow: import_zod.z.number().optional(),
1721
+ blink: import_zod.z.number().optional(),
1722
+ sway: import_zod.z.number().optional()
1723
+ }).passthrough().optional().describe(
1724
+ "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`."
1709
1725
  )
1710
1726
  }
1711
1727
  },
@@ -1727,7 +1743,7 @@ function createIkiMcpServer() {
1727
1743
  server.registerTool(
1728
1744
  "compose_layers_from_parts",
1729
1745
  {
1730
- 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, mouth, eyewhite, iris, brow, hair_front are required; hair_back, body, mouth_open, nose are optional \u2014 without a nose layer the rig does not slide the features on the head turn. 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.",
1746
+ 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, mouth, eyewhite, iris, brow, hair_front are required; hair_back, body, mouth_open, nose are optional \u2014 without a nose layer the head still turns on the rig's Live2D 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). 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.",
1731
1747
  inputSchema: {
1732
1748
  partsDir: import_zod.z.string().describe(
1733
1749
  "Directory of the source part PNGs (resolved against cwd)."