@melite/image-tagger 0.1.4-alpha → 0.1.5-pre-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 +36 -0
- package/lib/card.d.ts +1 -9
- package/lib/card.js +25 -15
- package/package.json +8 -9
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Caption-and-tag card over four tagger families — wd14, joytag, florence2, and joycaption.
|
|
3
|
+
kind: package-library
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @melite/image-tagger
|
|
7
|
+
|
|
8
|
+
`@melite/image-tagger` is the image captioning card (`id: 'tagger'`): one image in, a caption or tag list out as a `tags.txt` run artifact. Four families board, each through its own declared `tag` action: `wd14`, `joytag`, `florence2`, and `joycaption`. The lane is weightless — models load, nothing else computes. The package's single source module is the root face the cardPackages SSOT composes (`@melite/image-tagger`); there is no tool or client face.
|
|
9
|
+
|
|
10
|
+
## Contract
|
|
11
|
+
|
|
12
|
+
- `.` — the card definition and registration (the root module carries `inject = ['comfyui']`). Schema: `input_image` (required); `threshold` — the general-tag confidence floor; `character_threshold` — the person-identity floor, deliberately higher; and four defaultless optionals backfilled per family: `exclude_tags` (wd14), `add_tag`/`remove_tag` (joytag), and `extra_option` (joycaption). Ride keys carry NO `.default` — the model picks the floor by default, the caller overrides explicitly. The per-family requirement map is declared here by augmenting `CardDefinition` (`requiresByFamily`), and the SaveText tail plus the caption vocabularies (`TAGGER_CAPTION_TASKS`, `TAGGER_CAPTION_TYPES`, `TAGGER_CAPTION_LENGTHS`, `TAGGER_EXTRA_OPTIONS`) come from `@melite/comfyui-card-kit`. There is NO weights knob — the Model/Variant/Quant rail is the only picker, and validation stamps `resolver_defaults` (absent keys only).
|
|
13
|
+
- `./package.json` — the manifest.
|
|
14
|
+
|
|
15
|
+
## Model Experience
|
|
16
|
+
|
|
17
|
+
### Request context and condition
|
|
18
|
+
|
|
19
|
+
A run conditions the tagger graph only when the card composes; no agent tool face ships.
|
|
20
|
+
|
|
21
|
+
#### What the model sees
|
|
22
|
+
|
|
23
|
+
The active tagger model receives `input_image` plus the gated thresholds and the family's tag knobs as graph inputs.
|
|
24
|
+
|
|
25
|
+
#### Token effect
|
|
26
|
+
|
|
27
|
+
zero-direct — the package contributes no prompt or schema to any language-model context.
|
|
28
|
+
|
|
29
|
+
#### KV Cache effect
|
|
30
|
+
|
|
31
|
+
independent — nothing here appends to or reshapes a session cache.
|
|
32
|
+
|
|
33
|
+
## Known Limitations and Deferred Work
|
|
34
|
+
|
|
35
|
+
- **No weights knob** — the variant rail owns checkpoints; the 2026-09-22 weights-law removal is total.
|
|
36
|
+
- **Per-family key subsets** — each optional tag key backfills on exactly one family; asking a key of the wrong family refuses rather than ignoring.
|
package/lib/card.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import type { Context } from '@
|
|
1
|
+
import type { Context } from '@melite/comfyui-card-kit/card-definition';
|
|
2
2
|
import type { ModelFacts } from '@melite/comfyui-card-kit/facts';
|
|
3
3
|
import type { GraphBuilder } from '@melite/comfyui-card-kit/graph';
|
|
4
4
|
export declare const ACTION_BINDINGS: Record<string, (p: Record<string, unknown>, model: ModelFacts, g: GraphBuilder, runId: string) => void>;
|
|
5
|
-
declare module '@melite/comfyui-cordis/service' {
|
|
6
|
-
interface CardDefinition {
|
|
7
|
-
/** Per-family extension packs — the requires_by_family declaration.
|
|
8
|
-
* The compose door gates the active family's slice, never the
|
|
9
|
-
* flat union alone. */
|
|
10
|
-
requiresByFamily?: Record<string, readonly string[]>;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
5
|
export declare const inject: string[];
|
|
14
6
|
export declare const identity: {
|
|
15
7
|
label: string;
|
package/lib/card.js
CHANGED
|
@@ -6,7 +6,8 @@ import { DECL as wd14Decl } from '@melite/models-wd14';
|
|
|
6
6
|
import { DECL as joytagDecl } from '@melite/models-joytag';
|
|
7
7
|
import { DECL as florence2Decl } from '@melite/models-florence2';
|
|
8
8
|
import { DECL as joycaptionDecl } from '@melite/models-joycaption';
|
|
9
|
-
import {
|
|
9
|
+
import { inputImageExtra } from '@melite/comfyui-card-kit/fields';
|
|
10
|
+
import { callableSchema, gatedResolve } from '@melite/comfyui-card-kit/admission';
|
|
10
11
|
// THE FAMILY BINDINGS (the atom vocabulary, stroke 3): each boarded
|
|
11
12
|
// family's declared action composes — the card delegates, never
|
|
12
13
|
// authors nodes. Keyed by OWNING FAMILY (`model.family ?? model.id`
|
|
@@ -26,6 +27,10 @@ export const ACTION_BINDINGS = {
|
|
|
26
27
|
instantiateAction(declaredAction(joycaptionDecl, 'tag'), p, model, g, runId);
|
|
27
28
|
},
|
|
28
29
|
};
|
|
30
|
+
// requiresByFamily: declared on the seam owner
|
|
31
|
+
|
|
32
|
+
// audit's A15 — boundary types live with their owner, not as local
|
|
33
|
+
// module augmentations at each consumer).
|
|
29
34
|
// the wire param surface (TaggerCard — the union vocab; each arm
|
|
30
35
|
// wires its subset). Ride keys carry NO .default (ABSENT: the
|
|
31
36
|
// compose-door cascade overlays model defaults, then explicit
|
|
@@ -48,22 +53,22 @@ export const ACTION_BINDINGS = {
|
|
|
48
53
|
// family keeps ONE Standard variant on the family default; custom
|
|
49
54
|
// paths ride explicit params (API/bare bodies).
|
|
50
55
|
const schema = z.object({
|
|
51
|
-
input_image: z.string().role('path').description("Input image").extra('extra', bag({
|
|
52
|
-
threshold: z.number().description("Threshold").min(0).max(1).step(0.05).
|
|
53
|
-
character_threshold: z.number().description("Character threshold").min(0).max(1).step(0.05).
|
|
56
|
+
input_image: z.string().role('path').description("Input image").extra('extra', bag(inputImageExtra({ tooltip: 'The image to invert. Absolute mount path or artifact ref.' }))),
|
|
57
|
+
threshold: z.number().description("Threshold").min(0).max(1).step(0.05).extra('extra', bag({ order: 1, group: "tagger", width: 1, tooltip: "General-tag confidence floor." })),
|
|
58
|
+
character_threshold: z.number().description("Character threshold").min(0).max(1).step(0.05).extra('extra', bag({ order: 2, group: "tagger", width: 1, tooltip: "Character-tag confidence floor — keep high." })),
|
|
54
59
|
exclude_tags: z.string().description("Exclude tags").extra('extra', bag({ order: 3, group: "tagger", width: 1, tooltip: "Comma-separated tags to prune from the output." })),
|
|
55
|
-
replace_underscore: z.boolean().description("Replace underscores").
|
|
56
|
-
trailing_comma: z.boolean().description("Trailing comma").
|
|
60
|
+
replace_underscore: z.boolean().description("Replace underscores").extra('extra', bag({ order: 4, group: "tagger", width: 1, tooltip: "Emit \"silver hair\" instead of \"silver_hair\"." })),
|
|
61
|
+
trailing_comma: z.boolean().description("Trailing comma").extra('extra', bag({ order: 5, group: "tagger", width: 1, tooltip: "Terminate the tag list with a comma (prompt-paste shape)." })),
|
|
57
62
|
add_tag: z.string().description("Add tag").extra('extra', bag({ order: 6, group: "tagger", width: 1, tooltip: "JoyTag: tags force-prepended to the output (comma-separated). Ignored by WD14." })),
|
|
58
63
|
remove_tag: z.string().description("Remove tag").extra('extra', bag({ order: 7, group: "tagger", width: 1, tooltip: "JoyTag: tags pruned from the output (comma-separated). Ignored by WD14." })),
|
|
59
|
-
caption_task: vocabulary([...TAGGER_CAPTION_TASKS]).description("Caption task").
|
|
60
|
-
caption_type: vocabulary([...TAGGER_CAPTION_TYPES]).description("Caption style").
|
|
64
|
+
caption_task: vocabulary([...TAGGER_CAPTION_TASKS]).description("Caption task").extra('extra', bag({ order: 8, group: "tagger", width: 1, tooltip: "Florence-2: the vision task (live task vocabulary). Ignored by WD14/JoyTag.", wtype: 'select' })),
|
|
65
|
+
caption_type: vocabulary([...TAGGER_CAPTION_TYPES]).description("Caption style").extra('extra', bag({ order: 9, group: "tagger", width: 1, tooltip: "JoyCaption: the caption template (live vocabulary). Ignored by WD14/JoyTag/Florence-2.", wtype: 'select' })),
|
|
61
66
|
// the FORM subset (the named six) of the kit's full set (which
|
|
62
67
|
// also carries the node's 20-260 word counts, for bare/API
|
|
63
68
|
// bodies) — a named subset, never a retyped copy that can
|
|
64
69
|
// drift from the node's own vocabulary (the card-plane
|
|
65
70
|
// audit's H2)
|
|
66
|
-
caption_length: vocabulary([...TAGGER_CAPTION_LENGTHS]).description("Caption length").
|
|
71
|
+
caption_length: vocabulary([...TAGGER_CAPTION_LENGTHS]).description("Caption length").extra('extra', bag({ order: 10, group: "tagger", width: 1, tooltip: "JoyCaption: target length (the named six; the node also takes word counts 20-260, which bare/API bodies may send). Ignored by other families.", wtype: 'select' })),
|
|
67
72
|
// the FULL kit list: the card had retyped a 14-option subset and
|
|
68
73
|
// one entry had ALREADY drifted into a truncated fork of the
|
|
69
74
|
// upstream canned string, which rode verbatim into the node
|
|
@@ -75,12 +80,7 @@ const schema = z.object({
|
|
|
75
80
|
// (schemastery non-strict object + the door's explicit-params
|
|
76
81
|
// overlay) and compose never reads it.
|
|
77
82
|
});
|
|
78
|
-
|
|
79
|
-
* registration's schema carrier and the compose strict resolve's
|
|
80
|
-
* judge): schemastery schemas are callable (Schema.resolve) but
|
|
81
|
-
* carry a typed data parameter, while both card-seam consumers
|
|
82
|
-
* take unknown. */
|
|
83
|
-
const schemaFn = schema;
|
|
83
|
+
const schemaFn = callableSchema(schema);
|
|
84
84
|
export const inject = ['comfyui'];
|
|
85
85
|
|
|
86
86
|
// identity ring; the card owns its label/description/genre/icon).
|
|
@@ -118,6 +118,16 @@ export function apply(ctx) {
|
|
|
118
118
|
outputs: { default: 'text' },
|
|
119
119
|
requiresModel: false,
|
|
120
120
|
},
|
|
121
|
+
|
|
122
|
+
// the default channel resolves to the arm's SaveText mint — every
|
|
123
|
+
// arm ends in the shared taggerSaveText tail (one SaveText per
|
|
124
|
+
// graph), so the '*' wildcard (resolveCardFlowOutputs takes the
|
|
125
|
+
// LAST node of the class — the h3-timeline SaveVideo precedent)
|
|
126
|
+
// names the producer on both the single and merge paths. Without
|
|
127
|
+
// it the merge path resolved {} and the assert passed vacuously.
|
|
128
|
+
flowOutputBindings: [
|
|
129
|
+
{ channel: 'default', node: '*', nodeClass: 'SaveText' },
|
|
130
|
+
],
|
|
121
131
|
// Per-family gates (requires_by_family declaration — each arm's
|
|
122
132
|
// pack is checked only for its own family; a wd14 run never
|
|
123
133
|
// demands the florence pack). The flat list carries the UNION
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.5-pre-alpha",
|
|
3
3
|
"license": "SSPL-1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "the tagger card (the image lane) — one card one package: card.ts host face
|
|
5
|
+
"description": "the tagger card (the image lane) — one card one package: card.ts host face (no tool face, no ui/, no agents/ — the view is constructed by @melite/card-base from the emission)",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"types": "./lib/card.d.ts",
|
|
@@ -12,13 +12,12 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@deepseek-ai/schemastery": "^3.18.4",
|
|
15
|
-
"@melite/comfyui-card-kit": "0.1.
|
|
16
|
-
"@melite/
|
|
17
|
-
"@melite/models-
|
|
18
|
-
"@melite/models-joycaption": "0.1.
|
|
19
|
-
"@melite/models-
|
|
20
|
-
"@melite/
|
|
21
|
-
"@melite/models-wd14": "0.1.4-alpha"
|
|
15
|
+
"@melite/comfyui-card-kit": "0.1.5-pre-alpha",
|
|
16
|
+
"@melite/contracts": "0.1.5-pre-alpha",
|
|
17
|
+
"@melite/models-florence2": "0.1.5-pre-alpha",
|
|
18
|
+
"@melite/models-joycaption": "0.1.5-pre-alpha",
|
|
19
|
+
"@melite/models-wd14": "0.1.5-pre-alpha",
|
|
20
|
+
"@melite/models-joytag": "0.1.5-pre-alpha"
|
|
22
21
|
},
|
|
23
22
|
"devDependencies": {
|
|
24
23
|
"@types/node": "^22.20.0",
|