@ikijs/mcp 0.38.1 → 0.38.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createIkiMcpServer
4
- } from "./chunk-SZHJO77J.mjs";
4
+ } from "./chunk-I4P7THTB.mjs";
5
5
 
6
6
  // src/cli.ts
7
7
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/dist/index.js CHANGED
@@ -9765,6 +9765,7 @@ var IRIS_IOU = 0.7;
9765
9765
  var DISC_CLOSE = 2;
9766
9766
  var IRIS_MARGIN = 0.25;
9767
9767
  var LID_SIDE = 4;
9768
+ var LID_STREAK = 6;
9768
9769
  var EYE_EDGE = 2;
9769
9770
  var OPENING_SPARE = 2;
9770
9771
  var STROKE_PAST_SHARE = 0.5;
@@ -10091,35 +10092,85 @@ function lashCutOf(pic, all) {
10091
10092
  function upperLid(pic, f, eye2, c) {
10092
10093
  const { width } = pic;
10093
10094
  const { b, cx, cy, rx } = f;
10095
+ const mid = Math.min(b.y1, Math.floor(cy));
10094
10096
  const lid = new Int32Array(width).fill(-1);
10095
- const lashTop = new Int32Array(width).fill(-1);
10097
+ const dark = (x, y) => {
10098
+ const i = y * width + x;
10099
+ return eye2[i] === 1 && c.dark(i);
10100
+ };
10101
+ const ink = (x, y) => dark(x, y) && !c.nearIris(y * width + x);
10102
+ const softTop = (x, top) => {
10103
+ let y = top;
10104
+ while (y - 1 >= b.y0 && top - (y - 1) <= EYE_EDGE && dark(x, y - 1)) y--;
10105
+ return y;
10106
+ };
10107
+ const runEnd = (x, y, step) => {
10108
+ const inside = (r) => r >= b.y0 && r <= mid;
10109
+ for (; ; ) {
10110
+ while (inside(y + step) && ink(x, y + step)) y += step;
10111
+ let rows = 0;
10112
+ while (rows <= LID_STREAK) {
10113
+ const r = y + step * (rows + 1);
10114
+ if (!inside(r) || !dark(x, r) || ink(x, r)) break;
10115
+ rows++;
10116
+ }
10117
+ const next = y + step * (rows + 1);
10118
+ if (rows === 0 || rows > LID_STREAK || !inside(next) || !ink(x, next)) {
10119
+ return y;
10120
+ }
10121
+ y = next;
10122
+ }
10123
+ };
10124
+ const fromTop = (x) => {
10125
+ let run2 = null;
10126
+ let skin = false;
10127
+ for (let y = b.y0; y <= mid; y++) {
10128
+ if (!ink(x, y)) {
10129
+ if (eye2[y * width + x] === 0) skin = true;
10130
+ continue;
10131
+ }
10132
+ if (run2 !== null && !skin) break;
10133
+ const top = y;
10134
+ y = runEnd(x, y, 1);
10135
+ run2 = [softTop(x, top), y];
10136
+ skin = false;
10137
+ }
10138
+ return run2;
10139
+ };
10140
+ const fromInside = (x) => {
10141
+ let y = mid;
10142
+ if (ink(x, y)) return null;
10143
+ while (y >= b.y0 && !ink(x, y)) y--;
10144
+ if (y < b.y0) return null;
10145
+ return [softTop(x, runEnd(x, y, -1)), y];
10146
+ };
10147
+ const x0 = Math.max(b.x0, Math.ceil(cx - rx));
10148
+ const x1 = Math.min(b.x1, Math.floor(cx + rx));
10096
10149
  for (let x = b.x0; x <= b.x1; x++) {
10097
- const at = (y2) => y2 * width + x;
10098
- const lashInk = (y2) => eye2[at(y2)] === 1 && c.dark(at(y2)) && !c.nearIris(at(y2));
10099
- let y = b.y0;
10100
- while (y <= b.y1 && !(eye2[at(y)] && c.dark(at(y)))) y++;
10101
- const first = y;
10102
- while (y <= b.y1 && y - first < EYE_EDGE && !lashInk(y)) y++;
10103
- if (y > b.y1 || y >= cy || !lashInk(y)) continue;
10104
- lashTop[x] = first;
10105
- while (y + 1 <= Math.min(b.y1, Math.floor(cy)) && lashInk(y + 1)) y++;
10106
- lid[x] = y;
10150
+ if (x >= x0 && x <= x1) continue;
10151
+ const run2 = fromInside(x) ?? fromTop(x);
10152
+ if (run2) lid[x] = run2[1];
10107
10153
  }
10108
10154
  const thickness = (from, step) => {
10109
10155
  const t = [];
10110
10156
  for (let x = from; t.length < LID_SIDE && x >= b.x0 && x <= b.x1; x += step) {
10111
- if (lashTop[x] >= 0) t.push(lid[x] - lashTop[x] + 1);
10157
+ const run2 = fromInside(x) ?? fromTop(x);
10158
+ if (run2) t.push(run2[1] - run2[0] + 1);
10112
10159
  }
10113
10160
  return t.length > 0 ? median(t) : null;
10114
10161
  };
10115
10162
  const left = thickness(Math.floor(cx - rx) - 1, -1);
10116
10163
  const right = thickness(Math.ceil(cx + rx) + 1, 1);
10117
- if (left === null && right === null) return lid;
10118
- for (let x = Math.ceil(cx - rx); x <= Math.floor(cx + rx); x++) {
10119
- if (x < b.x0 || x > b.x1 || lashTop[x] < 0) continue;
10164
+ for (let x = x0; x <= x1; x++) {
10165
+ const run2 = fromTop(x);
10166
+ if (!run2) continue;
10167
+ if (left === null && right === null) {
10168
+ lid[x] = run2[1];
10169
+ continue;
10170
+ }
10120
10171
  const u = (x - (cx - rx)) / (2 * rx);
10121
10172
  const t = left === null ? right : right === null ? left : left + (right - left) * u;
10122
- lid[x] = Math.min(lid[x], lashTop[x] + Math.round(t) - 1);
10173
+ lid[x] = Math.min(run2[1], run2[0] + Math.round(t) - 1);
10123
10174
  }
10124
10175
  return lid;
10125
10176
  }
@@ -10143,9 +10194,12 @@ function lowerLidAcross(pic, f, eye2, c, lashCut, upper) {
10143
10194
  const runs = [];
10144
10195
  for (let k = 0; k < LID_SIDE; k++) {
10145
10196
  const x = from + k * step;
10146
- if (x < b.x0 || x > b.x1) break;
10147
- const run2 = runAt(x);
10148
- if (run2) runs.push(run2);
10197
+ const run2 = x < b.x0 || x > b.x1 ? null : runAt(x);
10198
+ const prev = runs[runs.length - 1];
10199
+ if (!run2 || prev && (run2[0] > prev[1] + LID_DRIFT || run2[1] < prev[0] - LID_DRIFT)) {
10200
+ return [];
10201
+ }
10202
+ runs.push(run2);
10149
10203
  }
10150
10204
  return runs;
10151
10205
  };
@@ -12541,7 +12595,7 @@ function formatBakeChecks(bakes) {
12541
12595
  );
12542
12596
  }
12543
12597
  function createIkiMcpServer() {
12544
- const server = new import_mcp.McpServer({ name: "iki", version: "0.38.1" });
12598
+ const server = new import_mcp.McpServer({ name: "iki", version: "0.38.2" });
12545
12599
  server.registerTool(
12546
12600
  "validate_iki",
12547
12601
  {
@@ -12701,7 +12755,7 @@ function createIkiMcpServer() {
12701
12755
  ),
12702
12756
  occlusion: import_zod.z.object({
12703
12757
  by: import_zod.z.array(import_zod.z.string()).describe(
12704
- "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."
12758
+ "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."
12705
12759
  ),
12706
12760
  parameter: import_zod.z.string().describe(
12707
12761
  "Any declared parameter but a physics output (a spring's or a chain segment's)."