@ikijs/mcp 0.22.0 → 0.23.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/README.md CHANGED
@@ -22,7 +22,7 @@ The `model` input for `validate_iki` and `describe_iki` accepts either a plain J
22
22
 
23
23
  Turns a set of role-named, full-canvas transparent PNG layers into a renderable, validated `.iki` model with the textures atlased and embedded as a base64 `data:image/png` URI. Under `quantizeColors` a `nose` layer is the exception: the palette rims a soft-shaded nose's feather, so the nose is atlased alone on a second, lossless page. The written model declares the head motions Nod, Shake and Tilt and up to six default expressions (smile, laugh, angry, sad, surprised, shy; `shy` needs a blush, `angry` and `sad` need brows), each with a description a host picks by; with a `blush_L`/`blush_R` layer it also declares `ParamCheek`, which fades the blush from faint at rest to as drawn.
24
24
 
25
- - **`layers`** — array of `{ path, fileName? }`. `path` is a PNG file path (resolved against the server's working directory); the role is derived from `fileName ?? basename(path)`. Required roles: `face`, `eye_L`, `eye_R`, and `mouth` or the lip set `mouth_inner`, `lip_lower`, `lip_upper` (a mouth that folds open instead of crossfading; a partial lip set, or one mixed with `mouth`/`mouth_open`, is refused). Optional roles include `iris_L`/`iris_R`, `brow_L`/`brow_R`, `hair_front`/`hair_back`, `lash_L`/`lash_R`, `lash_lower_L`/`lash_lower_R`, `body`, `arm_L`/`arm_R`, `forearm_pose_L`/`forearm_pose_R`, etc. An arm — the whole arm drawn hanging, its shoulder at the top — needs the `body` (it hangs from the body's shoulder) and becomes an elbow cap, an upper arm and a forearm sharing its crop, on `ParamArmL/R` (the shoulder) and `ParamElbowL/R`. A pose forearm — the forearm raised, standing up from its elbow — needs its arm: it hangs from the arm's elbow and is swapped in for the hanging forearm by `ParamArmPoseL/R`, rocked by `ParamArmPoseAngleL/R`, and drawn above the face and the hair. All layers must share the same canvas size (taken from the first layer).
25
+ - **`layers`** — array of `{ path, fileName? }`. `path` is a PNG file path (resolved against the server's working directory); the role is derived from `fileName ?? basename(path)`. Required roles: `face`, `eye_L`, `eye_R`, and `mouth` or the lip set `mouth_inner`, `lip_lower`, `lip_upper` (a mouth that folds open instead of crossfading; a partial lip set, or one mixed with `mouth`/`mouth_open`, is refused). `mouth_tongue` / `mouth_teeth` are optional with the lip set only: drawn under its lips and clipped to `mouth_inner`, the teeth riding the upper line and the tongue the opening's bottom; without the set they are refused. Optional roles include `iris_L`/`iris_R`, `brow_L`/`brow_R`, `hair_front`/`hair_back`, `lash_L`/`lash_R`, `lash_lower_L`/`lash_lower_R`, `body`, `arm_L`/`arm_R`, `forearm_pose_L`/`forearm_pose_R`, etc. An arm — the whole arm drawn hanging, its shoulder at the top — needs the `body` (it hangs from the body's shoulder) and becomes an elbow cap, an upper arm and a forearm sharing its crop, on `ParamArmL/R` (the shoulder) and `ParamElbowL/R`. A pose forearm — the forearm raised, standing up from its elbow — needs its arm: it hangs from the arm's elbow and is swapped in for the hanging forearm by `ParamArmPoseL/R`, rocked by `ParamArmPoseAngleL/R`, and drawn above the face and the hair. All layers must share the same canvas size (taken from the first layer).
26
26
  - **`outputPath`** — optional `.iki` output path (resolved against the working directory; the parent directory must already exist, and the path must end in `.iki`). Defaults to `auto-rigged-model.iki`.
27
27
  - **`turnTargets`** — optional head-turn cues to fit the rig to, in the units `measure_turn_reference` reports off a front/turned reference pair: `eyeShift` (plus `noseShift` and `mouthShift`) is how far that feature slides across the head at full turn, as a fraction of the head's half-width — a **magnitude**, since the rig turns both ways and the sign is the turn's own business; `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. An omitted field leaves that part of the turn at the profile the rig defaults to. An `eyeShift` you pass is fitted by the turn's amount and _clamped_ when it runs past the room the art leaves the far eye — the face plate's edge, or the bangs' side strand over the far iris — since that room is a fact about these layers, not about the reference. Any other target you **do** pass that it cannot reach is refused, because that number is a measurement rather than a preference. A layer set without a `nose` still turns its head, on the profile, but fits no target: `turnTargets` is then inert and the result carries no `turn`.
28
28
  - **`style`** — optional per-character tuning from the profile the rig defaults to: `turn` (the whole head turn, the eyes' foreshortening with it, 0..3, 1 = the profile; ignored when `turnTargets.eyeShift` is given), `featureLead` (how far the features lead the face plate, 0..3), `hairFollow` (the front hair's share of the face's turn, 0..2, profile 1), `outlineFollow` (its outer edge's share where it 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) and `sway` (the hair sway amplitude, 0..5). A value out of range, or a knob not named here, is refused.
@@ -34,16 +34,16 @@ The decode/atlas pipeline runs in Node via `sharp` (a native dependency confined
34
34
 
35
35
  Composes a directory of AI-generated part PNGs into canvas-aligned, role-named layer PNGs ready for `auto_rig_from_layers`, on a canvas 1100 px wide and `canvasHeight` tall (1100 by default) with a built-in default layout tuned for the character-generation skill's standard front-facing framing. It ports the composer that shipped as a script (`compose.cjs`) in the Claude Code plugin.
36
36
 
37
- - **`partsDir`** — directory of the source part PNGs (resolved against the server's working directory). Required sources: `face.png`, `eyewhite.png` (split into the sclera, the upper lash and the lower lid — `lash_lower_L`/`lash_lower_R`, the dark line and lashes of the eye's lower part, which draw over the iris and are placed on the sclera's frame by the `eye_*` layout, so they have no layout key of their own; an eyewhite with no dark lower lid writes none and lists them in `skipped`. A light mark drawn detached above the eye white, such as a double-eyelid crease, is dropped from the sclera — the iris's clip — while dark strokes there stay lash ink), `iris.png`, `brow.png`, `hair_front.png`, and a mouth by one of two routes: `mouth.png` (a closed drawing, with an optional `mouth_open.png` it cross-fades to), or the lip set — `mouth_keyed.png` (the open mouth, its inside painted ONE flat #00FF00) + `mouth_interior.png` (the cavity, teeth and tongue alone), which the composer keys and splits into `mouth_inner` / `lip_lower` / `lip_upper` on one frame, so `auto_rig_from_layers` folds the mouth open like the eyelid. The key reads each antialiased pixel against its own ramp to the art's green, the interior is trimmed of the lip rim a generator draws round it, and the split is cut at the composed size so every boundary meets the rig's per-column contract by construction. The lip set is opt-in: with neither file the legacy route runs; one without the other, or either beside `mouth.png` / `mouth_open.png`, is refused naming the file to draw or remove. With the set, `mouth` and `mouth_open` are neither written nor listed in `skipped`. Optional: `hair_back.png`, `body.png`, `mouth_open.png` (legacy route), `blush.png`, `nose.png` — a parts dir without them still composes, minus those roles. One `blush.png` makes both cheeks' blush: `blush_R` takes it as drawn and `blush_L` mirrored. It is decoration, so the report does not flag a set without it. One `arm.png` — the arm on the screen left, drawn hanging with its shoulder at the top — makes both arms of a full body: `arm_R` takes it as drawn and `arm_L` mirrored, and each is hung on the body's shoulder (see `layout`). The arms are opt-in: a parts dir without `arm.png` composes as a bust does, and `skipped` never lists them. An `arm.png` needs a `body.png`. One `forearm_pose.png` — the arm's forearm raised, on the screen left, standing up from its elbow with the hand at the top — makes both pose forearms (`forearm_pose_R` as drawn, `forearm_pose_L` mirrored); it is opt-in too and needs an `arm.png`. With one the compose also writes `preview-pose.png`, the switch at 1 as the rig draws it (each arm with a pose forearm cropped to the rows above its elbow, the pose forearms over everything); `preview.png` stays the rest pose, where a pose forearm is invisible. Without a `forearm_pose.png`, `preview-pose.png` is removed. The nose is what the auto-rig leads the head turn with, and a face supplied alongside it must be drawn without one, or the painted nose stays on the face plate while the real one moves. Each part but the eye pair is cropped to its drawing before it is sized and placed. A faint speck detached from the drawing, one that never reaches alpha 128 and covers under 1 % of the part's pixels (residue a background removal leaves), is cut out with the margin it widened, so it cannot pull the part off its centre. A detached stroke that reaches alpha 128 is kept.
37
+ - **`partsDir`** — directory of the source part PNGs (resolved against the server's working directory). Required sources: `face.png`, `eyewhite.png` (split into the sclera, the upper lash and the lower lid — `lash_lower_L`/`lash_lower_R`, the dark line and lashes of the eye's lower part, which draw over the iris and are placed on the sclera's frame by the `eye_*` layout, so they have no layout key of their own; an eyewhite with no dark lower lid writes none and lists them in `skipped`. A light mark drawn detached above the eye white, such as a double-eyelid crease, is dropped from the sclera — the iris's clip — while dark strokes there stay lash ink), `iris.png`, `brow.png`, `hair_front.png`, and a mouth by one of two routes: `mouth.png` (a closed drawing, with an optional `mouth_open.png` it cross-fades to), or the lip set — `mouth_keyed.png` (the open mouth, its inside painted ONE flat #00FF00) + `mouth_interior.png` (the cavity, teeth and tongue alone), which the composer keys and splits into `mouth_inner` / `lip_lower` / `lip_upper` on one frame, so `auto_rig_from_layers` folds the mouth open like the eyelid. The interior's light paint (luma 100 and over: the teeth, the tongue) is written as `mouth_teeth` and `mouth_tongue` on the same frame, split at each column's middle, riding the upper line and the opening's bottom and clipped to the cavity; `mouth_inner` takes the cavity's fill under it, its edge softened by the key's own coverage. An interior with no light paint writes neither and lists them in `skipped`. The key reads each antialiased pixel against its own ramp to the art's green, the interior is trimmed of the lip rim a generator draws round it, and the split is cut at the composed size so every boundary meets the rig's per-column contract by construction. The lip set is opt-in: with neither file the legacy route runs; one without the other, or either beside `mouth.png` / `mouth_open.png`, is refused naming the file to draw or remove. With the set, `mouth` and `mouth_open` are neither written nor listed in `skipped`. Optional: `hair_back.png`, `body.png`, `mouth_open.png` (legacy route), `blush.png`, `nose.png` — a parts dir without them still composes, minus those roles. One `blush.png` makes both cheeks' blush: `blush_R` takes it as drawn and `blush_L` mirrored. It is decoration, so the report does not flag a set without it. One `arm.png` — the arm on the screen left, drawn hanging with its shoulder at the top — makes both arms of a full body: `arm_R` takes it as drawn and `arm_L` mirrored, and each is hung on the body's shoulder (see `layout`). The arms are opt-in: a parts dir without `arm.png` composes as a bust does, and `skipped` never lists them. An `arm.png` needs a `body.png`. One `forearm_pose.png` — the arm's forearm raised, on the screen left, standing up from its elbow with the hand at the top — makes both pose forearms (`forearm_pose_R` as drawn, `forearm_pose_L` mirrored); it is opt-in too and needs an `arm.png`. With one the compose also writes `preview-pose.png`, the switch at 1 as the rig draws it (each arm with a pose forearm cropped to the rows above its elbow, the pose forearms over everything); `preview.png` stays the rest pose, where a pose forearm is invisible. Without a `forearm_pose.png`, `preview-pose.png` is removed. The nose is what the auto-rig leads the head turn with, and a face supplied alongside it must be drawn without one, or the painted nose stays on the face plate while the real one moves. Each part but the eye pair is cropped to its drawing before it is sized and placed. A faint speck detached from the drawing, one that never reaches alpha 128 and covers under 1 % of the part's pixels (residue a background removal leaves), is cut out with the margin it widened, so it cannot pull the part off its centre. A detached stroke that reaches alpha 128 is kept.
38
38
  - **`outDir`** — an existing directory (resolved against the working directory, confined to it exactly like `auto_rig_from_layers`'s `outputPath`; the tool never creates directories) to write the role layer PNGs and a flattened `preview.png` (and, with a `forearm_pose.png`, `preview-pose.png`) into. Reusing a directory across runs is intentional — a role this run does not write (one it skips, e.g. composing a head-only set that omits `body`, or an arm or pose forearm once `arm.png` or `forearm_pose.png` is gone, `preview-pose.png` included) has its stale `<role>.png` from an earlier run deleted, so the directory always holds exactly this run's roles.
39
- - **`layout`** — optional per-role override merged over the built-in defaults, e.g. `{ "eye_L": { "cx": 660 } }`, so a character can be retuned by re-running compose rather than editing a script. Each of `cx`, `cy`, `w`, `h` is optional; `w` must be an integer in 1..1100 (the canvas width) and `h` in 1..`canvasHeight` (the canvas height). The defaults of the face's features — blush, nose, mouth, `mouth_open`, `mouth_inner`, eyes, irises, lashes, brows — 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. Omitting `h` keeps the part's own aspect ratio, which is what every role wants until one does not: a generated eyewhite often comes back flatter than its reference, and stretching a flat white lens costs nothing where regenerating it is billed and unreliable. The nose is sized and placed by its dense core — its pixels at alpha ≥ 128, the drawing a viewer reads inside a soft nose's feather — rather than its whole part, which for a shaded-bump nose is mostly feather: `w` (default 20) and `h` size the core, `cx` (default 550) centres it, and a set `cy` centres its rows. By default its `cy` is unset, and the core's bottom row (the tip) lands 0.66 of the way from the eye row down to the mouth's, so the nose follows a retuned eye or mouth row. A nose with no pixel at alpha ≥ 128 is sized and placed whole, and so is one whose core is a speck of its trimmed part — under a quarter of its width or height, such as a lone nostril mark or highlight, which sized to `w` would blow the whole nose up — and the report warns of the speck. `mouth_inner` is the lip set's one frame (`mouth_open`'s place by default): `lip_lower` and `lip_upper` have no key and land on it, so a retune moves the three together, and with the set the nose's tip rule reads `layout.mouth_inner.cy`. Set `h` on a sclera and its lash together — they share one frame, and the blink fold tears if they diverge, so a pair set to land on different frames is rejected. `arm_L` and `arm_R` have no `cx`/`cy`/`w` defaults; each is derived from the placed body. An unset `w` is 0.4 of the body's width. An unset `cx` or `cy` hangs the arm's shoulder pivot — the one `auto_rig_from_layers` turns it about, read off the resized arm by the rig's own rule — on the body box's shoulder corner on that axis: its left edge for `arm_R`, its right edge for `arm_L`, 0.12 of its height under its top. On a torso widest at its shoulders, the shoulder cap's centre then sits on the torso's edge. A set one centres the arm as for every other role. Both values are provisional. `forearm_pose_L` and `forearm_pose_R` have no `cx`/`cy`/`w` defaults either: an unset `w` scales the forearm so its elbow end (the shoulder rule run from its bottom, on the trimmed source) is as wide as the placed arm's elbow run, and an unset `cx` or `cy` pins the elbow end's pivot — measured on the resized part — on the arm's placed elbow, the pivot `auto_rig_from_layers` hangs it from.
39
+ - **`layout`** — optional per-role override merged over the built-in defaults, e.g. `{ "eye_L": { "cx": 660 } }`, so a character can be retuned by re-running compose rather than editing a script. Each of `cx`, `cy`, `w`, `h` is optional; `w` must be an integer in 1..1100 (the canvas width) and `h` in 1..`canvasHeight` (the canvas height). The defaults of the face's features — blush, nose, mouth, `mouth_open`, `mouth_inner`, eyes, irises, lashes, brows — 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. Omitting `h` keeps the part's own aspect ratio, which is what every role wants until one does not: a generated eyewhite often comes back flatter than its reference, and stretching a flat white lens costs nothing where regenerating it is billed and unreliable. The nose is sized and placed by its dense core — its pixels at alpha ≥ 128, the drawing a viewer reads inside a soft nose's feather — rather than its whole part, which for a shaded-bump nose is mostly feather: `w` (default 20) and `h` size the core, `cx` (default 550) centres it, and a set `cy` centres its rows. By default its `cy` is unset, and the core's bottom row (the tip) lands 0.66 of the way from the eye row down to the mouth's, so the nose follows a retuned eye or mouth row. A nose with no pixel at alpha ≥ 128 is sized and placed whole, and so is one whose core is a speck of its trimmed part — under a quarter of its width or height, such as a lone nostril mark or highlight, which sized to `w` would blow the whole nose up — and the report warns of the speck. `mouth_inner` is the lip set's one frame (`mouth_open`'s place by default): `lip_lower`, `lip_upper`, `mouth_tongue` and `mouth_teeth` have no key and land on it, so a retune moves them together, and with the set the nose's tip rule reads `layout.mouth_inner.cy`. Set `h` on a sclera and its lash together — they share one frame, and the blink fold tears if they diverge, so a pair set to land on different frames is rejected. `arm_L` and `arm_R` have no `cx`/`cy`/`w` defaults; each is derived from the placed body. An unset `w` is 0.4 of the body's width. An unset `cx` or `cy` hangs the arm's shoulder pivot — the one `auto_rig_from_layers` turns it about, read off the resized arm by the rig's own rule — on the body box's shoulder corner on that axis: its left edge for `arm_R`, its right edge for `arm_L`, 0.12 of its height under its top. On a torso widest at its shoulders, the shoulder cap's centre then sits on the torso's edge. A set one centres the arm as for every other role. Both values are provisional. `forearm_pose_L` and `forearm_pose_R` have no `cx`/`cy`/`w` defaults either: an unset `w` scales the forearm so its elbow end (the shoulder rule run from its bottom, on the trimmed source) is as wide as the placed arm's elbow run, and an unset `cx` or `cy` pins the elbow end's pivot — measured on the resized part — on the arm's placed elbow, the pivot `auto_rig_from_layers` hangs it from.
40
40
  - **`mirrorParts`** — optional list of part files to flip left-right as they are read, e.g. `["eyewhite.png"]`. Which way a part faces is fixed by the layout, and "left eye" cannot pin it down — it reads as the viewer's left or the character's — so in image terms: `eyewhite.png` is read as the eye on the screen left, lash wing (outer corner) at the image's left end and lash-free tear duct at its right; `brow.png` as the brow on the screen right, thick head at the image's left end and tail at its right; `blush.png` as the blush on the screen left, outer end (toward the face's edge) at the image's left end and inner end at its right; `arm.png` as the arm on the screen left (the character's right), hanging, its shoulder at the image's top; `forearm_pose.png` as the raised forearm on the screen left, standing up from its elbow, the hand at the image's top and the thumb toward the body at its right. A part drawn the other way round is fixed here for free instead of regenerated. It flips the source, so every role cut from it flips together and an eye's sclera and lash stay in one frame.
41
41
  - **`canvasHeight`** — optional height of the canvas in px: an even integer in 1100..4096, default 1100, a square bust canvas — and at 1100 every output is byte-identical to leaving it out. The width stays 1100. The canvas grows downward: every default and every override keeps its canvas px from the top-left, so the head lands where it does on a bust and a full body gets room below. An odd height is refused, since model space is centred on the canvas and it would put the head on a half pixel. It is checked before any part decodes.
42
- - **Result** — on success the text is the written layer paths (one per line) followed by the same geometry report `measure_layers` returns — except that when the composer found the core of the nose's source part a speck, its nose check reports that verdict instead of what the composed file shows, so a speck that resampling erased from the layer is warned about here and not by `measure_layers`. `structuredContent` is `{ ok: true, outDir, layers, skipped, preview, previewPose?, measure }` (`previewPose` only with a `forearm_pose.png`). With the lip set `preview.png` shows the mouth closed, as the rig draws the rest pose. Invalid input (a missing required part, a `canvasHeight` that is odd or outside 1100..4096, an unknown `layout` role, an out-of-range `w` or `h`, a lash placed on a different frame from its sclera's, an `arm.png` without a `body.png`, a `forearm_pose.png` without an `arm.png`, a lip set with one source missing or beside the legacy mouth, a key that fails (no green, green outside the opening, an outline not closed round it, more than one opening, no skin under it, an interior that is only lips or drawn opaque on a non-white or noisy ground), an arm too short for the rig to hang an elbow under its shoulder, a `mirrorParts` entry that is not a part file, a part that lands entirely off-canvas, a non-existent `outDir`) returns `{ ok: false, error }` with `INVALID: …` text.
42
+ - **Result** — on success the text is the written layer paths (one per line) followed by the same geometry report `measure_layers` returns — except that when the composer found the core of the nose's source part a speck, its nose check reports that verdict instead of what the composed file shows, so a speck that resampling erased from the layer is warned about here and not by `measure_layers`. `structuredContent` is `{ ok: true, outDir, layers, skipped, preview, previewPose?, measure }` (`previewPose` only with a `forearm_pose.png`). With the lip set `preview.png` shows the mouth closed, as the rig draws the rest pose (the tongue and the teeth left out with the interior), and `skipped` lists `mouth_tongue` / `mouth_teeth` when the interior has no light paint. Invalid input (a missing required part, a `canvasHeight` that is odd or outside 1100..4096, an unknown `layout` role, an out-of-range `w` or `h`, a lash placed on a different frame from its sclera's, an `arm.png` without a `body.png`, a `forearm_pose.png` without an `arm.png`, a lip set with one source missing or beside the legacy mouth, a key that fails (no green, green outside the opening, an outline not closed round it, more than one opening, no skin under it, an interior that is only lips or drawn opaque on a non-white or noisy ground), an arm too short for the rig to hang an elbow under its shoulder, a `mirrorParts` entry that is not a part file, a part that lands entirely off-canvas, a non-existent `outDir`) returns `{ ok: false, error }` with `INVALID: …` text.
43
43
 
44
44
  ### `measure_layers`
45
45
 
46
- Reports the same read-only geometry checks `compose_layers_from_parts` returns inline (iris size/offset relative to the sclera, eye aspect, an eye drawn facing the other way, cropped or flat-cut edges, a nose whose dense core is a speck of its crop, missing optional roles, and for a full body: a body whose feet the bottom of a canvas taller than wide cuts off, an arm without a body, an arm whose shoulder cap — the one `auto_rig_from_layers` turns it about, read by the rig's own rule — does not reach half its radius under the torso's edge on its shoulder pivot's row, a pose forearm without its arm or whose elbow end is more than 2 px off the arm's elbow, more than 10 % off its elbow run in width, or more than 15 % off its hand's reach in length, and for the lip set: a partial set or one beside `mouth` / `mouth_open`, a column of the opening where the interior does not reach the line or the skin does not reach the interior, an opening under 0.3 of the upper lip's width or under 8 rows tall, a line under 2 rows, key green left, and an interior with transparent holes), over an already-composed layers directory — for re-checking a layers dir without recomposing it. Its nose check reads the composed file against its crop, which is what `auto_rig_from_layers` acts on: a speck core there is one the rig does not turn or tilt the nose about. The composer's inline report does the same unless it found the source part's core a speck, which it reports instead, so a speck that resampling erased from the layer shows there and not here.
46
+ Reports the same read-only geometry checks `compose_layers_from_parts` returns inline (iris size/offset relative to the sclera, eye aspect, an eye drawn facing the other way, cropped or flat-cut edges, a nose whose dense core is a speck of its crop, missing optional roles, and for a full body: a body whose feet the bottom of a canvas taller than wide cuts off, an arm without a body, an arm whose shoulder cap — the one `auto_rig_from_layers` turns it about, read by the rig's own rule — does not reach half its radius under the torso's edge on its shoulder pivot's row, a pose forearm without its arm or whose elbow end is more than 2 px off the arm's elbow, more than 10 % off its elbow run in width, or more than 15 % off its hand's reach in length, and for the lip set: a partial set or one beside `mouth` / `mouth_open`, a column of the opening where the interior does not reach the line or the skin does not reach the interior, an opening under 0.3 of the upper lip's width or under 8 rows tall, a line under 2 rows, key green left, an interior with transparent holes, and a `mouth_tongue` / `mouth_teeth` with no lip set, on another canvas, or whose box leaves `mouth_inner`'s, where the cavity clips it away), over an already-composed layers directory — for re-checking a layers dir without recomposing it. Its nose check reads the composed file against its crop, which is what `auto_rig_from_layers` acts on: a speck core there is one the rig does not turn or tilt the nose about. The composer's inline report does the same unless it found the source part's core a speck, which it reports instead, so a speck that resampling erased from the layer shows there and not here.
47
47
 
48
48
  - **`layersDir`** — directory of role-named layer PNGs (resolved against the working directory). Every `preview*.png` in it is skipped.
49
49
  - **Result** — the text is the report: a per-layer size/bbox-centre/mass-centre/margins table, then, with a lip set, one `lips:` line — the opening's width, its height at the centre, the line's rows and the `MouthOpen` below which no slit shows — then the checks that fired. `structuredContent` is `{ ok: true, layersDir, layers, empty, warnings, lips?, passed }`. A missing or non-directory `layersDir` returns `{ ok: false, error }` with `INVALID: …` text.
@@ -424,7 +424,9 @@ function expectInput(label, fn) {
424
424
  var LOSSLESS_PAGE_ROLE = "nose";
425
425
  async function renderAtlasPage(crops, quantizeColors) {
426
426
  const layout = packAtlas(
427
- crops.map((c) => ({ id: c.id, width: c.width, height: c.height }))
427
+ crops.map((c) => ({ id: c.id, width: c.width, height: c.height })),
428
+ void 0,
429
+ MAX_ATLAS_SIDE
428
430
  );
429
431
  const over = layout.pageWidth > MAX_ATLAS_SIDE ? { side: "width", crop: "widest" } : layout.pageHeight > MAX_ATLAS_SIDE ? { side: "height", crop: "tallest" } : void 0;
430
432
  if (over !== void 0) {
@@ -1154,10 +1156,12 @@ function jointWarnings(pose, arm, stats, a, armLayer, b) {
1154
1156
  import path5 from "path";
1155
1157
  import {
1156
1158
  ALPHA_OPAQUE as ALPHA_OPAQUE4,
1159
+ LIP_INSIDE_ROLES,
1157
1160
  LIP_ROLES,
1158
1161
  LayerGeometryError as LayerGeometryError4,
1159
1162
  columnRuns as columnRuns2,
1160
1163
  createLayerSetMeasurer as createLayerSetMeasurer5,
1164
+ isLipInsideRole,
1161
1165
  mouthOpening as mouthOpening2
1162
1166
  } from "@ikijs/editor";
1163
1167
 
@@ -1699,10 +1703,15 @@ async function splitLipSet(keyedPng, w, h, interior) {
1699
1703
  const gw = holeW + 2;
1700
1704
  const gh = hb.y1 - hb.y0 + 3;
1701
1705
  const { data: fitted } = await sharp2(interior.png).resize(gw, gh, { fit: "fill" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
1702
- const faintUpper = (p, x, y) => y < bot[x] && label[p] === main && 2 * y < top[x] + bot[x];
1706
+ const hole = (q) => label[q] === main;
1707
+ const upperHalf = (x, y) => 2 * y < top[x] + bot[x];
1708
+ const faintUpper = (p, x, y) => y < bot[x] && hole(p) && upperHalf(x, y);
1709
+ const besideHole = (p, x, y) => x > 0 && hole(p - 1) || x < w - 1 && hole(p + 1) || y > 0 && hole(p - w) || y < h - 1 && hole(p + w);
1703
1710
  const upper = Buffer.alloc(n * 4);
1704
1711
  const lower = Buffer.alloc(n * 4);
1705
1712
  const inner = Buffer.alloc(n * 4);
1713
+ const tongue = Buffer.alloc(n * 4);
1714
+ const teeth = Buffer.alloc(n * 4);
1706
1715
  const copy = (to, p) => frame.copy(to, p * 4, p * 4, p * 4 + 4);
1707
1716
  for (let y = 0; y < h; y++) {
1708
1717
  for (let x = 0; x < w; x++) {
@@ -1711,7 +1720,14 @@ async function splitLipSet(keyedPng, w, h, interior) {
1711
1720
  if ((!inOpening || y < top[x] || faintUpper(p, x, y)) && !(wall[x] && grown[p]))
1712
1721
  copy(upper, p);
1713
1722
  if (inOpening && skinRow[x] >= 0 && y >= skinRow[x]) copy(lower, p);
1714
- if (!grown[p]) continue;
1723
+ if (!grown[p]) {
1724
+ const a = alpha(p);
1725
+ if (a >= ALPHA_OPAQUE3 && a < 255 && besideHole(p, x, y)) {
1726
+ inner.set(interior.cavity, p * 4);
1727
+ inner[p * 4 + 3] = 255 - a;
1728
+ }
1729
+ continue;
1730
+ }
1715
1731
  const out = [...interior.cavity];
1716
1732
  const ix = x - gx;
1717
1733
  const iy = y - gy;
@@ -1728,6 +1744,11 @@ async function splitLipSet(keyedPng, w, h, interior) {
1728
1744
  inner[p * 4 + 1] = Math.round(out[1]);
1729
1745
  inner[p * 4 + 2] = Math.round(out[2]);
1730
1746
  inner[p * 4 + 3] = 255;
1747
+ if (hole(p) && luma(inner, p * 4) >= CAVITY_LUMA) {
1748
+ const to = upperHalf(x, y) ? teeth : tongue;
1749
+ inner.copy(to, p * 4, p * 4, p * 4 + 4);
1750
+ inner.set(interior.cavity, p * 4);
1751
+ }
1731
1752
  }
1732
1753
  }
1733
1754
  const opening = assertFoldContract(
@@ -1735,12 +1756,17 @@ async function splitLipSet(keyedPng, w, h, interior) {
1735
1756
  w,
1736
1757
  h
1737
1758
  );
1738
- const [innerPng, lowerPng, upperPng] = await Promise.all([
1739
- encode(inner, w, h),
1740
- encode(lower, w, h),
1741
- encode(upper, w, h)
1742
- ]);
1743
- return { inner: innerPng, lower: lowerPng, upper: upperPng, opening };
1759
+ const [innerPng, lowerPng, upperPng, tonguePng, teethPng] = await Promise.all(
1760
+ [inner, lower, upper, tongue, teeth].map((b) => encode(b, w, h))
1761
+ );
1762
+ return {
1763
+ inner: innerPng,
1764
+ lower: lowerPng,
1765
+ upper: upperPng,
1766
+ tongue: tonguePng,
1767
+ teeth: teethPng,
1768
+ opening
1769
+ };
1744
1770
  }
1745
1771
  async function restShiftOf(layers, width, height) {
1746
1772
  const [mouth_inner, lip_lower, lip_upper] = await Promise.all(
@@ -1763,25 +1789,40 @@ async function restShiftOf(layers, width, height) {
1763
1789
  }
1764
1790
  return mouthRestShift(byRole);
1765
1791
  }
1766
- async function closedLips(upper, lower, shift, left) {
1792
+ async function closedLips(upper, lower, shift, left, top) {
1767
1793
  const shut = async (png, role) => {
1768
1794
  const { data, info } = await rawOf(png);
1769
1795
  const { width: w, height: h } = info;
1770
1796
  const out = Buffer.alloc(w * h * 4);
1771
1797
  for (let x = 0; x < w; x++) {
1772
- const dy = shift(role, left + x);
1773
- const f = Math.floor(dy);
1774
- const t = dy - f;
1775
1798
  const px2 = (row, c) => row < 0 || row >= h ? 0 : data[(row * w + x) * 4 + c];
1799
+ const landed = [];
1800
+ for (let row = 0; row < h; row++) {
1801
+ const dy = shift(role, left + x, top + row);
1802
+ if (dy !== void 0) landed.push([row, row + 0.5 - dy]);
1803
+ }
1804
+ if (landed.length > 1) {
1805
+ const [a, b] = landed;
1806
+ const [y, z2] = landed.slice(-2);
1807
+ landed.unshift([a[0] - 1, 2 * a[1] - b[1]]);
1808
+ landed.push([z2[0] + 1, 2 * z2[1] - y[1]]);
1809
+ }
1810
+ let i = 0;
1776
1811
  for (let to = 0; to < h; to++) {
1777
- const a0 = px2(to + f, 3);
1778
- const a1 = px2(to + f + 1, 3);
1812
+ const centre = to + 0.5;
1813
+ while (i + 1 < landed.length && landed[i + 1][1] < centre) i++;
1814
+ if (i + 1 >= landed.length || landed[i][1] > centre) continue;
1815
+ const [r0, y0] = landed[i];
1816
+ const [r1, y1] = landed[i + 1];
1817
+ const t = (centre - y0) / (y1 - y0);
1818
+ const a0 = px2(r0, 3);
1819
+ const a1 = px2(r1, 3);
1779
1820
  const a = (1 - t) * a0 + t * a1;
1780
1821
  if (a === 0) continue;
1781
1822
  const o = (to * w + x) * 4;
1782
1823
  for (let c = 0; c < 3; c++)
1783
1824
  out[o + c] = Math.round(
1784
- ((1 - t) * a0 * px2(to + f, c) + t * a1 * px2(to + f + 1, c)) / a
1825
+ ((1 - t) * a0 * px2(r0, c) + t * a1 * px2(r1, c)) / a
1785
1826
  );
1786
1827
  out[o + 3] = Math.round(a);
1787
1828
  }
@@ -1796,7 +1837,7 @@ async function closedLips(upper, lower, shift, left) {
1796
1837
  }
1797
1838
 
1798
1839
  // src/measure-lips.ts
1799
- var isLipRole = (role) => LIP_ROLES.includes(role);
1840
+ var isLipLayerRole = (role) => LIP_ROLES.includes(role) || isLipInsideRole(role);
1800
1841
  var MIN_OPENING_ROWS = 8;
1801
1842
  var MIN_LINE_ROWS = 2;
1802
1843
  var GREEN_EXCESS = 40;
@@ -1805,7 +1846,15 @@ var columns = (cols) => `${cols.length} column${cols.length === 1 ? "" : "s"} (f
1805
1846
  async function lipWarnings(absDir, layers) {
1806
1847
  const warnings = [];
1807
1848
  const present = LIP_ROLES.filter((role) => layers[role] !== void 0);
1808
- if (present.length === 0) return { warnings };
1849
+ const inside = LIP_INSIDE_ROLES.filter((role) => layers[role] !== void 0);
1850
+ if (present.length === 0) {
1851
+ if (inside.length > 0) {
1852
+ warnings.push(
1853
+ `${inside.join("/")}: a lip set's inside layer with no lip set \u2014 auto_rig_from_layers refuses it (it is cut from the interior and clipped to it). Recompose from mouth_keyed.png + mouth_interior.png, or remove it.`
1854
+ );
1855
+ }
1856
+ return { warnings };
1857
+ }
1809
1858
  const legacy = ["mouth", "mouth_open"].filter(
1810
1859
  (role) => layers[role] !== void 0
1811
1860
  );
@@ -1822,7 +1871,7 @@ async function lipWarnings(absDir, layers) {
1822
1871
  return { warnings };
1823
1872
  }
1824
1873
  const { mouth_inner: inner, lip_upper: upper } = layers;
1825
- for (const role of ["lip_lower", "lip_upper"]) {
1874
+ for (const role of ["lip_lower", "lip_upper", ...inside]) {
1826
1875
  const stats = layers[role];
1827
1876
  if (stats.canvasW !== inner.canvasW || stats.canvasH !== inner.canvasH) {
1828
1877
  warnings.push(
@@ -1831,6 +1880,21 @@ async function lipWarnings(absDir, layers) {
1831
1880
  return { warnings };
1832
1881
  }
1833
1882
  }
1883
+ const box = (m) => ({
1884
+ x0: m.bboxCx - m.w / 2,
1885
+ x1: m.bboxCx + m.w / 2,
1886
+ y0: m.bboxCy - m.h / 2,
1887
+ y1: m.bboxCy + m.h / 2
1888
+ });
1889
+ const cavity = box(inner);
1890
+ for (const role of inside) {
1891
+ const b = box(layers[role]);
1892
+ if (b.x0 < cavity.x0 || b.x1 > cavity.x1 || b.y0 < cavity.y0 || b.y1 > cavity.y1) {
1893
+ warnings.push(
1894
+ `${role}: its box leaves mouth_inner's \u2014 the cavity clips it away there. Recompose from mouth_keyed.png + mouth_interior.png (free).`
1895
+ );
1896
+ }
1897
+ }
1834
1898
  const measurer = createLayerSetMeasurer5({
1835
1899
  width: inner.canvasW,
1836
1900
  height: inner.canvasH
@@ -2080,7 +2144,7 @@ async function measureDir(absDir, noseSpeck) {
2080
2144
  }
2081
2145
  const warnings = [];
2082
2146
  for (const [role, m] of Object.entries(layers)) {
2083
- if (isLipRole(role)) continue;
2147
+ if (isLipLayerRole(role)) continue;
2084
2148
  const edges = [
2085
2149
  ["top", m.edgeTop, m.w, m.marginTop],
2086
2150
  ["left", m.edgeLeft, m.h, m.marginLeft],
@@ -2110,7 +2174,7 @@ async function measureDir(absDir, noseSpeck) {
2110
2174
  }
2111
2175
  }
2112
2176
  for (const [role, m] of Object.entries(layers)) {
2113
- if (role === "body" || isLipRole(role)) continue;
2177
+ if (role === "body" || isLipLayerRole(role)) continue;
2114
2178
  if (m.flatCutRun > FLAT_CUT_MAX_FRAC * m.w && m.flatCutRun >= FLAT_CUT_MIN_PX) {
2115
2179
  warnings.push(
2116
2180
  `${role}: ${m.flatCutRun}px of straight flat edge at y=${m.flatCutY} (${pct(m.flatCutRun / m.w)} of its width) \u2014 the source art is cut through there. ` + (isArm(role) ? `It hides at rest and opens into a seam once the arm raises. ` : `It hides while the head faces front and opens into a seam on turn. `) + `Regenerate this part with the whole subject inside the frame.`
@@ -2253,7 +2317,11 @@ function formatMeasureReport(result) {
2253
2317
  import fs3 from "fs";
2254
2318
  import path7 from "path";
2255
2319
  import sharp4 from "sharp";
2256
- import { ALPHA_OPAQUE as ALPHA_OPAQUE5, detectAlphaBbox as scanAlphaBbox2 } from "@ikijs/editor";
2320
+ import {
2321
+ ALPHA_OPAQUE as ALPHA_OPAQUE5,
2322
+ isLipInsideRole as isLipInsideRole2,
2323
+ detectAlphaBbox as scanAlphaBbox2
2324
+ } from "@ikijs/editor";
2257
2325
 
2258
2326
  // src/compose-arms.ts
2259
2327
  import sharp3 from "sharp";
@@ -2398,10 +2466,11 @@ var DEFAULT_LAYOUT = {
2398
2466
  optional: true
2399
2467
  },
2400
2468
  // The lip set's ONE frame, mouth_open's place: the keyed mouth is split into
2401
- // mouth_inner / lip_lower / lip_upper and all three land here, so a retune
2402
- // moves them together. lip_lower and lip_upper have no key of their own
2403
- // (LIP_FRAME). OPTIONAL and opt-in: with mouth_keyed.png + mouth_interior.png
2404
- // it stands in for mouth and mouth_open.
2469
+ // mouth_inner / lip_lower / lip_upper, the interior's light paint into
2470
+ // mouth_tongue / mouth_teeth, and all of them land here, so a retune moves
2471
+ // them together. The other four have no key of their own (LIP_FRAME).
2472
+ // OPTIONAL and opt-in: with mouth_keyed.png + mouth_interior.png it stands
2473
+ // in for mouth and mouth_open.
2405
2474
  mouth_inner: {
2406
2475
  src: KEYED_SRC,
2407
2476
  cx: 550,
@@ -2456,6 +2525,8 @@ var ORDER = [
2456
2525
  "mouth",
2457
2526
  "mouth_open",
2458
2527
  "mouth_inner",
2528
+ "mouth_tongue",
2529
+ "mouth_teeth",
2459
2530
  "lip_lower",
2460
2531
  "lip_upper",
2461
2532
  "eye_L",
@@ -2958,10 +3029,19 @@ async function composeLayersFromParts(input) {
2958
3029
  });
2959
3030
  continue;
2960
3031
  }
2961
- if (role === "lip_lower" || role === "lip_upper") {
3032
+ if (role === "mouth_tongue" || role === "mouth_teeth" || role === "lip_lower" || role === "lip_upper") {
2962
3033
  if (lipSplit === void 0) continue;
2963
3034
  const { split: split2, w, h, left: left2, top: top2 } = lipSplit;
2964
- const buf = role === "lip_lower" ? split2.lower : split2.upper;
3035
+ const buf = {
3036
+ mouth_tongue: split2.tongue,
3037
+ mouth_teeth: split2.teeth,
3038
+ lip_lower: split2.lower,
3039
+ lip_upper: split2.upper
3040
+ }[role];
3041
+ if (isLipInsideRole2(role) && !await hasCoverage(buf)) {
3042
+ skipped.push(role);
3043
+ continue;
3044
+ }
2965
3045
  placed.push({ role, part: { buf, w, h }, left: left2, top: top2 });
2966
3046
  continue;
2967
3047
  }
@@ -3128,7 +3208,8 @@ async function composeLayersFromParts(input) {
3128
3208
  canvas.width,
3129
3209
  canvas.height
3130
3210
  ),
3131
- lipSplit.left
3211
+ lipSplit.left,
3212
+ lipSplit.top
3132
3213
  );
3133
3214
  for (const role of ORDER) {
3134
3215
  if (placed.some((p) => p.role === role)) continue;
@@ -3152,7 +3233,7 @@ async function composeLayersFromParts(input) {
3152
3233
  });
3153
3234
  }
3154
3235
  const restInput = (role, buf) => {
3155
- if (role === "mouth_inner") return null;
3236
+ if (role === "mouth_inner" || isLipInsideRole2(role)) return null;
3156
3237
  if (closed === void 0) return buf;
3157
3238
  if (role === "lip_upper") return closed.upper;
3158
3239
  if (role === "lip_lower") return closed.lower;
@@ -3223,7 +3304,7 @@ async function composeLayersFromParts(input) {
3223
3304
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3224
3305
  import { z } from "zod";
3225
3306
  function createIkiMcpServer() {
3226
- const server = new McpServer({ name: "iki", version: "0.22.0" });
3307
+ const server = new McpServer({ name: "iki", version: "0.23.1" });
3227
3308
  server.registerTool(
3228
3309
  "validate_iki",
3229
3310
  {
@@ -3288,7 +3369,7 @@ function createIkiMcpServer() {
3288
3369
  server.registerTool(
3289
3370
  "auto_rig_from_layers",
3290
3371
  {
3291
- 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, etc. optional; an arm needs the body, a pose forearm needs its arm, and a partial lip set or one mixed with mouth/mouth_open 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.",
3372
+ 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.",
3292
3373
  inputSchema: {
3293
3374
  layers: z.array(
3294
3375
  z.object({
@@ -3343,7 +3424,7 @@ function createIkiMcpServer() {
3343
3424
  server.registerTool(
3344
3425
  "compose_layers_from_parts",
3345
3426
  {
3346
- 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, eyewhite, iris, brow, hair_front are required, with mouth.png \u2014 or the lip set's mouth_keyed.png (the open mouth, its inside painted flat #00FF00) + mouth_interior.png (the cavity, teeth and tongue alone), which the composer keys and splits into mouth_inner / lip_lower / lip_upper on one frame so auto_rig_from_layers folds the mouth open like the eyelid; the two routes cannot be mixed, one keyed file without the other is refused, and a key that fails (no green, green outside the opening, an outline not closed round it, more than one opening, no skin under the opening, an interior that is only lips, or one drawn opaque on a non-white or noisy ground) is refused naming the regeneration; with the lip set neither mouth nor mouth_open is written and preview.png shows the mouth closed, as the rig draws the rest pose. hair_back, body, mouth_open (legacy route only), blush (one blush.png makes the blush_L/blush_R pair) and nose are optional \u2014 without a nose layer the head still turns on the rig's default 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). One arm.png \u2014 the arm on the screen LEFT, drawn hanging with its shoulder at the top \u2014 makes both arms of a full body: arm_R takes it as drawn and arm_L mirrored. The arms are opt-in: without arm.png the compose is a bust's and `skipped` never lists them. arm.png needs body.png, and each arm is hung on the body's shoulder by default (see `layout`). One forearm_pose.png \u2014 the arm's forearm raised, on the screen LEFT, standing up from its elbow with the hand at the top \u2014 makes both pose forearms (forearm_pose_R as drawn, forearm_pose_L mirrored): each is scaled so its elbow end is as wide as its arm's elbow run and pinned on that arm's elbow (see `layout`), and it needs arm.png. With one, preview-pose.png shows the switch at 1 as the rig draws it (the hanging forearms hidden below the elbow, the pose forearms over everything) while preview.png stays the rest pose; without one it is removed. The inline report carries the full-body checks too: a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge, and a pose forearm without its arm or off its arm's elbow in pivot, width or length. 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. A light mark drawn detached above the eye white, such as a double-eyelid crease, is dropped from the sclera (the iris's clip); dark strokes there stay lash ink. The eyewhite's dark lower lid \u2014 its line and lashes \u2014 becomes lash_lower_L/lash_lower_R, drawn over the iris; a white with none writes none and lists them in `skipped`.",
3427
+ 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, eyewhite, iris, brow, hair_front are required, with mouth.png \u2014 or the lip set's mouth_keyed.png (the open mouth, its inside painted flat #00FF00) + mouth_interior.png (the cavity, teeth and tongue alone), which the composer keys and splits into mouth_inner / lip_lower / lip_upper on one frame so auto_rig_from_layers folds the mouth open like the eyelid, the interior's light paint (luma 100 and over) written as mouth_tongue and mouth_teeth on the same frame, riding the opening's bottom and the upper line and clipped to the cavity (listed in `skipped` when the interior has none); the two routes cannot be mixed, one keyed file without the other is refused, and a key that fails (no green, green outside the opening, an outline not closed round it, more than one opening, no skin under the opening, an interior that is only lips, or one drawn opaque on a non-white or noisy ground) is refused naming the regeneration; with the lip set neither mouth nor mouth_open is written and preview.png shows the mouth closed, as the rig draws the rest pose. hair_back, body, mouth_open (legacy route only), blush (one blush.png makes the blush_L/blush_R pair) and nose are optional \u2014 without a nose layer the head still turns on the rig's default 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). One arm.png \u2014 the arm on the screen LEFT, drawn hanging with its shoulder at the top \u2014 makes both arms of a full body: arm_R takes it as drawn and arm_L mirrored. The arms are opt-in: without arm.png the compose is a bust's and `skipped` never lists them. arm.png needs body.png, and each arm is hung on the body's shoulder by default (see `layout`). One forearm_pose.png \u2014 the arm's forearm raised, on the screen LEFT, standing up from its elbow with the hand at the top \u2014 makes both pose forearms (forearm_pose_R as drawn, forearm_pose_L mirrored): each is scaled so its elbow end is as wide as its arm's elbow run and pinned on that arm's elbow (see `layout`), and it needs arm.png. With one, preview-pose.png shows the switch at 1 as the rig draws it (the hanging forearms hidden below the elbow, the pose forearms over everything) while preview.png stays the rest pose; without one it is removed. The inline report carries the full-body checks too: a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge, and a pose forearm without its arm or off its arm's elbow in pivot, width or length. 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. A light mark drawn detached above the eye white, such as a double-eyelid crease, is dropped from the sclera (the iris's clip); dark strokes there stay lash ink. The eyewhite's dark lower lid \u2014 its line and lashes \u2014 becomes lash_lower_L/lash_lower_R, drawn over the iris; a white with none writes none and lists them in `skipped`.",
3347
3428
  inputSchema: {
3348
3429
  partsDir: z.string().describe(
3349
3430
  "Directory of the source part PNGs (resolved against cwd)."
@@ -3360,7 +3441,7 @@ function createIkiMcpServer() {
3360
3441
  h: z.number()
3361
3442
  }).partial()
3362
3443
  ).optional().describe(
3363
- "Per-role override merged over the built-in defaults, keyed by role \u2014 hair_back, body, arm_L, arm_R, face, blush_L, blush_R, nose, mouth, mouth_open, mouth_inner, eye_L, eye_R, iris_L, iris_R, lash_L, lash_R, brow_L, brow_R, hair_front, forearm_pose_L, forearm_pose_R \u2014 e.g. `{ eye_L: { cx: 660 } }`. `w` is an integer in 1..1100 (the canvas width) and `h` in 1..canvasHeight; 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, mouth_inner, 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. mouth_inner is the lip set's one frame (mouth_open's place by default; lip_lower and lip_upper have no key and land on it, so a retune moves the three together), and with the lip set the nose's tip rule reads layout.mouth_inner.cy. arm_L/arm_R have no cx/cy/w defaults: an unset `w` is 0.4 of the placed body's width, and an unset `cx` or `cy` hangs the arm's shoulder pivot \u2014 the one auto_rig_from_layers turns it about \u2014 on the body box's shoulder corner on that axis: its left edge for arm_R, its right edge for arm_L, 0.12 of its height under its top. A set one centres the arm as for every other role. forearm_pose_L/forearm_pose_R have no cx/cy/w defaults either: an unset `w` scales the forearm so its elbow end (the shoulder rule run from its bottom) is as wide as the placed arm's elbow run, and an unset `cx` or `cy` pins that elbow end's pivot on the arm's elbow \u2014 the one auto_rig_from_layers hangs it from."
3444
+ "Per-role override merged over the built-in defaults, keyed by role \u2014 hair_back, body, arm_L, arm_R, face, blush_L, blush_R, nose, mouth, mouth_open, mouth_inner, eye_L, eye_R, iris_L, iris_R, lash_L, lash_R, brow_L, brow_R, hair_front, forearm_pose_L, forearm_pose_R \u2014 e.g. `{ eye_L: { cx: 660 } }`. `w` is an integer in 1..1100 (the canvas width) and `h` in 1..canvasHeight; 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, mouth_inner, 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. mouth_inner is the lip set's one frame (mouth_open's place by default; lip_lower, lip_upper, mouth_tongue and mouth_teeth have no key and land on it, so a retune moves them together), and with the lip set the nose's tip rule reads layout.mouth_inner.cy. arm_L/arm_R have no cx/cy/w defaults: an unset `w` is 0.4 of the placed body's width, and an unset `cx` or `cy` hangs the arm's shoulder pivot \u2014 the one auto_rig_from_layers turns it about \u2014 on the body box's shoulder corner on that axis: its left edge for arm_R, its right edge for arm_L, 0.12 of its height under its top. A set one centres the arm as for every other role. forearm_pose_L/forearm_pose_R have no cx/cy/w defaults either: an unset `w` scales the forearm so its elbow end (the shoulder rule run from its bottom) is as wide as the placed arm's elbow run, and an unset `cx` or `cy` pins that elbow end's pivot on the arm's elbow \u2014 the one auto_rig_from_layers hangs it from."
3364
3445
  ),
3365
3446
  mirrorParts: z.array(z.string()).optional().describe(
3366
3447
  "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), 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), arm.png as the arm on the screen LEFT (the character's right, hanging, its shoulder at the image's top), and forearm_pose.png as the raised forearm on the screen LEFT (standing up from its elbow, the hand at the image's top, the thumb toward the body at the image's 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."
@@ -3391,7 +3472,7 @@ function createIkiMcpServer() {
3391
3472
  server.registerTool(
3392
3473
  "measure_layers",
3393
3474
  {
3394
- description: "Reports read-only geometry checks over an already-composed layers directory \u2014 the same checks compose_layers_from_parts returns inline (iris ratio/offset, eye aspect, cropped/cut edges, a nose whose dense core is a speck of its crop, missing optional roles, a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge on its shoulder pivot's row, a pose forearm without its arm or whose elbow end is off its arm's elbow in pivot, width or length, and the lip set: a partial one or one beside mouth/mouth_open, the fold's contract per column of the opening, an opening too narrow or short, a line too thin, green left, an interior with holes \u2014 with the opening's size and the MouthOpen below which no slit shows). Every preview*.png is skipped. Use to re-check a layers dir without recomposing. Its nose check reads the composed file against its crop, which is what auto_rig_from_layers acts on. Compose's inline report does the same unless the composer found the source part's core a speck, which it reports instead \u2014 so a speck that resampling erased from the layer shows there and not here.",
3475
+ description: "Reports read-only geometry checks over an already-composed layers directory \u2014 the same checks compose_layers_from_parts returns inline (iris ratio/offset, eye aspect, cropped/cut edges, a nose whose dense core is a speck of its crop, missing optional roles, a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge on its shoulder pivot's row, a pose forearm without its arm or whose elbow end is off its arm's elbow in pivot, width or length, and the lip set: a partial one or one beside mouth/mouth_open, the fold's contract per column of the opening, an opening too narrow or short, a line too thin, green left, an interior with holes, and of mouth_tongue/mouth_teeth: one with no lip set, one on another canvas, one whose box leaves mouth_inner's \u2014 with the opening's size and the MouthOpen below which no slit shows). Every preview*.png is skipped. Use to re-check a layers dir without recomposing. Its nose check reads the composed file against its crop, which is what auto_rig_from_layers acts on. Compose's inline report does the same unless the composer found the source part's core a speck, which it reports instead \u2014 so a speck that resampling erased from the layer shows there and not here.",
3395
3476
  inputSchema: {
3396
3477
  layersDir: z.string().describe(
3397
3478
  "Directory of role-named layer PNGs (resolved against cwd)."
@@ -3468,4 +3549,4 @@ export {
3468
3549
  composeLayersFromParts,
3469
3550
  createIkiMcpServer
3470
3551
  };
3471
- //# sourceMappingURL=chunk-SWRVRVYV.mjs.map
3552
+ //# sourceMappingURL=chunk-UETWUOO7.mjs.map