@ikijs/mcp 0.38.2 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/{chunk-I4P7THTB.mjs → chunk-KLZ6EOMG.mjs} +55 -5
- package/dist/chunk-KLZ6EOMG.mjs.map +1 -0
- package/dist/cli.js +51 -7
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +243 -195
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1
- package/package.json +4 -4
- package/dist/chunk-I4P7THTB.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A stdio [MCP](https://modelcontextprotocol.io/) server that exposes `.iki` model
|
|
|
9
9
|
| Tool | Description |
|
|
10
10
|
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
11
|
| `validate_iki` | Validate a raw `.iki` model — accepts an object or a JSON string — fail-fast, one error at a time. |
|
|
12
|
-
| `describe_iki` | Return a summary of a valid model (inline or by `modelPath`): canvas, parameters, parts, deformers, expressions, motions.
|
|
12
|
+
| `describe_iki` | Return a summary of a valid model (inline or by `modelPath`): canvas, parameters, parts, deformers, expressions, motions, and its `generator` when it records one. |
|
|
13
13
|
| `list_standard_parameters` | List the recommended standard parameter ids (e.g. `ParamAngleX`, `ParamMouthOpenY`) with descriptions. |
|
|
14
14
|
| `describe_rig_plan` | List the fields of `auto_rig_from_layers`'s `rigPlan` with their defaults, ranges, recommended spans, steps and poses. |
|
|
15
15
|
| `auto_rig_from_layers` | Auto-rig role-named PNG layers into a renderable `.iki` written to disk; returns the output path. |
|
|
@@ -36,6 +36,7 @@ Turns a set of role-named, full-canvas transparent PNG layers into a renderable,
|
|
|
36
36
|
- **`bakes`** — optional lattices that move the custom parts when a parameter does, which an unrigged custom part otherwise does not: `{ targets, meshes? }` (`RigBakes` in `@ikijs/editor`; it needs `customParts` and names no other part). A target `{ id?, param, parts, box?, grid: { cols, rows }, stops, mirror?, why? }` is `(cols + 1) x (rows + 1)` control points laid evenly over `box` (canvas px; absent, the union of the parts' rest boxes grown by 2 px), listed row-major from the top-left, with a `[dx, dy]` per point at each stop. Every position and displacement is in canvas px, origin top-left, y down. A stop is the part's TOTAL landed displacement from rest when `param` alone is at that value and every other parameter is at its default, so the head's own carry is inside it and a neighbour's displacement as `probe_rig` measures it is written as it is. Stop keys are values of `param` inside its range, never its default. The landing is exact at rest, at each stop and at one end key the rig writes at the range end on a side whose outermost stop is inside the range (it holds that stop's displacement); a side with no stop is not moved. Between two keys the part's offsets are blended linearly, so under the head's roll the path bows off the line (about 1 px midway over 15°): put a stop where the path matters. Each vertex takes the bilinear value of the lattice at its rest position, and a vertex outside `box` takes the nearest edge's value. `mirror: true` fills a missing stop from the one at the mirrored value, when that value is inside the parameter's range (the lattice reflected about the box's vertical centre line, `dx` negated). Targets that name the same part and parameter sum. `meshes` re-meshes a custom part first (`{ rows, cols }` or `{ cellPx }`). The written model is landed through the engine at every stop and at the range end each side holds its outermost stop to, and compared with the displacement the generator was asked for; a stop off by 0.1 px or more is `INVALID: BAKE ERROR <part> <param>=<value>: …`, and a part the bake moves at rest by as much is `INVALID: BAKE ERROR <part> at rest: …`; both mean the rig and the engine disagree (a bug in the packages, not in the input), and nothing is written, and an input the rig refuses is `INVALID: bakes…` with its path (`bakes.targets[2].stops["30"][7]`), nothing written either. Needs 0.34.0.
|
|
37
37
|
- **The custom gate** — whenever `customParts` is passed the written model is also measured, per custom part, over a pose set: the engine's fold poses, each of the part's own stops alone, and for every pair of parameters it is baked on every combination of their stops (the stops of a part's `occlusion` on its key parameter count as its stops here). Lengths are in face widths (the `face` part's width), so no limit is tied to one canvas; the values are the experiment's over a 402 px face. Lines: `FOLDS` (the part's least triangle area ratio, ≥ 0.1, the engine's collapse); `TIE` (at the tie and a ring around it (5 px on a 402 px face, scaled with the face width), the part's displacement less the anchor's, the largest over the poses where `ParamAngleX` is at its default, ≤ 0.005); `SLIDE` (the same length over the poses that turn the head, ≤ 0.1; and the distance from where the part lands its tie to the nearest painted point of the anchor as the anchor lands it, ≤ 0.015); `EXPOSED` (the canvas pixels within 0.15 face widths of the tie that the part and its anchor both paint: of the two, the one drawn below has art the other hides at rest; at a pose each such pixel is landed through the lower part and counted as showing when no painted point of the upper one lands there; the largest count over the poses where the head does not turn, ≤ 0.0009 face widths², with the largest over the poses that turn it printed beside it, reported and not limited, since a tie allowed to slide uncovers what lies under it; draw order is the model's one `order` per part, so only the pair is read, and cover from any other part does not count unless the part declares an occlusion, below; rest counts 0); `RIGID` (rigid parts only: the least-squares rigid residual of the landed vertices against rest, over the pose set and the midpoint of each neighbouring pair of the part's stops, ≤ 0.0025); `HIDDEN` (only for a part that declares `occlusion`: the occluders, which of them give cover, the key parameter, the amount at rest, where the amount leaves its rest value and where it first reaches 1 on each side of the parameter's default, and how many of the part's poses `TIE` and `SLIDE` left out; reported, no limit, printed after `EXPOSED`); and `TIP` (per baked parameter, at the parameter's ends: where the part's free end lands, where it lands with the part's warps removed, the distance between and the travel end to end; reported, no limit). **What an occlusion excuses.** The gate excuses a reading only where it can establish that the player hides what the reading measures, and keeps the check everywhere else. Cover is an occluder's layer paint as that occluder lands at the pose, and only from an occluder the player draws at full alpha in every pose: colour alpha 1, no transform opacity under 1 and no `opacity` binding, so `mouth_open`, a blush and a pose forearm give none. A pose is left out only when the part is fully hidden across the stretches to the neighbouring sampled values of the key parameter on both sides (the amount is 1 at the pose, at both neighbours and at every occlusion stop between them; the sampled values are the ones the part's pose set takes, the default, its bake stops and its occlusion's stops included): a reading between two samples is bounded by the readings at its ends, so a stretch where the part is drawn keeps both poses it bounds in. For a left-out pose, `TIE` and `SLIDE` leave it out when every ring point lies on the part's mesh and under cover (it is then not counted among `SLIDE`'s turning poses; a line whose every pose is left out says so); `EXPOSED` does not count a hidden-art pixel whose landed spot is under cover, and counts every other pixel as before. An amount under 1 is judged in full, and so is a part whose tie is not under cover. `FOLDS`, `RIGID` and `TIP` read every pose, and the occlusion's stops are sampled like bake stops, so a bake key at one changes no verdict. Each line gives the worst value in px and face widths and its pose, then `pass` or `FAIL: <reason>`; the text ends with `CUSTOM GATE pass` or `CUSTOM GATE FAIL: <part LINE, …>`, always the text's last line. `FOLDS`, `TIE`, `SLIDE`, `EXPOSED` and `RIGID` each fail the gate, `TIP` never does; a tie no ring point of which lies on both the part and its anchor fails `TIE` with that reason. The model is written either way, and the folds and physics reports for the rest of the model stay report-only. `HIDDEN` needs 0.35.0. Needs 0.34.0: from then on `customParts` always carries `gate`, so a result without `customParts` is from an older server and was never gated. A gate that throws still writes the file and returns the path, with `gate.ok` false, `gate.failed` `["gate error: <message>"]` and the text ending `CUSTOM GATE FAIL: gate error: <message>`.
|
|
38
38
|
- **Result** — on success the result text is the written file path, then one `RIGPLAN: turn.amount=1 …` line (every plan field's effective value, each annotated with `(requested …, clamped at …)` where the art's room cut it or `(fitted by turnTargets.…)` where a cue fitted it), then one `PATCH <i> <target> at <Param=v …>: <moved> of <of> points (cols a-b, rows c-d), largest move <maxPx> model px` line per patch op (`(vertices)` in place of the columns and rows for a mesh part), then the rig's fold report lines and its `PHYSICS` lines (as `render_poses` prints them), then, with side locks and a `nose` (which `turn` needs), the `HAIRSIDE` lines, then one `CUSTOM <id>: box x,y WxH px, mesh N vertices M triangles, order O, atlas page P` line per custom part, then, with `bakes`, one `BAKE <part> <param>: N vertices, stops …, error E px` line per part and parameter (E: the engine's landing against the asked displacement, under 0.1 px; carried as `customParts.bakes`), then, with `customParts`, the custom gate's `CUSTOM <id> <LINE>: …` lines and `CUSTOM GATE pass` or `CUSTOM GATE FAIL: …` last (carried as `customParts.gate`: `ok`, `limits`, `parts` with each measure, `failed`), and `structuredContent` carries `{ ok: true, path, canvas, partCount, atlasBytes, headHalfWidth?, headHalfWidthApplied, headEdges?, strandEdges?, noseCore?, turn?, patches?, folds, physics, rigPlan, customParts? }`. `rigPlan` is `{ requested, effective, clamped, overriddenBy }` — the plan as passed, every field's value the rig built with, the plan-owned fields the room cut (`{ field, bound }`) and the fields a `turnTargets` cue fitted instead (path to cue); it is always present on a rigged model, and a result without it comes from a server before 0.30.0. `patches` is what each op moved (`index`, `target`, `at`, `moved`, `of`, `cols`/`rows` for a grid, `maxPx`) and is present whenever `patches` was passed, `[]` included. `customParts` is `{ parts, bakes?, gate }`, each part `{ id, box, mesh: { vertices, triangles }, order, page }` (`box` the layer's alpha box in canvas px, `page` the last atlas page), present whenever `customParts` was passed, `[]` included; `bakes` (`{ part, param, vertices, stops, errorPx }` per baked part and parameter) is present only when `bakes` was passed. `atlasBytes` is the embedded atlas's data-URI length, summed over every page: the nose's own, when it has one, and the custom parts' page. `headHalfWidth` is the head measured here rather than asked for: the layers' own opaque union at the eye row, under the same `alpha >= 128` rule and ±10-row band `measure_turn_reference` spans a render with, so the rig's own rest render measures that span back; it is **absent** when that union has no span there at all (translucent art painted below alpha 128 — still a valid layer set, just with nothing to measure). `headHalfWidthApplied` is `false` when the measured value is absent, or no wider than the face plate (a hairless set, or one widest at the plate itself) — the generator will not take such a head, so the plate stands in for it and the rig is still produced either way. `headEdges` is a companion to a measured, applied `headHalfWidth` (absent otherwise): every role with an opaque pixel in that same eye-row band, per side, each with its own rest x there — passed straight to the generator's own `options.headEdges` so it can tell which part's own deformation actually carries the union's outermost pixel through the turn. `strandEdges` is each side's iris and the `hair_front` run it would slide under on the turn, measured whenever the layers include `hair_front`, `iris_L` and `iris_R`: the iris's opaque span and the run's outer and face-side ends as pixel edges on the row holding the iris's centre (a run that reaches the other iris's centre, a fringe spanning the face, has `runFace: null`; a run narrower than half the iris's painted width on that row is hair detail the iris may cross, and is skipped as if clear) — passed straight to the generator's own `options.strandEdges`, which keeps the far iris from sliding under the bangs any further than it is painted. `turn` is what the solve settled on — `{ radius, holdBase, depths, achieved: { eyeShift, farEyeRatio, silhouetteRatio }, clamped, strandOverlap? }`, where `achieved` is what the rig does reach and `clamped` names every target the rig cut down: the turn (`eyeShift`, passed or the profile's own) where the face plate's edge or the strand cut it short, and a profile `noseShift` / `mouthShift` past its room. `strandOverlap` gives, per side whose far iris the bangs still cover at some far stop, the covered width — how much of the iris's painted row the run covers where that is largest (`deg`, `px`, and `hh` in head half-widths), how much it covers at rest (`restPx`), and whether the bound held (`held`: `true` means the iris is kept no deeper under the run than it is painted; `false` means the art left no room to — always so for a fringe spanning the face — and `px` is what stays covered); it is absent when nothing is covered. `noseCore` is the nose's dense core in canvas px — its pixels at alpha >= 128, not grown, the box handed to the generator as the nose layer's `denseCore` and its turn landmark — absent without a `nose` layer, when it has no pixel at that threshold (painted wholly translucent), or when that core is a speck of the nose's crop (under a quarter of its width or height, such as a lone nostril mark), and in both of the last two cases the crop stands in for it. `hairSide` (inside `turn`, present only with a side lock) is `{ left?, right? }` by screen side — `left` the lock at −x (`hair_side_R`), `right` at +x — each `{ role, cover?, tail?, unavailable? }`, report-only, measured as the far lock at its side's far stops (−15 and −30 on the left, 15 and 30 on the right), px, every x landed through the rendered rig: `cover` is `{ deg, px, y, rest }`, the least over the lock's rows on the face plate that cover the head's edge at rest (a root under the bangs, or the rows an ear shows beside the lock, lie inside it by design and do not count) and over the far stops of the lock's outer edge minus the head's edge (the plate's painted edge, with any ear replaced by the head's edge beneath it, so an ear does not count as cheek the lock covers), positive still covering it and negative the turn baring cheek the lock hides at rest, `rest` that row's cover at rest (≥ 0, read off the geometry; `px` may exceed it), `y` the row where it is least in model space (the canvas centre the origin, +y up — the line also gives it as model px from the top, the row of the layer PNG); `tail` is `{ deg, eyeToLock, lashToLock?, eyeToPlate }` for the far eye's outer corner on the eye's centre row at the stop where `eyeToLock` is least — the corner against the lock's face-side edge, positive a gap and negative under the lock (intended), `lashToLock` the same for the lash box with a `lash_*` layer, and `eyeToPlate` the corner's signed distance from that head edge (positive: inside it; negative: past it). A metric that cannot be read is omitted; a lock measured without `rowRuns` (never the case through this tool) carries `unavailable` (a reason) and nothing else. The result text prints them as `HAIRSIDE cover <role>: …` / `HAIRSIDE tail <role>: …` lines, one per metric present, the lock named by its role (`hair_side_R` hangs on the screen left), the pose as the setting that reproduces it (`ParamAngleX=-30`) and every edge distance signed to one decimal in model px (`+0.0` for zero); a lock with neither prints `HAIRSIDE <role>: no cover or tail row`, one carrying `unavailable` prints `HAIRSIDE <role>: unavailable — <why>`; a set with no side lock prints none. `turn` is absent without a `nose` layer. `folds` is the written model's fold report, the engine's `checkFolds` over its own pose set (`{ poses, thresholds, targets, offenders }`, described under `render_poses`); it never refuses a rig — a model that folds is still written and returned — and each fold names its pose by its parameter settings, which a host reproduces by setting those parameters on a player (`IkiPlayer.setParameter`). `physics` is the written model's physics report, the engine's `checkPhysics` over its rigs (`{ thresholds, targets, offenders }`, described under `render_poses`) — the hair springs a `hair_front` layer brings (two for the front hair and, with `hair_back`, one for the back), or none — and never refuses a rig either. The (potentially multi-MB) model is written to disk, not inlined. Invalid input (a `patches` op the rig refuses — `INVALID: patches[i]…`, naming the stops, targets or roles there are; unknown/missing role, an arm without a `body`, empty layer, mismatched sizes, bad path, an atlas page over 4096 px on a side, or an atlas over 12 MiB; art the rig cannot build on, such as a body's hips with no room under its pivots for a row line or for the body's motion, or an arm too short to hang an elbow under its shoulder; a `turnTargets` field that is unknown or that this layer set cannot reach — any passed field other than an `eyeShift` past the art's room; a `rigPlan` field out of range or unknown, or the removed `style` input; the message names the field and the attainable range) returns `{ ok: false, error }` with a `INVALID: …` text — not a protocol error. An argument the tool's input schema refuses — a `turnTargets` or `rigPlan` that is not an object, or one of their named fields that is not a number — never reaches the tool: the MCP SDK answers with an `isError` result whose text is `MCP error -32602: Input validation error: …`, and no `structuredContent`.
|
|
39
|
+
- **The model's `generator`** (0.39.0 on) — the written model records what made it: `{ tool: "@ikijs/mcp@<version>", rigger: "@ikijs/editor@<version>" }` (the installed `@ikijs/editor`'s version), plus `plugin` when the server was launched with the `IKI_PLUGIN` environment variable set to a label such as `iki@0.59.4`, as the Iki plugin's `.mcp.json` does. It is not a tool input: a caller cannot set it. A value of `IKI_PLUGIN` that is no label (empty counts as unset; blank, over 128 characters or with a control character does not) refuses the rig as `INVALID: the IKI_PLUGIN environment variable is no label for a model: …`. `describe_iki` returns a model's `generator` in its summary. The library function `autoRigFromLayers` writes a `generator` only when it is passed one (`toolGenerator()` builds the tool's), so the same layers give the same bytes across releases.
|
|
39
40
|
|
|
40
41
|
The decode/atlas pipeline runs in Node via `sharp` (a native dependency confined to this package); it mirrors the browser editor app's import flow and reuses the pure `@ikijs/editor` model + atlas math, so both paths produce the same rig. The fold and physics checks run the workspace `@ikijs/engine`, inlined into this package's Node build (as it already is into the `render_poses` page script), while `@ikijs/format` stays an external dependency.
|
|
41
42
|
|
|
@@ -4304,6 +4304,7 @@ function clearSweepDir(real) {
|
|
|
4304
4304
|
import { readFileSync as readFileSync3 } from "fs";
|
|
4305
4305
|
import path5 from "path";
|
|
4306
4306
|
import {
|
|
4307
|
+
parseIkiGenerator,
|
|
4307
4308
|
parseIkiModel,
|
|
4308
4309
|
loadIkiModel as loadIkiModel3,
|
|
4309
4310
|
IkiFormatError as IkiFormatError3,
|
|
@@ -4499,6 +4500,7 @@ function describeIki(model) {
|
|
|
4499
4500
|
motions,
|
|
4500
4501
|
bustScale
|
|
4501
4502
|
};
|
|
4503
|
+
if (m.generator !== void 0) summary.generator = m.generator;
|
|
4502
4504
|
const face = m.parts.find((p) => p.id === "face");
|
|
4503
4505
|
if (face !== void 0) summary.faceWidth = face.width;
|
|
4504
4506
|
return { ok: true, summary };
|
|
@@ -4688,6 +4690,14 @@ async function renderAtlasPage(crops, quantizeColors) {
|
|
|
4688
4690
|
}
|
|
4689
4691
|
async function autoRigFromLayers(input) {
|
|
4690
4692
|
try {
|
|
4693
|
+
if (input.generator !== void 0) {
|
|
4694
|
+
try {
|
|
4695
|
+
parseIkiGenerator(input.generator);
|
|
4696
|
+
} catch (e) {
|
|
4697
|
+
if (e instanceof IkiFormatError3) throw new AutoRigInputError(e.message);
|
|
4698
|
+
throw e;
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4691
4701
|
const layers = input.layers;
|
|
4692
4702
|
if (!Array.isArray(layers) || layers.length === 0) {
|
|
4693
4703
|
throw new AutoRigInputError("layers must be a non-empty array");
|
|
@@ -4953,7 +4963,9 @@ async function autoRigFromLayers(input) {
|
|
|
4953
4963
|
patched.parts.find((p) => p.id === crop.id).texture.index = pages.length;
|
|
4954
4964
|
}
|
|
4955
4965
|
}
|
|
4956
|
-
const finalModel = parseIkiModel(
|
|
4966
|
+
const finalModel = parseIkiModel(
|
|
4967
|
+
input.generator === void 0 ? patched : { ...patched, generator: input.generator }
|
|
4968
|
+
);
|
|
4957
4969
|
const bakes = bakeReports === void 0 ? void 0 : checkBakes(finalModel, bakeReports);
|
|
4958
4970
|
writeFileAtomic(outPath, JSON.stringify(finalModel));
|
|
4959
4971
|
const folds = checkModelFolds(finalModel);
|
|
@@ -7953,6 +7965,30 @@ async function composeLayersFromParts(input) {
|
|
|
7953
7965
|
}
|
|
7954
7966
|
}
|
|
7955
7967
|
|
|
7968
|
+
// src/generator.ts
|
|
7969
|
+
import { EDITOR_VERSION } from "@ikijs/editor";
|
|
7970
|
+
import {
|
|
7971
|
+
IkiFormatError as IkiFormatError4,
|
|
7972
|
+
parseIkiGenerator as parseIkiGenerator2
|
|
7973
|
+
} from "@ikijs/format";
|
|
7974
|
+
var PLUGIN_ENV = "IKI_PLUGIN";
|
|
7975
|
+
function toolGenerator(env = process.env) {
|
|
7976
|
+
const generator = {
|
|
7977
|
+
tool: `@ikijs/mcp@${"0.39.0"}`,
|
|
7978
|
+
rigger: `@ikijs/editor@${EDITOR_VERSION}`
|
|
7979
|
+
};
|
|
7980
|
+
const plugin = env[PLUGIN_ENV];
|
|
7981
|
+
if (plugin === void 0 || plugin === "") return generator;
|
|
7982
|
+
try {
|
|
7983
|
+
return parseIkiGenerator2({ ...generator, plugin });
|
|
7984
|
+
} catch (e) {
|
|
7985
|
+
if (!(e instanceof IkiFormatError4)) throw e;
|
|
7986
|
+
throw new IkiFormatError4(
|
|
7987
|
+
`the ${PLUGIN_ENV} environment variable is no label for a model: ${e.message}`
|
|
7988
|
+
);
|
|
7989
|
+
}
|
|
7990
|
+
}
|
|
7991
|
+
|
|
7956
7992
|
// src/hair-side-report.ts
|
|
7957
7993
|
function signedPx(px2) {
|
|
7958
7994
|
const s = px2.toFixed(1);
|
|
@@ -12590,6 +12626,7 @@ function formatCutReport(r) {
|
|
|
12590
12626
|
// src/server.ts
|
|
12591
12627
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12592
12628
|
import { z } from "zod";
|
|
12629
|
+
import { IkiFormatError as IkiFormatError5 } from "@ikijs/format";
|
|
12593
12630
|
function formatPatchReports(reports) {
|
|
12594
12631
|
return reports.map((r) => {
|
|
12595
12632
|
const at = Object.keys(r.at).sort().map((p) => `${p}=${r.at[p]}`).join(" ");
|
|
@@ -12611,7 +12648,7 @@ function formatBakeChecks(bakes) {
|
|
|
12611
12648
|
);
|
|
12612
12649
|
}
|
|
12613
12650
|
function createIkiMcpServer() {
|
|
12614
|
-
const server = new McpServer({ name: "iki", version: "0.
|
|
12651
|
+
const server = new McpServer({ name: "iki", version: "0.39.0" });
|
|
12615
12652
|
server.registerTool(
|
|
12616
12653
|
"validate_iki",
|
|
12617
12654
|
{
|
|
@@ -12638,7 +12675,7 @@ function createIkiMcpServer() {
|
|
|
12638
12675
|
server.registerTool(
|
|
12639
12676
|
"describe_iki",
|
|
12640
12677
|
{
|
|
12641
|
-
description: "Summarizes a valid model's canvas/params/parts/deformers and its expressions and motion clips (with the descriptions a host picks them by); returns an error for an invalid model. It is also the patch writer's view of a rigged model: each part's rest box in model px and in bust-render px, each part's warp stops, each warp2d's stops, and faceWidth, which is what an auto_rig_from_layers `patches` op is aimed with. Pass exactly one of model or modelPath; prefer modelPath for a written rig so a large model never crosses your context.",
|
|
12678
|
+
description: "Summarizes a valid model's canvas/params/parts/deformers and its expressions and motion clips (with the descriptions a host picks them by), and its `generator` (what wrote it: tool, rigger and plugin, each name@version) when it records one; returns an error for an invalid model. It is also the patch writer's view of a rigged model: each part's rest box in model px and in bust-render px, each part's warp stops, each warp2d's stops, and faceWidth, which is what an auto_rig_from_layers `patches` op is aimed with. Pass exactly one of model or modelPath; prefer modelPath for a written rig so a large model never crosses your context.",
|
|
12642
12679
|
inputSchema: {
|
|
12643
12680
|
model: z.unknown().optional().describe("Raw .iki model JSON (object or JSON string)"),
|
|
12644
12681
|
modelPath: z.string().optional().describe(
|
|
@@ -12703,7 +12740,7 @@ function createIkiMcpServer() {
|
|
|
12703
12740
|
server.registerTool(
|
|
12704
12741
|
"auto_rig_from_layers",
|
|
12705
12742
|
{
|
|
12706
|
-
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, hair_side_L/hair_side_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, a side lock needs hair_front, 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. With side locks and a `nose` (which `turn` needs) the `HAIRSIDE` lines follow the `PHYSICS` lines (the result's `turn.hairSide`), each naming the lock's role, report-only as well. `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. `customParts` adds parts the rig has no role for (a twin tail, a hairpin), each from a canvas-sized PNG of its own, as an unrigged mesh on `headDeformer` after its `after` role's parts; it needs @ikijs/mcp 0.34.0, and an older server drops the field and returns no `customParts`. A part can declare `occlusion` (hidden where named roles' paint covers it, by an amount keyed on a parameter; it needs 0.35.0, and an older server refuses the key as `INVALID: customParts[i]\u2026`); its `CUSTOM <id>:` line then ends `, hidden by <id>,<id>\u2026 on <parameter> at <value>:<amount> <value>:<amount>\u2026`, and the result's part carries `occlusion` (`by` as the part ids written, `parameter`, `stops`). The result's `customParts` (`parts`: `id`, rest `box`, `mesh`, `order`, atlas `page`) is present whenever the input was passed, `[]` included, and one `CUSTOM <id>: \u2026` line per part follows the `HAIRSIDE` lines. `bakes` (see its field) moves the custom parts with a parameter and needs `customParts`; each part and parameter it moves then prints one `BAKE <part> <param>: <n> vertices, stops <values>, error <px> px` line after the `CUSTOM` lines (the result's `customParts.bakes`: `part`, `param`, `vertices`, `stops`, `errorPx`), the written model having been landed through the engine, and a stop off by 0.1 px or more comes back as `INVALID: BAKE ERROR <part> <param>=<value>: \u2026`, and a part the bake moves at rest as `INVALID: BAKE ERROR <part> at rest: \u2026`, with nothing written (the rig and the engine disagree: report it as a bug in the packages). Whenever `customParts` was passed, the written model is also measured per custom part (the result's `customParts.gate`: `ok`, `limits`, `parts`, `failed`) and the text ends with its lines, `CUSTOM <id> FOLDS|TIE|SLIDE|EXPOSED|RIGID|TIP: \u2026` then `CUSTOM GATE pass` or `CUSTOM GATE FAIL: <part LINE, \u2026>`, always the last line: a part's least triangle area ratio, its tie's displacement against the anchor where the head does not turn and where it does, the hidden art showing, how far a rigid part bends and where its free end lands, each in px and face widths with its worst pose; `TIP` never fails the gate and the other lines do. The model is written either way; from 0.34.0 on `customParts` always carries `gate` (a gate that throws still writes the file and ends the text `CUSTOM GATE FAIL: gate error: <message>`), so a result without `customParts` is from an older server and was never gated. The custom layers are not role layers: they are left out of the head's width and turn measurements, and an empty or wrong-size one, or an entry the rig refuses, comes back as `INVALID: customParts[i]\u2026` with nothing written. A missing field or one of the wrong type (a `tie` that is not two numbers, say) is refused by the schema itself, as the SDK's input validation error.",
|
|
12743
|
+
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, hair_side_L/hair_side_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, a side lock needs hair_front, 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. With side locks and a `nose` (which `turn` needs) the `HAIRSIDE` lines follow the `PHYSICS` lines (the result's `turn.hairSide`), each naming the lock's role, report-only as well. `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. `customParts` adds parts the rig has no role for (a twin tail, a hairpin), each from a canvas-sized PNG of its own, as an unrigged mesh on `headDeformer` after its `after` role's parts; it needs @ikijs/mcp 0.34.0, and an older server drops the field and returns no `customParts`. A part can declare `occlusion` (hidden where named roles' paint covers it, by an amount keyed on a parameter; it needs 0.35.0, and an older server refuses the key as `INVALID: customParts[i]\u2026`); its `CUSTOM <id>:` line then ends `, hidden by <id>,<id>\u2026 on <parameter> at <value>:<amount> <value>:<amount>\u2026`, and the result's part carries `occlusion` (`by` as the part ids written, `parameter`, `stops`). The result's `customParts` (`parts`: `id`, rest `box`, `mesh`, `order`, atlas `page`) is present whenever the input was passed, `[]` included, and one `CUSTOM <id>: \u2026` line per part follows the `HAIRSIDE` lines. `bakes` (see its field) moves the custom parts with a parameter and needs `customParts`; each part and parameter it moves then prints one `BAKE <part> <param>: <n> vertices, stops <values>, error <px> px` line after the `CUSTOM` lines (the result's `customParts.bakes`: `part`, `param`, `vertices`, `stops`, `errorPx`), the written model having been landed through the engine, and a stop off by 0.1 px or more comes back as `INVALID: BAKE ERROR <part> <param>=<value>: \u2026`, and a part the bake moves at rest as `INVALID: BAKE ERROR <part> at rest: \u2026`, with nothing written (the rig and the engine disagree: report it as a bug in the packages). Whenever `customParts` was passed, the written model is also measured per custom part (the result's `customParts.gate`: `ok`, `limits`, `parts`, `failed`) and the text ends with its lines, `CUSTOM <id> FOLDS|TIE|SLIDE|EXPOSED|RIGID|TIP: \u2026` then `CUSTOM GATE pass` or `CUSTOM GATE FAIL: <part LINE, \u2026>`, always the last line: a part's least triangle area ratio, its tie's displacement against the anchor where the head does not turn and where it does, the hidden art showing, how far a rigid part bends and where its free end lands, each in px and face widths with its worst pose; `TIP` never fails the gate and the other lines do. The model is written either way; from 0.34.0 on `customParts` always carries `gate` (a gate that throws still writes the file and ends the text `CUSTOM GATE FAIL: gate error: <message>`), so a result without `customParts` is from an older server and was never gated. The custom layers are not role layers: they are left out of the head's width and turn measurements, and an empty or wrong-size one, or an entry the rig refuses, comes back as `INVALID: customParts[i]\u2026` with nothing written. A missing field or one of the wrong type (a `tie` that is not two numbers, say) is refused by the schema itself, as the SDK's input validation error. The written model records what made it as `generator`: this server and the auto-rigger, each name@version, and the plugin named in the server's IKI_PLUGIN environment variable, if any; it is no input.",
|
|
12707
12744
|
inputSchema: {
|
|
12708
12745
|
layers: z.array(
|
|
12709
12746
|
z.object({
|
|
@@ -12847,8 +12884,19 @@ function createIkiMcpServer() {
|
|
|
12847
12884
|
},
|
|
12848
12885
|
async (args) => {
|
|
12849
12886
|
try {
|
|
12887
|
+
let generator;
|
|
12888
|
+
try {
|
|
12889
|
+
generator = toolGenerator();
|
|
12890
|
+
} catch (e) {
|
|
12891
|
+
if (!(e instanceof IkiFormatError5)) throw e;
|
|
12892
|
+
return {
|
|
12893
|
+
content: [{ type: "text", text: `INVALID: ${e.message}` }],
|
|
12894
|
+
structuredContent: { ok: false, error: e.message }
|
|
12895
|
+
};
|
|
12896
|
+
}
|
|
12850
12897
|
const r = await autoRigFromLayers({
|
|
12851
12898
|
...args,
|
|
12899
|
+
generator,
|
|
12852
12900
|
// `.length(2)` makes each region span a pair, which its inferred
|
|
12853
12901
|
// `number[]` cannot say.
|
|
12854
12902
|
patches: args.patches,
|
|
@@ -13287,6 +13335,8 @@ export {
|
|
|
13287
13335
|
measureLayers,
|
|
13288
13336
|
formatMeasureReport,
|
|
13289
13337
|
composeLayersFromParts,
|
|
13338
|
+
PLUGIN_ENV,
|
|
13339
|
+
toolGenerator,
|
|
13290
13340
|
formatHairSideReport,
|
|
13291
13341
|
formatPhysicsReport,
|
|
13292
13342
|
viewIllustrationGrid,
|
|
@@ -13294,4 +13344,4 @@ export {
|
|
|
13294
13344
|
formatCutReport,
|
|
13295
13345
|
createIkiMcpServer
|
|
13296
13346
|
};
|
|
13297
|
-
//# sourceMappingURL=chunk-
|
|
13347
|
+
//# sourceMappingURL=chunk-KLZ6EOMG.mjs.map
|