@ikijs/mcp 0.38.1 → 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 +3 -2
- package/dist/{chunk-SZHJO77J.mjs → chunk-KLZ6EOMG.mjs} +129 -25
- package/dist/chunk-KLZ6EOMG.mjs.map +1 -0
- package/dist/cli.js +125 -27
- 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 +317 -215
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1
- package/package.json +4 -4
- package/dist/chunk-SZHJO77J.mjs.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -30,6 +30,7 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
30
30
|
// src/server.ts
|
|
31
31
|
var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
32
32
|
var import_zod = require("zod");
|
|
33
|
+
var import_format13 = require("@ikijs/format");
|
|
33
34
|
|
|
34
35
|
// src/tools.ts
|
|
35
36
|
var import_node_fs6 = require("fs");
|
|
@@ -4493,6 +4494,7 @@ function describeIki(model) {
|
|
|
4493
4494
|
motions,
|
|
4494
4495
|
bustScale
|
|
4495
4496
|
};
|
|
4497
|
+
if (m.generator !== void 0) summary.generator = m.generator;
|
|
4496
4498
|
const face = m.parts.find((p) => p.id === "face");
|
|
4497
4499
|
if (face !== void 0) summary.faceWidth = face.width;
|
|
4498
4500
|
return { ok: true, summary };
|
|
@@ -4682,6 +4684,14 @@ async function renderAtlasPage(crops, quantizeColors) {
|
|
|
4682
4684
|
}
|
|
4683
4685
|
async function autoRigFromLayers(input) {
|
|
4684
4686
|
try {
|
|
4687
|
+
if (input.generator !== void 0) {
|
|
4688
|
+
try {
|
|
4689
|
+
(0, import_format11.parseIkiGenerator)(input.generator);
|
|
4690
|
+
} catch (e) {
|
|
4691
|
+
if (e instanceof import_format11.IkiFormatError) throw new AutoRigInputError(e.message);
|
|
4692
|
+
throw e;
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4685
4695
|
const layers = input.layers;
|
|
4686
4696
|
if (!Array.isArray(layers) || layers.length === 0) {
|
|
4687
4697
|
throw new AutoRigInputError("layers must be a non-empty array");
|
|
@@ -4947,7 +4957,9 @@ async function autoRigFromLayers(input) {
|
|
|
4947
4957
|
patched.parts.find((p) => p.id === crop.id).texture.index = pages.length;
|
|
4948
4958
|
}
|
|
4949
4959
|
}
|
|
4950
|
-
const finalModel = (0, import_format11.parseIkiModel)(
|
|
4960
|
+
const finalModel = (0, import_format11.parseIkiModel)(
|
|
4961
|
+
input.generator === void 0 ? patched : { ...patched, generator: input.generator }
|
|
4962
|
+
);
|
|
4951
4963
|
const bakes = bakeReports === void 0 ? void 0 : checkBakes(finalModel, bakeReports);
|
|
4952
4964
|
writeFileAtomic(outPath, JSON.stringify(finalModel));
|
|
4953
4965
|
const folds = checkModelFolds(finalModel);
|
|
@@ -7900,6 +7912,27 @@ async function composeLayersFromParts(input) {
|
|
|
7900
7912
|
}
|
|
7901
7913
|
}
|
|
7902
7914
|
|
|
7915
|
+
// src/generator.ts
|
|
7916
|
+
var import_editor15 = require("@ikijs/editor");
|
|
7917
|
+
var import_format12 = require("@ikijs/format");
|
|
7918
|
+
var PLUGIN_ENV = "IKI_PLUGIN";
|
|
7919
|
+
function toolGenerator(env = process.env) {
|
|
7920
|
+
const generator = {
|
|
7921
|
+
tool: `@ikijs/mcp@${"0.39.0"}`,
|
|
7922
|
+
rigger: `@ikijs/editor@${import_editor15.EDITOR_VERSION}`
|
|
7923
|
+
};
|
|
7924
|
+
const plugin = env[PLUGIN_ENV];
|
|
7925
|
+
if (plugin === void 0 || plugin === "") return generator;
|
|
7926
|
+
try {
|
|
7927
|
+
return (0, import_format12.parseIkiGenerator)({ ...generator, plugin });
|
|
7928
|
+
} catch (e) {
|
|
7929
|
+
if (!(e instanceof import_format12.IkiFormatError)) throw e;
|
|
7930
|
+
throw new import_format12.IkiFormatError(
|
|
7931
|
+
`the ${PLUGIN_ENV} environment variable is no label for a model: ${e.message}`
|
|
7932
|
+
);
|
|
7933
|
+
}
|
|
7934
|
+
}
|
|
7935
|
+
|
|
7903
7936
|
// src/hair-side-report.ts
|
|
7904
7937
|
function signedPx(px2) {
|
|
7905
7938
|
const s = px2.toFixed(1);
|
|
@@ -9728,6 +9761,7 @@ var IRIS_IOU = 0.7;
|
|
|
9728
9761
|
var DISC_CLOSE = 2;
|
|
9729
9762
|
var IRIS_MARGIN = 0.25;
|
|
9730
9763
|
var LID_SIDE = 4;
|
|
9764
|
+
var LID_STREAK = 6;
|
|
9731
9765
|
var EYE_EDGE = 2;
|
|
9732
9766
|
var OPENING_SPARE = 2;
|
|
9733
9767
|
var STROKE_PAST_SHARE = 0.5;
|
|
@@ -10054,35 +10088,85 @@ function lashCutOf(pic, all) {
|
|
|
10054
10088
|
function upperLid(pic, f, eye2, c) {
|
|
10055
10089
|
const { width } = pic;
|
|
10056
10090
|
const { b, cx, cy, rx } = f;
|
|
10091
|
+
const mid = Math.min(b.y1, Math.floor(cy));
|
|
10057
10092
|
const lid = new Int32Array(width).fill(-1);
|
|
10058
|
-
const
|
|
10093
|
+
const dark = (x, y) => {
|
|
10094
|
+
const i = y * width + x;
|
|
10095
|
+
return eye2[i] === 1 && c.dark(i);
|
|
10096
|
+
};
|
|
10097
|
+
const ink = (x, y) => dark(x, y) && !c.nearIris(y * width + x);
|
|
10098
|
+
const softTop = (x, top) => {
|
|
10099
|
+
let y = top;
|
|
10100
|
+
while (y - 1 >= b.y0 && top - (y - 1) <= EYE_EDGE && dark(x, y - 1)) y--;
|
|
10101
|
+
return y;
|
|
10102
|
+
};
|
|
10103
|
+
const runEnd = (x, y, step) => {
|
|
10104
|
+
const inside = (r) => r >= b.y0 && r <= mid;
|
|
10105
|
+
for (; ; ) {
|
|
10106
|
+
while (inside(y + step) && ink(x, y + step)) y += step;
|
|
10107
|
+
let rows = 0;
|
|
10108
|
+
while (rows <= LID_STREAK) {
|
|
10109
|
+
const r = y + step * (rows + 1);
|
|
10110
|
+
if (!inside(r) || !dark(x, r) || ink(x, r)) break;
|
|
10111
|
+
rows++;
|
|
10112
|
+
}
|
|
10113
|
+
const next = y + step * (rows + 1);
|
|
10114
|
+
if (rows === 0 || rows > LID_STREAK || !inside(next) || !ink(x, next)) {
|
|
10115
|
+
return y;
|
|
10116
|
+
}
|
|
10117
|
+
y = next;
|
|
10118
|
+
}
|
|
10119
|
+
};
|
|
10120
|
+
const fromTop = (x) => {
|
|
10121
|
+
let run2 = null;
|
|
10122
|
+
let skin = false;
|
|
10123
|
+
for (let y = b.y0; y <= mid; y++) {
|
|
10124
|
+
if (!ink(x, y)) {
|
|
10125
|
+
if (eye2[y * width + x] === 0) skin = true;
|
|
10126
|
+
continue;
|
|
10127
|
+
}
|
|
10128
|
+
if (run2 !== null && !skin) break;
|
|
10129
|
+
const top = y;
|
|
10130
|
+
y = runEnd(x, y, 1);
|
|
10131
|
+
run2 = [softTop(x, top), y];
|
|
10132
|
+
skin = false;
|
|
10133
|
+
}
|
|
10134
|
+
return run2;
|
|
10135
|
+
};
|
|
10136
|
+
const fromInside = (x) => {
|
|
10137
|
+
let y = mid;
|
|
10138
|
+
if (ink(x, y)) return null;
|
|
10139
|
+
while (y >= b.y0 && !ink(x, y)) y--;
|
|
10140
|
+
if (y < b.y0) return null;
|
|
10141
|
+
return [softTop(x, runEnd(x, y, -1)), y];
|
|
10142
|
+
};
|
|
10143
|
+
const x0 = Math.max(b.x0, Math.ceil(cx - rx));
|
|
10144
|
+
const x1 = Math.min(b.x1, Math.floor(cx + rx));
|
|
10059
10145
|
for (let x = b.x0; x <= b.x1; x++) {
|
|
10060
|
-
|
|
10061
|
-
const
|
|
10062
|
-
|
|
10063
|
-
while (y <= b.y1 && !(eye2[at(y)] && c.dark(at(y)))) y++;
|
|
10064
|
-
const first = y;
|
|
10065
|
-
while (y <= b.y1 && y - first < EYE_EDGE && !lashInk(y)) y++;
|
|
10066
|
-
if (y > b.y1 || y >= cy || !lashInk(y)) continue;
|
|
10067
|
-
lashTop[x] = first;
|
|
10068
|
-
while (y + 1 <= Math.min(b.y1, Math.floor(cy)) && lashInk(y + 1)) y++;
|
|
10069
|
-
lid[x] = y;
|
|
10146
|
+
if (x >= x0 && x <= x1) continue;
|
|
10147
|
+
const run2 = fromInside(x) ?? fromTop(x);
|
|
10148
|
+
if (run2) lid[x] = run2[1];
|
|
10070
10149
|
}
|
|
10071
10150
|
const thickness = (from, step) => {
|
|
10072
10151
|
const t = [];
|
|
10073
10152
|
for (let x = from; t.length < LID_SIDE && x >= b.x0 && x <= b.x1; x += step) {
|
|
10074
|
-
|
|
10153
|
+
const run2 = fromInside(x) ?? fromTop(x);
|
|
10154
|
+
if (run2) t.push(run2[1] - run2[0] + 1);
|
|
10075
10155
|
}
|
|
10076
10156
|
return t.length > 0 ? median(t) : null;
|
|
10077
10157
|
};
|
|
10078
10158
|
const left = thickness(Math.floor(cx - rx) - 1, -1);
|
|
10079
10159
|
const right = thickness(Math.ceil(cx + rx) + 1, 1);
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
if (
|
|
10160
|
+
for (let x = x0; x <= x1; x++) {
|
|
10161
|
+
const run2 = fromTop(x);
|
|
10162
|
+
if (!run2) continue;
|
|
10163
|
+
if (left === null && right === null) {
|
|
10164
|
+
lid[x] = run2[1];
|
|
10165
|
+
continue;
|
|
10166
|
+
}
|
|
10083
10167
|
const u = (x - (cx - rx)) / (2 * rx);
|
|
10084
10168
|
const t = left === null ? right : right === null ? left : left + (right - left) * u;
|
|
10085
|
-
lid[x] = Math.min(
|
|
10169
|
+
lid[x] = Math.min(run2[1], run2[0] + Math.round(t) - 1);
|
|
10086
10170
|
}
|
|
10087
10171
|
return lid;
|
|
10088
10172
|
}
|
|
@@ -10106,9 +10190,12 @@ function lowerLidAcross(pic, f, eye2, c, lashCut, upper) {
|
|
|
10106
10190
|
const runs = [];
|
|
10107
10191
|
for (let k = 0; k < LID_SIDE; k++) {
|
|
10108
10192
|
const x = from + k * step;
|
|
10109
|
-
|
|
10110
|
-
const
|
|
10111
|
-
if (run2
|
|
10193
|
+
const run2 = x < b.x0 || x > b.x1 ? null : runAt(x);
|
|
10194
|
+
const prev = runs[runs.length - 1];
|
|
10195
|
+
if (!run2 || prev && (run2[0] > prev[1] + LID_DRIFT || run2[1] < prev[0] - LID_DRIFT)) {
|
|
10196
|
+
return [];
|
|
10197
|
+
}
|
|
10198
|
+
runs.push(run2);
|
|
10112
10199
|
}
|
|
10113
10200
|
return runs;
|
|
10114
10201
|
};
|
|
@@ -10971,7 +11058,7 @@ function cutFeatures(ctx, lipSet = false) {
|
|
|
10971
11058
|
}
|
|
10972
11059
|
|
|
10973
11060
|
// src/illustration-landmarks.ts
|
|
10974
|
-
var
|
|
11061
|
+
var import_editor16 = require("@ikijs/editor");
|
|
10975
11062
|
var DEFAULT_BROW_HALF_WIDTH = 8;
|
|
10976
11063
|
var DEFAULT_BROW_TAIL_HALF_WIDTH = 5;
|
|
10977
11064
|
var KEYS = {
|
|
@@ -11125,11 +11212,11 @@ function brow(path12, v, canvas) {
|
|
|
11125
11212
|
tailHalfWidth: o.tailHalfWidth === void 0 ? DEFAULT_BROW_TAIL_HALF_WIDTH : positive(`${path12}.tailHalfWidth`, o.tailHalfWidth)
|
|
11126
11213
|
};
|
|
11127
11214
|
}
|
|
11128
|
-
var YIELDED_PART_IDS = new Set(ARM_ROLES.flatMap((r) => (0,
|
|
11215
|
+
var YIELDED_PART_IDS = new Set(ARM_ROLES.flatMap((r) => (0, import_editor16.partIdsOfRole)(r)));
|
|
11129
11216
|
function isReservedId(id) {
|
|
11130
11217
|
if (YIELDED_PART_IDS.has(id)) return true;
|
|
11131
11218
|
try {
|
|
11132
|
-
(0,
|
|
11219
|
+
(0, import_editor16.partIdsOfRole)(id);
|
|
11133
11220
|
return true;
|
|
11134
11221
|
} catch {
|
|
11135
11222
|
return false;
|
|
@@ -12502,7 +12589,7 @@ function formatBakeChecks(bakes) {
|
|
|
12502
12589
|
);
|
|
12503
12590
|
}
|
|
12504
12591
|
function createIkiMcpServer() {
|
|
12505
|
-
const server = new import_mcp.McpServer({ name: "iki", version: "0.
|
|
12592
|
+
const server = new import_mcp.McpServer({ name: "iki", version: "0.39.0" });
|
|
12506
12593
|
server.registerTool(
|
|
12507
12594
|
"validate_iki",
|
|
12508
12595
|
{
|
|
@@ -12529,7 +12616,7 @@ function createIkiMcpServer() {
|
|
|
12529
12616
|
server.registerTool(
|
|
12530
12617
|
"describe_iki",
|
|
12531
12618
|
{
|
|
12532
|
-
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.",
|
|
12619
|
+
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.",
|
|
12533
12620
|
inputSchema: {
|
|
12534
12621
|
model: import_zod.z.unknown().optional().describe("Raw .iki model JSON (object or JSON string)"),
|
|
12535
12622
|
modelPath: import_zod.z.string().optional().describe(
|
|
@@ -12594,7 +12681,7 @@ function createIkiMcpServer() {
|
|
|
12594
12681
|
server.registerTool(
|
|
12595
12682
|
"auto_rig_from_layers",
|
|
12596
12683
|
{
|
|
12597
|
-
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.",
|
|
12684
|
+
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.",
|
|
12598
12685
|
inputSchema: {
|
|
12599
12686
|
layers: import_zod.z.array(
|
|
12600
12687
|
import_zod.z.object({
|
|
@@ -12662,7 +12749,7 @@ function createIkiMcpServer() {
|
|
|
12662
12749
|
),
|
|
12663
12750
|
occlusion: import_zod.z.object({
|
|
12664
12751
|
by: import_zod.z.array(import_zod.z.string()).describe(
|
|
12665
|
-
"Roles of the set whose paint hides the part (an arm role is its three parts); a non-empty list with no role repeated, each a role of the set. A role with a clipped or meshless part (`iris_L`, `forearm_pose_L`) is refused."
|
|
12752
|
+
"Roles of the set whose paint hides the part (an arm role is its three parts); a non-empty list with no role repeated, each a role of the set. A role with a clipped or meshless part (`iris_L`, a brow drawn on the face, `forearm_pose_L`) is refused."
|
|
12666
12753
|
),
|
|
12667
12754
|
parameter: import_zod.z.string().describe(
|
|
12668
12755
|
"Any declared parameter but a physics output (a spring's or a chain segment's)."
|
|
@@ -12738,8 +12825,19 @@ function createIkiMcpServer() {
|
|
|
12738
12825
|
},
|
|
12739
12826
|
async (args) => {
|
|
12740
12827
|
try {
|
|
12828
|
+
let generator;
|
|
12829
|
+
try {
|
|
12830
|
+
generator = toolGenerator();
|
|
12831
|
+
} catch (e) {
|
|
12832
|
+
if (!(e instanceof import_format13.IkiFormatError)) throw e;
|
|
12833
|
+
return {
|
|
12834
|
+
content: [{ type: "text", text: `INVALID: ${e.message}` }],
|
|
12835
|
+
structuredContent: { ok: false, error: e.message }
|
|
12836
|
+
};
|
|
12837
|
+
}
|
|
12741
12838
|
const r = await autoRigFromLayers({
|
|
12742
12839
|
...args,
|
|
12840
|
+
generator,
|
|
12743
12841
|
// `.length(2)` makes each region span a pair, which its inferred
|
|
12744
12842
|
// `number[]` cannot say.
|
|
12745
12843
|
patches: args.patches,
|