@ikijs/mcp 0.29.0 → 0.30.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
@@ -2759,6 +2759,22 @@ var STANDARD_PARAMETER_INFO = [
2759
2759
  function listStandardParameters() {
2760
2760
  return STANDARD_PARAMETER_INFO.map((p) => ({ ...p }));
2761
2761
  }
2762
+ function describeRigPlan() {
2763
+ return { fields: [...import_editor3.RIG_PLAN_FIELDS] };
2764
+ }
2765
+ function formatRigPlanReport(r) {
2766
+ const fields = import_editor3.RIG_PLAN_FIELDS.map((f) => {
2767
+ const value = `${f.path}=${r.effective[f.path]}`;
2768
+ const clamp2 = r.clamped.find((c) => c.field === f.path);
2769
+ if (clamp2 !== void 0) {
2770
+ const asked = r.requested[f.group]?.[f.key] ?? f.default;
2771
+ return `${value} (requested ${asked}, clamped at ${clamp2.bound})`;
2772
+ }
2773
+ const cue = r.overriddenBy[f.path];
2774
+ return cue === void 0 ? value : `${value} (fitted by ${cue})`;
2775
+ });
2776
+ return `RIGPLAN: ${fields.join(" ")}`;
2777
+ }
2762
2778
  function expectInput(label, fn) {
2763
2779
  try {
2764
2780
  return fn();
@@ -2807,6 +2823,9 @@ async function autoRigFromLayers(input) {
2807
2823
  `quantizeColors must be an integer in 2..256, got ${String(quantizeColors)}`
2808
2824
  );
2809
2825
  }
2826
+ if (input.style !== void 0) {
2827
+ throw new AutoRigInputError((0, import_editor3.styleRemovedMessage)("style"));
2828
+ }
2810
2829
  const turnTargets = input.turnTargets;
2811
2830
  if (turnTargets !== void 0) {
2812
2831
  if (typeof turnTargets !== "object" || turnTargets === null || Array.isArray(turnTargets)) {
@@ -2882,6 +2901,7 @@ async function autoRigFromLayers(input) {
2882
2901
  )?.denseCore;
2883
2902
  let turn;
2884
2903
  let patches;
2904
+ let rigPlan;
2885
2905
  let model;
2886
2906
  try {
2887
2907
  model = (0, import_editor3.generateIkiFromLayerSet)(
@@ -2895,7 +2915,10 @@ async function autoRigFromLayers(input) {
2895
2915
  onTurnSolved: (report) => {
2896
2916
  turn = report;
2897
2917
  },
2898
- ...input.style === void 0 ? {} : { style: input.style },
2918
+ ...input.rigPlan === void 0 ? {} : { rigPlan: input.rigPlan },
2919
+ onRigPlanResolved: (report) => {
2920
+ rigPlan = report;
2921
+ },
2899
2922
  ...input.patches === void 0 ? {} : {
2900
2923
  patches: input.patches,
2901
2924
  onPatchesApplied: (reports) => {
@@ -2907,7 +2930,7 @@ async function autoRigFromLayers(input) {
2907
2930
  }
2908
2931
  );
2909
2932
  } catch (e) {
2910
- if (!(e instanceof import_editor3.TurnTargetError || e instanceof import_editor3.LayerGeometryError || e instanceof import_editor3.PatchError)) {
2933
+ if (!(e instanceof import_editor3.TurnTargetError || e instanceof import_editor3.LayerGeometryError || e instanceof import_editor3.PatchError || e instanceof import_editor3.RigPlanError)) {
2911
2934
  throw e;
2912
2935
  }
2913
2936
  throw new AutoRigInputError(e.message);
@@ -2970,7 +2993,8 @@ async function autoRigFromLayers(input) {
2970
2993
  ...turn === void 0 ? {} : { turn },
2971
2994
  folds,
2972
2995
  physics,
2973
- ...patches === void 0 ? {} : { patches }
2996
+ ...patches === void 0 ? {} : { patches },
2997
+ rigPlan
2974
2998
  };
2975
2999
  } catch (err) {
2976
3000
  if (err instanceof AutoRigInputError)
@@ -5671,7 +5695,7 @@ function formatPatchReports(reports) {
5671
5695
  });
5672
5696
  }
5673
5697
  function createIkiMcpServer() {
5674
- const server = new import_mcp.McpServer({ name: "iki", version: "0.29.0" });
5698
+ const server = new import_mcp.McpServer({ name: "iki", version: "0.30.0" });
5675
5699
  server.registerTool(
5676
5700
  "validate_iki",
5677
5701
  {
@@ -5743,10 +5767,27 @@ function createIkiMcpServer() {
5743
5767
  };
5744
5768
  }
5745
5769
  );
5770
+ server.registerTool(
5771
+ "describe_rig_plan",
5772
+ {
5773
+ description: "Lists the fields of the `rigPlan` input of auto_rig_from_layers: each one's path, default, range, recommended span, step, unit, the poses it shows at, the report reading that shows it and the `turnTargets` cue that fits it when given. The one source of those numbers.",
5774
+ inputSchema: {}
5775
+ },
5776
+ async () => {
5777
+ const { fields } = describeRigPlan();
5778
+ const text = fields.map(
5779
+ (f) => `${f.path} default ${f.default} range ${f.range[0]}..${f.range[1]} recommended ${f.recommended[0]}..${f.recommended[1]} step ${f.step} ${f.unit} \u2014 ${f.what}; shows at ${f.poses.map((p) => JSON.stringify(p)).join(" ")}; cue ${f.cue ?? "none"}; fitted by ${f.fitBy ?? "none"}${f.provisional ? "; provisional" : ""}`
5780
+ ).join("\n");
5781
+ return {
5782
+ content: [{ type: "text", text }],
5783
+ structuredContent: { fields }
5784
+ };
5785
+ }
5786
+ );
5746
5787
  server.registerTool(
5747
5788
  "auto_rig_from_layers",
5748
5789
  {
5749
- description: "Auto-rigs role-named PNG layers (face, eye_L/eye_R and either mouth or the lip set (mouth_inner + lip_lower + lip_upper, a mouth that folds open instead of crossfading) required; iris_L/R, brow_L/R, hair_front, body, arm_L/arm_R, forearm_pose_L/forearm_pose_R, mouth_tongue/mouth_teeth (only with the lip set: drawn under its lips and clipped to mouth_inner), etc. optional; an arm needs the body, a pose forearm needs its arm, and a partial lip set, one mixed with mouth/mouth_open, or mouth_tongue/mouth_teeth without it is refused) into a renderable .iki written to disk. Pass full-canvas PNG file paths; returns the output path + summary (the model is NOT inlined). Filenames map to roles unless `fileName` is given. The result's `folds` is the written rig's fold report, printed after the path the way render_poses prints it, and report-only: a fold never refuses the rig. The `PHYSICS` lines follow the fold report (the result's `physics`), one per physics rig output \u2014 a spring's, or each chain segment's \u2014 reading ok, frozen or unstable with the step and idle amplitudes, or `PHYSICS: no rigs`; report-only too. `patches` (see its field) adds displacements to existing keyform stops of the freshly generated rig; each op then prints one line between the path and the fold report \u2014 `PATCH <i> <target> at <Param=v \u2026>: <moved> of <of> points (cols a-b, rows c-d), largest move <maxPx> model px`, with `(vertices)` in place of the columns and rows for a mesh part \u2014 and the result's `patches` carries the same reports (`index`, `target`, `at`, `moved`, `of`, `cols`/`rows` for a grid, `maxPx`), present whenever `patches` was passed, `[]` included. An op the input schema accepts but the rig refuses comes back as `INVALID: patches[i]\u2026` and nothing is written; an op with a missing field or a field of the wrong type is the SDK's input validation error.",
5790
+ description: "Auto-rigs role-named PNG layers (face, eye_L/eye_R and either mouth or the lip set (mouth_inner + lip_lower + lip_upper, a mouth that folds open instead of crossfading) required; iris_L/R, brow_L/R, hair_front, body, arm_L/arm_R, forearm_pose_L/forearm_pose_R, mouth_tongue/mouth_teeth (only with the lip set: drawn under its lips and clipped to mouth_inner), etc. optional; an arm needs the body, a pose forearm needs its arm, and a partial lip set, one mixed with mouth/mouth_open, or mouth_tongue/mouth_teeth without it is refused) into a renderable .iki written to disk. Pass full-canvas PNG file paths; returns the output path + summary (the model is NOT inlined). Filenames map to roles unless `fileName` is given. The result's `folds` is the written rig's fold report, printed after the path the way render_poses prints it, and report-only: a fold never refuses the rig. The `RIGPLAN:` line (the result's `rigPlan`: `effective`, `clamped`, `overriddenBy`) follows the path and precedes the `PATCH` lines. The `PHYSICS` lines follow the fold report (the result's `physics`), one per physics rig output \u2014 a spring's, or each chain segment's \u2014 reading ok, frozen or unstable with the step and idle amplitudes, or `PHYSICS: no rigs`; report-only too. `patches` (see its field) adds displacements to existing keyform stops of the freshly generated rig; each op then prints one line between the path and the fold report \u2014 `PATCH <i> <target> at <Param=v \u2026>: <moved> of <of> points (cols a-b, rows c-d), largest move <maxPx> model px`, with `(vertices)` in place of the columns and rows for a mesh part \u2014 and the result's `patches` carries the same reports (`index`, `target`, `at`, `moved`, `of`, `cols`/`rows` for a grid, `maxPx`), present whenever `patches` was passed, `[]` included. An op the input schema accepts but the rig refuses comes back as `INVALID: patches[i]\u2026` and nothing is written; an op with a missing field or a field of the wrong type is the SDK's input validation error.",
5750
5791
  inputSchema: {
5751
5792
  layers: import_zod.z.array(
5752
5793
  import_zod.z.object({
@@ -5771,15 +5812,24 @@ function createIkiMcpServer() {
5771
5812
  }).passthrough().optional().describe(
5772
5813
  "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 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). A passed `silhouetteRatio` is clamped too, only on a face drawn without hair and with ear islands, where narrowing the head that far would no longer cover the far ear's slide. 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."
5773
5814
  ),
5774
- style: import_zod.z.object({
5775
- turn: import_zod.z.number().optional(),
5776
- featureLead: import_zod.z.number().optional(),
5777
- hairFollow: import_zod.z.number().optional(),
5778
- outlineFollow: import_zod.z.number().optional(),
5779
- blink: import_zod.z.number().optional(),
5780
- sway: import_zod.z.number().optional()
5815
+ style: import_zod.z.unknown().optional().describe(
5816
+ "Removed in @ikijs/mcp 0.30.0: pass `rigPlan`. Any value here is refused with the field map."
5817
+ ),
5818
+ rigPlan: import_zod.z.object({
5819
+ turn: import_zod.z.object({
5820
+ amount: import_zod.z.number().optional(),
5821
+ featureLead: import_zod.z.number().optional(),
5822
+ eyeForeshorten: import_zod.z.number().optional(),
5823
+ noseLead: import_zod.z.number().optional()
5824
+ }).passthrough().optional(),
5825
+ hair: import_zod.z.object({
5826
+ follow: import_zod.z.number().optional(),
5827
+ outlineFollow: import_zod.z.number().optional(),
5828
+ sway: import_zod.z.number().optional()
5829
+ }).passthrough().optional(),
5830
+ eyes: import_zod.z.object({ blink: import_zod.z.number().optional() }).passthrough().optional()
5781
5831
  }).passthrough().optional().describe(
5782
- "Per-character tuning from the profile the rig defaults to: `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), `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.6), `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`."
5832
+ "Per-character tuning from the profile the rig defaults to, in three groups: `turn` (`amount`, `featureLead`, `eyeForeshorten`, `noseLead`: the last two turn only, the nod untouched, and fitted by `turnTargets.farEyeRatio` / `turnTargets.noseShift` when those are given, which the `RIGPLAN:` line then reports as overridden), `hair` (`follow`, `outlineFollow`, `sway`) and `eyes` (`blink`). `describe_rig_plan` lists every field's default, range, recommended span, step and poses. A value out of range, or a group or key not named there, comes back as `INVALID: rigPlan.<path> \u2026`; an object left out or `{}` is the profile. The result reports what the rig built with as `rigPlan` and a `RIGPLAN:` line."
5783
5833
  ),
5784
5834
  patches: import_zod.z.array(
5785
5835
  import_zod.z.object({
@@ -5797,7 +5847,7 @@ function createIkiMcpServer() {
5797
5847
  why: import_zod.z.string().optional()
5798
5848
  }).passthrough()
5799
5849
  ).optional().describe(
5800
- "Displacements ADDED to EXISTING keyform stops of the freshly generated rig, each op `{ target, at, region, by, falloff?, why? }`. They are replayed on every rig of these inputs, over whatever the rig now bakes, so they hold through a layout or `style` retune; ops on one stop add up, whatever their order. `target` is a feature grid \u2014 `eyeWarp_L`, `eyeWarp_R`, `browWarp_L`, `browWarp_R`, `noseWarp`, `mouthWarp`, whose `at` names both `ParamAngleX` and `ParamAngleY`, each -30, 0 or 30, never both 0 \u2014 or a mesh part with warps (`face`, `hair_front`, \u2026), whose `at` names exactly one parameter at one of that part's warp keyform values, never the parameter's default nor the stop where the rig shuts the part on purpose (`eye_*` and `lash_lower_*` at their `ParamEye*Open` 0, the lip set and its tongue and teeth at `ParamMouthOpenY` 0), which the fold check exempts, nor a `ParamAngleZ` or `ParamBodyAngleZ` stop (they roll the deformers the part hangs under, so a displacement there is turned off the screen axes). The rest pose is the drawn art and no patch changes it. `bodyWarp` and the matrix deformers are not targets, and a patch adds no stop and changes no parameter range. `region` `{ role, x: [from, to], y: [from, to] }` is a rectangle in fractions of the REST layer box (the opaque crop) of `role`, origin top-left, x right, y DOWN, and may reach past the box: the target's points whose REST position lies inside take the whole of `by`, those within `falloff` of it a smooth share, the rest nothing. `by` `{ dx, dy }` and `falloff` are in face widths (the `face` layer's crop width), on screen axes: +dx toward the viewer's right (a character's `_L` side), +dy DOWN. Between stops the engine blends linearly, so a fix at ParamAngleX -30 shows at half strength at -15 and none at rest. `why` is a note the rig ignores. An op this schema accepts but the rig refuses \u2014 an unknown key, target, role or stop, the rest stop or a shut stop, a region running backwards or catching none of the target's points \u2014 comes back as `INVALID: patches[i]\u2026`, listing the keys, targets, stops or roles there are, or where the target's points lie in the role's box, and nothing is written; a missing field or one of the wrong type is refused by the schema itself, as the SDK's input validation error."
5850
+ "Displacements ADDED to EXISTING keyform stops of the freshly generated rig, each op `{ target, at, region, by, falloff?, why? }`. They are replayed on every rig of these inputs, over whatever the rig now bakes, so they hold through a layout or `rigPlan` retune; ops on one stop add up, whatever their order. `target` is a feature grid \u2014 `eyeWarp_L`, `eyeWarp_R`, `browWarp_L`, `browWarp_R`, `noseWarp`, `mouthWarp`, whose `at` names both `ParamAngleX` and `ParamAngleY`, each -30, 0 or 30, never both 0 \u2014 or a mesh part with warps (`face`, `hair_front`, \u2026), whose `at` names exactly one parameter at one of that part's warp keyform values, never the parameter's default nor the stop where the rig shuts the part on purpose (`eye_*` and `lash_lower_*` at their `ParamEye*Open` 0, the lip set and its tongue and teeth at `ParamMouthOpenY` 0), which the fold check exempts, nor a `ParamAngleZ` or `ParamBodyAngleZ` stop (they roll the deformers the part hangs under, so a displacement there is turned off the screen axes). The rest pose is the drawn art and no patch changes it. `bodyWarp` and the matrix deformers are not targets, and a patch adds no stop and changes no parameter range. `region` `{ role, x: [from, to], y: [from, to] }` is a rectangle in fractions of the REST layer box (the opaque crop) of `role`, origin top-left, x right, y DOWN, and may reach past the box: the target's points whose REST position lies inside take the whole of `by`, those within `falloff` of it a smooth share, the rest nothing. `by` `{ dx, dy }` and `falloff` are in face widths (the `face` layer's crop width), on screen axes: +dx toward the viewer's right (a character's `_L` side), +dy DOWN. Between stops the engine blends linearly, so a fix at ParamAngleX -30 shows at half strength at -15 and none at rest. `why` is a note the rig ignores. An op this schema accepts but the rig refuses \u2014 an unknown key, target, role or stop, the rest stop or a shut stop, a region running backwards or catching none of the target's points \u2014 comes back as `INVALID: patches[i]\u2026`, listing the keys, targets, stops or roles there are, or where the target's points lie in the role's box, and nothing is written; a missing field or one of the wrong type is refused by the schema itself, as the SDK's input validation error."
5801
5851
  )
5802
5852
  }
5803
5853
  },
@@ -5811,6 +5861,7 @@ function createIkiMcpServer() {
5811
5861
  });
5812
5862
  const text = r.ok ? [
5813
5863
  r.path,
5864
+ formatRigPlanReport(r.rigPlan),
5814
5865
  ...formatPatchReports(r.patches ?? []),
5815
5866
  ...formatFoldReport(r.folds, r.canvas),
5816
5867
  ...formatPhysicsReport(r.physics)