@melite/models-mask 0.1.4-alpha → 0.2.0-alpha

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 ADDED
@@ -0,0 +1,43 @@
1
+ ---
2
+ description: The mask studio's selection lane as a model family — SAM3/RT-DETR detection, the SAM2 arm, and paint exports, bound by the mask card.
3
+ kind: package-library
4
+ ---
5
+
6
+ # mask
7
+
8
+ mask registers the model family `mask-select` (label "Mask", genre `image`): the mask studio's selection lane declared as one action — SAM3 CLIP/RT-DETR detection, the SAM2 impact-pack arm, and paint exports — which the mask card binds through the DECL's declared-action interlock. The id is `mask-select`, deliberately not the package name: a family id must not shadow its card.
9
+
10
+ ## Weights
11
+
12
+ The three weights are the action's own constants (`MASK_WEIGHTS`, the LANE_FILES pattern): `sam3.1_multiplex_fp16.safetensors` (the SAM3 multiplex checkpoint), `rt_detr_v4-x-hgnet_fp32.safetensors` (the RT-DETR detector), and `sam2.1_hiera_large.pt` (the SAM2 arm). No variant swaps them and no row names them; the mask card's provisions declare the downloads, and a card spec pins the agreement between lane constants and provision rows.
13
+
14
+ ## The select action
15
+
16
+ The family carries one variant (`select`, route `mask-select`, no cells) and one action, `select`. The action declares no params of its own — the card's schema walk owns the knobs (detect hints, the drawn box manifest, paint exports, mask composition), and the build reads the walked shape beneath flat params. Output: one MASK handle. A composed lane also saves intermediates under the run directory: the primary mask, a union composite when a global paint export is stated, and detection-box overlays when box export is requested. `parseMaskLaneFacts` returns the three constants closed — an empty loader name is unrepresentable by construction.
17
+
18
+ ## Model Experience
19
+
20
+ ### Request context and condition
21
+
22
+ A run needs the image (an upload or an upstream `$spell` tensor) and the card's selection choices; the family contributes the weights and the node tree, the card the vocabulary.
23
+
24
+ #### What the model sees
25
+
26
+ One image, the drawn detect hint, and any paint-export paths; the three weights wire into the lane's loaders by constant.
27
+
28
+ #### Token effect
29
+
30
+ Zero-direct: the action composes an engine graph, not a token stream.
31
+
32
+ #### KV Cache effect
33
+
34
+ Independent: each run is self-contained.
35
+
36
+ ## Known Limitations and Deferred Work
37
+
38
+ - **Id divergence** — family id `mask-select` versus package name `mask`; deliberate, but a standing search trap across the estate.
39
+ - **No declared params** — tuning vocabulary lives on the card schema; this package cannot state it, and the action trusts the walked shape.
40
+ - **Weights pinned in code** — a weight-file rename must land in the lane constants and the card spec together, or boarding refuses.
41
+ - **Live behavior unobserved** — not verified against the running model.
42
+
43
+ Exports: the plugin root, `./package.json`.
package/lib/actions.js CHANGED
@@ -72,6 +72,15 @@ export const select = {
72
72
  const detectionDilation = p.detection_dilation ?? 10;
73
73
  const cropFactor = p.crop_factor ?? 3.0;
74
74
  const dropSize = p.drop_size ?? 10;
75
+ // THE DETECTOR THRESHOLD FOLD (audit 015 C5 — one fold for every
76
+ // detector seat): the effective detector threshold derives ONCE —
77
+ // per-entry tune → lane-flat param → the pack's 0.5 default. The
78
+ // SAM2 impact detectors AND the RT-DETR proposal seat read THIS
79
+ // derivation (the seats reference it, never re-stamp the fold):
80
+ // a second spelling let one graph carry two effective thresholds
81
+ // — SAM2 folded 0.5 while an unstated RT-DETR seat rode the raw
82
+ // cast to undefined (tests/threshold-fold-parity.spec.ts).
83
+ const detectorThreshold = (tune) => tune?.detection_threshold ?? p.detection_threshold ?? 0.5;
75
84
  const exportBoxes = p.export_boxes;
76
85
  const viaRtdetr = p.primary_via_rtdetr;
77
86
  // the lazy loader trio (see the header note — created on first use)
@@ -197,7 +206,7 @@ export const select = {
197
206
  const segs = g.node(detector.detectorNode, {
198
207
  [detector.detectorInput]: provider,
199
208
  image: img(),
200
- threshold: (tune?.detection_threshold ?? p.detection_threshold ?? 0.5),
209
+ threshold: detectorThreshold(tune),
201
210
  dilation: tune?.detection_dilation ?? detectionDilation,
202
211
  crop_factor: tune?.crop_factor ?? cropFactor,
203
212
  drop_size: tune?.drop_size ?? dropSize,
@@ -249,7 +258,7 @@ export const select = {
249
258
  rtdetrBoxes = g.node('RTDETR_detect', {
250
259
  model: rtdetrLoader(),
251
260
  image: img(),
252
- threshold: p.detection_threshold,
261
+ threshold: detectorThreshold(), // the SAME fold as the SAM2 detectors (audit 015 C5)
253
262
  class_name: 'person',
254
263
  max_detections: cap,
255
264
  }).out(0);
package/lib/index.d.ts CHANGED
@@ -1,6 +1,26 @@
1
1
  import type { Plugin } from "@deepseek-ai/cordis";
2
- import type { ModelDecl } from "@melite/comfyui-cordis/model-contract";
2
+ import type { ModelDecl } from '@melite/comfyui-card-kit/model-contract';
3
+ import type { ProvisionRow } from '@melite/comfyui-card-kit/model-contract';
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ export declare const PROVISIONS: ProvisionRow[];
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+ export declare const DETECTOR_PROVISIONS: ProvisionRow[];
3
22
  export declare const DECL: ModelDecl;
4
23
  export declare const family: Plugin;
5
24
  export { select, parseMaskLaneFacts, MASK_WEIGHTS, type MaskLaneFacts, type MaskLaneParams } from "./actions.js";
25
+ export { family as default };
6
26
  //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,4 +1,50 @@
1
- import { select } from "./actions.js";
1
+ import { IMPACT_DETECTOR_PROVISIONS } from "@melite/comfyui-card-kit";
2
+ import { select, MASK_WEIGHTS } from "./actions.js";
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ export const PROVISIONS = [
13
+ {
14
+
15
+ // existed since stroke ~40 but the weight was NEVER fetched —
16
+ // the engine silently dropped the whole mask arm). The official
17
+ // ComfyUI conversion.
18
+ name: "sam3.1_multiplex_fp16.safetensors",
19
+ url: "https://huggingface.co/Comfy-Org/sam3.1/resolve/main/checkpoints/sam3.1_multiplex_fp16.safetensors",
20
+ folder: "checkpoints",
21
+ sha256: "9ba99c92703c2e8b4f47de2d34a539bb8e18923049e238b780d70dbe6368eb03",
22
+ size_bytes: 1745546848,
23
+ },
24
+ {
25
+ name: "rt_detr_v4-x-hgnet_fp32.safetensors",
26
+ url: "https://huggingface.co/Comfy-Org/SDPose/resolve/main/diffusion_models/rt_detr_v4-x-hgnet_fp32.safetensors",
27
+ folder: "diffusion_models",
28
+ sha256: "1ba4a7794c2f8b176327c887ba38fbe0f977049cbef149960288aa923d0239f3",
29
+ size_bytes: 247790660,
30
+ },
31
+ {
32
+ name: "sam2.1_hiera_large.pt",
33
+ url: "https://huggingface.co/facebook/sam2.1-hiera-large/resolve/main/sam2.1_hiera_large.pt",
34
+ folder: "sams",
35
+ sha256: "2647878d5dfa5098f2f8649825738a9345572bae2d4350a2468587ece47dd318",
36
+ size_bytes: 898083611,
37
+ },
38
+ ...IMPACT_DETECTOR_PROVISIONS,
39
+ ];
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ export const DETECTOR_PROVISIONS = [...IMPACT_DETECTOR_PROVISIONS];
2
48
  // THE TOOL FAMILY (the F1 shape): a selection tool, not a generative
3
49
  // model — `unoffered: true` registers the atom (the actions admission
4
50
  // gate runs at boot; the card's declaredAction binding resolves
@@ -10,25 +56,49 @@ import { select } from "./actions.js";
10
56
  // shadows the card arm — discovery.spec's mask envelope wall catches
11
57
  // exactly that), and the bench plane keeps the self-naming strip for
12
58
  // era rows. The three weights are the family's constants (actions.ts
13
- // MASK_WEIGHTS — the LANE_FILES pattern), so the row carries no
14
- // lane_inputs. ONE variant, ONE address, no cells: the family's id
15
- // is its own route — an address with no download, because the
16
- // weights ride the card's provisions, not a variant cell.
59
+ // MASK_WEIGHTS rides the loaders), and the DECL seats them as
60
+ // lane_inputs (the run-gate probe + anchor - the seat row below
61
+ // provisions). ONE variant, ONE address, no cells: the family's id
62
+ // is its own route — and its six weights DOWNLOAD through the family
63
+ // provisions above, like every other model (no separate
64
+ // card-provision behavior).
17
65
  export const DECL = {
18
66
  "id": "mask-select",
19
67
  "label": "Mask",
20
68
  "description": "The mask studio's selection lane — SAM3 CLIP/RT-DETR detection, the SAM2 impact-pack arm, and paint exports, as one declared action the mask card binds.",
21
69
  "genre": "image",
22
70
  "unoffered": true,
71
+ "provisions": PROVISIONS,
72
+
73
+ // h3's crime shape closed for mask). The three weights stay the
74
+ // build's constants (MASK_WEIGHTS rides the loaders - a row value
75
+ // never reaches one, lane-laws pins that), but the DECL seats
76
+ // them as lane_inputs so the run gate PROBES presence at press
77
+ // and each miss's refusal anchors to its provisions URL (the
78
+ // anchor-at-the-door law). sam2 rides model_path + a declared
79
+ // sams home (the anny precedent - the stock folder map has no
80
+ // key for the sams pack, and EngineFacts' closed vocabulary
81
+ // forbids inventing one).
82
+ "lane_inputs": {
83
+ "checkpoint": MASK_WEIGHTS.checkpoint,
84
+ "unet": MASK_WEIGHTS.unet,
85
+ "model_path": MASK_WEIGHTS.sam2,
86
+ },
87
+ "lane_homes": { "model_path": "sams" },
23
88
  "variants": [
24
89
  {
25
90
  "id": "select",
26
91
  "label": "Select",
27
- "group": "Variant",
92
+ "group": "",
28
93
  "route": "mask-select",
29
94
  "cells": [],
30
95
  },
31
96
  ],
97
+
98
+ // axes — the anny shape. The undeclared 'Variant' literal the
99
+
100
+ // solo category the canon gives the one-row family.
101
+ "variant_groups": [],
32
102
  // THE FAMILY DOOR (the atom vocabulary, stroke 0): the select
33
103
  // action's facts parse runs over the family row and every variant
34
104
  // merge AT REGISTRATION — here it closes over the family's own
@@ -44,6 +114,13 @@ export const family = {
44
114
  };
45
115
  // The family's offered actions (the atom vocabulary): the select
46
116
  // segment the mask card binds. The card imports this beside the DECL
47
- // — the family's whole offer, one face.
117
+ // — the family's whole offer, one face. PROVISIONS rides too: the
118
+ // card serves the family's rows to its arm-weight gate (the
119
+ // provisions-identity pin, image/mask card.spec).
48
120
  export { select, parseMaskLaneFacts, MASK_WEIGHTS } from "./actions.js";
121
+ // The Loader-row face: DSH loads plugin rows by bare specifier and
122
+ // unwraps `exports.default ?? exports` (vendor/cordis_plugins/loader
123
+ // unwrapExports) — the default export IS the row-loadable plugin. The
124
+ // named `family` stays the library face (engine loadFamilies).
125
+ export { family as default };
49
126
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@melite/models-mask",
3
- "version": "0.1.4-alpha",
4
- "license": "SSPL-1.0",
3
+ "version": "0.2.0-alpha",
4
+ "license": "AGPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -11,13 +11,12 @@
11
11
  "./package.json": "./package.json"
12
12
  },
13
13
  "dependencies": {
14
- "@melite/comfyui-cordis": "0.1.4-alpha",
15
- "@melite/comfyui-card-kit": "0.1.4-alpha"
14
+ "@melite/comfyui-card-kit": "0.2.0-alpha"
16
15
  },
17
16
  "devDependencies": {
18
17
  "@types/node": "^22.20.0",
19
18
  "typescript": "^5.9.3",
20
- "@deepseek-ai/cordis": "^4.0.4"
19
+ "@deepseek-ai/cordis": "^4.0.5"
21
20
  },
22
21
  "files": [
23
22
  "lib/index.js",
@@ -25,7 +24,7 @@
25
24
  "lib/**/*.d.ts"
26
25
  ],
27
26
  "peerDependencies": {
28
- "@deepseek-ai/cordis": "^4.0.4"
27
+ "@deepseek-ai/cordis": "^4.0.5"
29
28
  },
30
29
  "scripts": {
31
30
  "build": "tsc -p tsconfig.build.json",