@melite/image-tagger 0.2.2-alpha → 0.3.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/lib/card.d.ts +1 -3
- package/lib/card.js +28 -31
- package/lib/family-seats.d.ts +16 -0
- package/lib/family-seats.js +42 -0
- package/package.json +12 -10
- package/src/card.ts +202 -0
package/lib/card.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Context } from '@melite/comfyui-card-kit/card-definition';
|
|
2
|
-
|
|
3
|
-
import type { GraphBuilder } from '@melite/comfyui-card-kit/graph';
|
|
4
|
-
export declare const ACTION_BINDINGS: Record<string, (p: Record<string, unknown>, model: ModelFacts, g: GraphBuilder, runId: string) => void>;
|
|
2
|
+
export declare const BOARDED: readonly ["wd14", "joytag", "florence2", "joycaption"];
|
|
5
3
|
export declare const inject: string[];
|
|
6
4
|
export declare const identity: {
|
|
7
5
|
label: string;
|
package/lib/card.js
CHANGED
|
@@ -2,30 +2,27 @@ import z from '@deepseek-ai/schemastery';
|
|
|
2
2
|
import { declaredAction, finalizeTagger, TAGGER_CAPTION_TASKS, TAGGER_CAPTION_TYPES, TAGGER_CAPTION_LENGTHS, TAGGER_EXTRA_OPTIONS, instantiateAction } from '@melite/comfyui-card-kit';
|
|
3
3
|
import { vocabulary } from '@melite/comfyui-card-kit/vocab';
|
|
4
4
|
import { bag } from '@melite/contracts/extraKeys';
|
|
5
|
-
import { DECL as wd14Decl } from '@melite/models-wd14';
|
|
6
|
-
import { DECL as joytagDecl } from '@melite/models-joytag';
|
|
7
|
-
import { DECL as florence2Decl } from '@melite/models-florence2';
|
|
8
|
-
import { DECL as joycaptionDecl } from '@melite/models-joycaption';
|
|
9
5
|
import { inputImageExtra } from '@melite/comfyui-card-kit/fields';
|
|
10
6
|
import { callableSchema, gatedResolve } from '@melite/comfyui-card-kit/admission';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
7
|
+
import { primeFamilySeats, seatOf } from "./family-seats.js";
|
|
8
|
+
|
|
9
|
+
// four boarded families live as id literals; their DECLs arrive
|
|
10
|
+
// through the guarded seat loader (src/family-seats.ts — the card's
|
|
11
|
+
// only family bridge, zero static imports). A family package absent
|
|
12
|
+
// from the install costs its own seat: the card still registers and
|
|
13
|
+
// the compose door below refuses loud, by name.
|
|
14
|
+
export const BOARDED = ['wd14', 'joytag', 'florence2', 'joycaption'];
|
|
15
|
+
// THE COMPOSE DOOR (the family dispatch): each boarded family's
|
|
16
|
+
// declared action composes — the card delegates, never authors
|
|
17
|
+
// nodes. Keyed by OWNING FAMILY (`model.family ?? model.id` at
|
|
18
|
+
// dispatch — a route id keys nothing, the derived-row law); an
|
|
19
|
+
// unseated family refuses loud at the door.
|
|
20
|
+
const composeFamilyAction = (p, model, g, runId) => {
|
|
21
|
+
const seat = seatOf(String(model.family ?? model.id));
|
|
22
|
+
if (seat === undefined) {
|
|
23
|
+
throw new Error(`no declared action for family '${String(model.family ?? model.id)}' on the tagger card — every boarded family (${BOARDED.join(', ')}) composes its own declared segment; this address owns none (a family package absent from the install refuses here, by name)`);
|
|
24
|
+
}
|
|
25
|
+
instantiateAction(declaredAction(seat.decl, 'tag'), p, model, g, runId);
|
|
29
26
|
};
|
|
30
27
|
// requiresByFamily: declared on the seam owner
|
|
31
28
|
|
|
@@ -109,14 +106,19 @@ export const identity = {
|
|
|
109
106
|
],
|
|
110
107
|
};
|
|
111
108
|
export function apply(ctx) {
|
|
109
|
+
|
|
110
|
+
// family seats before the card boards — fire-and-forget (the
|
|
111
|
+
// guards absorb an absent family; the registration never waits).
|
|
112
|
+
void primeFamilySeats();
|
|
112
113
|
ctx.effect(() => ctx.comfyui.registerCard({
|
|
113
114
|
id: 'tagger',
|
|
114
115
|
// stage-row id the compose emits (purge S-decls verdict: the
|
|
115
116
|
// retired row carried "" — engine truth wins).
|
|
116
117
|
skeleton: 'tagger',
|
|
117
|
-
// the four boarded families (
|
|
118
|
-
// one spelling; RULE 5).
|
|
119
|
-
|
|
118
|
+
// the four boarded families (the BOARDED literal above — the
|
|
119
|
+
// one spelling; RULE 5). The DECLs ride the seat loader, so a
|
|
120
|
+
// pruned family package removes only its own boarding here.
|
|
121
|
+
boarded: [...BOARDED],
|
|
120
122
|
tags: ['image', 'tag', 'analyze'],
|
|
121
123
|
identity,
|
|
122
124
|
|
|
@@ -167,12 +169,7 @@ export function apply(ctx) {
|
|
|
167
169
|
if (!img.trim()) {
|
|
168
170
|
throw new Error("required param 'input_image' missing or blank on the tagger card (the tagger inverts an image; nothing to tag is a refusal)");
|
|
169
171
|
}
|
|
170
|
-
|
|
171
|
-
if (bound)
|
|
172
|
-
bound(doc, model, g, runId);
|
|
173
|
-
else {
|
|
174
|
-
throw new Error(`no declared action for family '${String(model.family ?? model.id)}' on the tagger card — every boarded family (wd14, joytag, florence2, joycaption) composes its own declared segment; this address owns none`);
|
|
175
|
-
}
|
|
172
|
+
composeFamilyAction(doc, model, g, runId);
|
|
176
173
|
},
|
|
177
174
|
finalize: finalizeTagger,
|
|
178
175
|
}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ModelDecl } from '@melite/comfyui-card-kit/model-contract';
|
|
2
|
+
/** One family's runtime seat: its DECL (the four tagger families
|
|
3
|
+
* ship no craft face today; the seat is the pattern any future
|
|
4
|
+
* one rides). */
|
|
5
|
+
export type FamilySeat = {
|
|
6
|
+
decl: ModelDecl;
|
|
7
|
+
};
|
|
8
|
+
/** Prime every family seat (idempotent; absent packages degrade to
|
|
9
|
+
* their own absence — the card never dies for a family). Fired
|
|
10
|
+
* fire-and-forget at registration; the post-boot compose dispatch
|
|
11
|
+
* reads the filled table synchronously. */
|
|
12
|
+
export declare const primeFamilySeats: () => Promise<void>;
|
|
13
|
+
/** A family's seat — undefined when the package is absent (the
|
|
14
|
+
* compose door's own loud refusal names the family there). */
|
|
15
|
+
export declare const seatOf: (id: string) => FamilySeat | undefined;
|
|
16
|
+
//# sourceMappingURL=family-seats.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
/** The boarded family modules, by package — ids live in card.ts's
|
|
10
|
+
* BOARDED literal (the family-coverage wall judges the binding on
|
|
11
|
+
* the dev tree; a typo'd id reds it there). */
|
|
12
|
+
const FAMILY_MODULES = [
|
|
13
|
+
'@melite/models-wd14',
|
|
14
|
+
'@melite/models-joytag',
|
|
15
|
+
'@melite/models-florence2',
|
|
16
|
+
'@melite/models-joycaption',
|
|
17
|
+
];
|
|
18
|
+
const seats = new Map();
|
|
19
|
+
let priming = null;
|
|
20
|
+
/** Prime every family seat (idempotent; absent packages degrade to
|
|
21
|
+
* their own absence — the card never dies for a family). Fired
|
|
22
|
+
* fire-and-forget at registration; the post-boot compose dispatch
|
|
23
|
+
* reads the filled table synchronously. */
|
|
24
|
+
export const primeFamilySeats = () => {
|
|
25
|
+
priming ??= Promise.allSettled(FAMILY_MODULES.map((spec) => import(__rewriteRelativeImportExtension(spec))))
|
|
26
|
+
.then((results) => {
|
|
27
|
+
for (const result of results) {
|
|
28
|
+
if (result.status !== 'fulfilled')
|
|
29
|
+
continue;
|
|
30
|
+
const mod = result.value;
|
|
31
|
+
const decl = mod?.DECL;
|
|
32
|
+
if (decl?.id === undefined || typeof decl.id !== 'string')
|
|
33
|
+
continue;
|
|
34
|
+
seats.set(decl.id, { decl });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return priming;
|
|
38
|
+
};
|
|
39
|
+
/** A family's seat — undefined when the package is absent (the
|
|
40
|
+
* compose door's own loud refusal names the family there). */
|
|
41
|
+
export const seatOf = (id) => seats.get(id);
|
|
42
|
+
//# sourceMappingURL=family-seats.js.map
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.3.0-alpha",
|
|
3
3
|
"license": "AGPL-3.0-or-later",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Caption-and-tag card over four tagger families — wd14, joytag, florence2, and joycaption.",
|
|
@@ -15,22 +15,24 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@deepseek-ai/schemastery": "^3.
|
|
19
|
-
"@melite/comfyui-card-kit": "0.
|
|
20
|
-
"@melite/contracts": "0.
|
|
21
|
-
"@melite/models-florence2": "0.
|
|
22
|
-
"@melite/models-joycaption": "0.
|
|
23
|
-
"@melite/models-joytag": "0.
|
|
24
|
-
"@melite/models-wd14": "0.
|
|
18
|
+
"@deepseek-ai/schemastery": "^3.19.0",
|
|
19
|
+
"@melite/comfyui-card-kit": "0.3.0-alpha",
|
|
20
|
+
"@melite/contracts": "0.3.0-alpha",
|
|
21
|
+
"@melite/models-florence2": "0.3.0-alpha",
|
|
22
|
+
"@melite/models-joycaption": "0.3.0-alpha",
|
|
23
|
+
"@melite/models-joytag": "0.3.0-alpha",
|
|
24
|
+
"@melite/models-wd14": "0.3.0-alpha"
|
|
25
25
|
},
|
|
26
26
|
"name": "@melite/image-tagger",
|
|
27
27
|
"files": [
|
|
28
28
|
"lib/card.js",
|
|
29
29
|
"lib/**/*.js",
|
|
30
|
-
"lib/**/*.d.ts"
|
|
30
|
+
"lib/**/*.d.ts",
|
|
31
|
+
"src/card.ts",
|
|
32
|
+
"src/agents"
|
|
31
33
|
],
|
|
32
34
|
"peerDependencies": {
|
|
33
|
-
"@deepseek-ai/cordis": "^4.0
|
|
35
|
+
"@deepseek-ai/cordis": "^4.1.0"
|
|
34
36
|
},
|
|
35
37
|
"repository": {
|
|
36
38
|
"type": "git",
|
package/src/card.ts
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type {} from '@melite/comfyui-card-kit/card-definition'
|
|
2
|
+
import type {} from '@melite/comfyui-card-kit/service-faces'
|
|
3
|
+
// Tier 3 — the tagger card (the wd14_t1 / joytag_t1 / florence2_t1 /
|
|
4
|
+
// joycaption_t1 renderer ports; the image prompt-inversion card).
|
|
5
|
+
// Decl + admission + family dispatch — the four arms live in their
|
|
6
|
+
// OWN families' declared actions (packages/models/{wd14,joytag,
|
|
7
|
+
// florence2,joycaption}/src/actions.ts, each pinned to a committed
|
|
8
|
+
// golden); the kit keeps only the shared SaveText tail and the
|
|
9
|
+
// caption vocabularies this card serves. The lane is weightless,
|
|
10
|
+
// every wire value comes from params.
|
|
11
|
+
import type { Context } from '@melite/comfyui-card-kit/card-definition'
|
|
12
|
+
import z from '@deepseek-ai/schemastery'
|
|
13
|
+
import { declaredAction, finalizeTagger, TAGGER_CAPTION_TASKS, TAGGER_CAPTION_TYPES, TAGGER_CAPTION_LENGTHS, TAGGER_EXTRA_OPTIONS, instantiateAction } from '@melite/comfyui-card-kit'
|
|
14
|
+
import { vocabulary } from '@melite/comfyui-card-kit/vocab'
|
|
15
|
+
import { bag } from '@melite/contracts/extraKeys'
|
|
16
|
+
import type { ModelFacts } from '@melite/comfyui-card-kit/facts'
|
|
17
|
+
import type { GraphBuilder } from '@melite/comfyui-card-kit/graph'
|
|
18
|
+
import { inputImageExtra } from '@melite/comfyui-card-kit/fields'
|
|
19
|
+
import { callableSchema, gatedResolve } from '@melite/comfyui-card-kit/admission'
|
|
20
|
+
import { primeFamilySeats, seatOf } from './family-seats.ts'
|
|
21
|
+
|
|
22
|
+
// THE FAMILY SEATS (the plugin law — the L3 cure, 2026-11-16): the
|
|
23
|
+
// four boarded families live as id literals; their DECLs arrive
|
|
24
|
+
// through the guarded seat loader (src/family-seats.ts — the card's
|
|
25
|
+
// only family bridge, zero static imports). A family package absent
|
|
26
|
+
// from the install costs its own seat: the card still registers and
|
|
27
|
+
// the compose door below refuses loud, by name.
|
|
28
|
+
export const BOARDED = ['wd14', 'joytag', 'florence2', 'joycaption'] as const
|
|
29
|
+
|
|
30
|
+
// THE COMPOSE DOOR (the family dispatch): each boarded family's
|
|
31
|
+
// declared action composes — the card delegates, never authors
|
|
32
|
+
// nodes. Keyed by OWNING FAMILY (`model.family ?? model.id` at
|
|
33
|
+
// dispatch — a route id keys nothing, the derived-row law); an
|
|
34
|
+
// unseated family refuses loud at the door.
|
|
35
|
+
const composeFamilyAction = (
|
|
36
|
+
p: Record<string, unknown>,
|
|
37
|
+
model: ModelFacts,
|
|
38
|
+
g: GraphBuilder,
|
|
39
|
+
runId: string,
|
|
40
|
+
): void => {
|
|
41
|
+
const seat = seatOf(String(model.family ?? model.id))
|
|
42
|
+
if (seat === undefined) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`no declared action for family '${String(model.family ?? model.id)}' on the tagger card — every boarded family (${BOARDED.join(', ')}) composes its own declared segment; this address owns none (a family package absent from the install refuses here, by name)`)
|
|
45
|
+
}
|
|
46
|
+
instantiateAction(declaredAction(seat.decl, 'tag'), p, model, g, runId)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// requiresByFamily: declared on the seam owner
|
|
50
|
+
// (card-definition.ts:64, moved there 2026-11-05 per the card-UI
|
|
51
|
+
// audit's A15 — boundary types live with their owner, not as local
|
|
52
|
+
// module augmentations at each consumer).
|
|
53
|
+
|
|
54
|
+
// the wire param surface (TaggerCard — the union vocab; each arm
|
|
55
|
+
// wires its subset). Ride keys carry NO .default (ABSENT: the
|
|
56
|
+
// compose-door cascade overlays model defaults, then explicit
|
|
57
|
+
// params): input_image is required (refused blank in compose);
|
|
58
|
+
// exclude_tags/add_tag/remove_tag/extra_option are defaultless
|
|
59
|
+
// optionals, each backfilled by the families whose arms read it
|
|
60
|
+
// (wd14→exclude_tags, joytag→add_tag/remove_tag,
|
|
61
|
+
// joycaption→extra_option). Bare z.string() is the image-gen prompt
|
|
62
|
+
// precedent (optional at parse, refused loud at compose).
|
|
63
|
+
// THE WEIGHTS LAW (2026-09-22 — the variant rail owns the
|
|
64
|
+
// checkpoint; the schema declares NO weights knob): Model/Variant/
|
|
65
|
+
// Quant is the ONE picker — the validate layer stamps the selected
|
|
66
|
+
// variant's resolver_defaults into the body (stampCardOverlay,
|
|
67
|
+
// absent-keys-only), the compose door overlays the family default,
|
|
68
|
+
// the lane reads p.checkpoint. The key rides `admits` below (the
|
|
69
|
+
// input-prep crop/media_type/scale precedent: admitted route stamps,
|
|
70
|
+
// never rendered). A card-level checkpoint knob — select or text —
|
|
71
|
+
// is a second picker around the card system and is forbidden here.
|
|
72
|
+
// JoyCaption's upstream takes any repo id or local path, so its
|
|
73
|
+
// family keeps ONE Standard variant on the family default; custom
|
|
74
|
+
// paths ride explicit params (API/bare bodies).
|
|
75
|
+
const schema = z.object({
|
|
76
|
+
input_image: z.string().role('path').description("Input image").extra('extra', bag(inputImageExtra({ tooltip: 'The image to invert. Absolute mount path or artifact ref.' }))),
|
|
77
|
+
// FAMILY-SCOPED NUMBERS (the 2026-11-12 refused-face burn: a
|
|
78
|
+
// number knob with no floor on the families that never read it
|
|
79
|
+
// rendered "undefined — REFUSED: not a number"). Every knob
|
|
80
|
+
// scopes to the families whose declared action consumes it
|
|
81
|
+
// (wd14: threshold/character_threshold/exclude_tags/
|
|
82
|
+
// replace_underscore/trailing_comma; joytag: threshold/add_tag/
|
|
83
|
+
// remove_tag; florence2: caption_task; joycaption: caption_type/
|
|
84
|
+
// caption_length/extra_option) — an unscoped number is a
|
|
85
|
+
// refused face waiting to happen, a scoped one never renders
|
|
86
|
+
// for the family that has no floor for it.
|
|
87
|
+
threshold: z.number().description("Threshold").min(0).max(1).step(0.05).extra('extra', bag({ order: 1, group: "tagger", width: 1, families: ["wd14", "joytag"], tooltip: "General-tag confidence floor (WD14 + JoyTag)." })),
|
|
88
|
+
character_threshold: z.number().description("Character threshold").min(0).max(1).step(0.05).extra('extra', bag({ order: 2, group: "tagger", width: 1, families: ["wd14"], tooltip: "Character-tag confidence floor — keep high (WD14 only)." })),
|
|
89
|
+
exclude_tags: z.string().description("Exclude tags").extra('extra', bag({ order: 3, group: "tagger", width: 1, families: ["wd14"], tooltip: "Comma-separated tags to prune from the output (WD14 only)." })),
|
|
90
|
+
replace_underscore: z.boolean().description("Replace underscores").extra('extra', bag({ order: 4, group: "tagger", width: 1, families: ["wd14"], tooltip: "Emit \"silver hair\" instead of \"silver_hair\" (WD14 only)." })),
|
|
91
|
+
trailing_comma: z.boolean().description("Trailing comma").extra('extra', bag({ order: 5, group: "tagger", width: 1, families: ["wd14"], tooltip: "Terminate the tag list with a comma (prompt-paste shape; WD14 only)." })),
|
|
92
|
+
add_tag: z.string().description("Add tag").extra('extra', bag({ order: 6, group: "tagger", width: 1, families: ["joytag"], tooltip: "JoyTag: tags force-prepended to the output (comma-separated)." })),
|
|
93
|
+
remove_tag: z.string().description("Remove tag").extra('extra', bag({ order: 7, group: "tagger", width: 1, families: ["joytag"], tooltip: "JoyTag: tags pruned from the output (comma-separated)." })),
|
|
94
|
+
caption_task: vocabulary([...TAGGER_CAPTION_TASKS]).default("more_detailed_caption").description("Caption task").extra('extra', bag({ order: 8, group: "tagger", width: 1, families: ["florence2"], tooltip: "Florence-2: the vision task (live task vocabulary).", wtype: 'select' })),
|
|
95
|
+
caption_type: vocabulary([...TAGGER_CAPTION_TYPES]).default("Descriptive").description("Caption style").extra('extra', bag({ order: 9, group: "tagger", width: 1, families: ["joycaption"], tooltip: "JoyCaption: the caption template (live vocabulary).", wtype: 'select' })),
|
|
96
|
+
// the FORM subset (the named six) of the kit's full set (which
|
|
97
|
+
// also carries the node's 20-260 word counts, for bare/API
|
|
98
|
+
// bodies) — a named subset, never a retyped copy that can
|
|
99
|
+
// drift from the node's own vocabulary (the card-plane
|
|
100
|
+
// audit's H2)
|
|
101
|
+
caption_length: vocabulary([...TAGGER_CAPTION_LENGTHS]).default("long").description("Caption length").extra('extra', bag({ order: 10, group: "tagger", width: 1, families: ["joycaption"], tooltip: "JoyCaption: target length (the named six; the node also takes word counts 20-260, which bare/API bodies may send).", wtype: 'select' })),
|
|
102
|
+
// the FULL kit list: the card had retyped a 14-option subset and
|
|
103
|
+
// one entry had ALREADY drifted into a truncated fork of the
|
|
104
|
+
// upstream canned string, which rode verbatim into the node
|
|
105
|
+
// (the card-plane audit's H2 — the one entry proved it)
|
|
106
|
+
extra_option: vocabulary([...TAGGER_EXTRA_OPTIONS]).default("").description("Extra instruction").extra('extra', bag({ order: 11, group: "tagger", width: 1, families: ["joycaption"], tooltip: "JoyCaption: one appended instruction (the full 27-option list rides bare/API bodies; the engine's own vulgar-caption row is dropped at this surface — release hygiene).", wtype: 'select' })),
|
|
107
|
+
// NO filename_prefix (card: "the run routes outputs by run id
|
|
108
|
+
// (compose stamps `<run>/tags`) — a user knob here was silently
|
|
109
|
+
// overwritten, a dead promise"). Old drafts naming it still parse
|
|
110
|
+
// (schemastery non-strict object + the door's explicit-params
|
|
111
|
+
// overlay) and compose never reads it.
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const schemaFn = callableSchema(schema)
|
|
115
|
+
|
|
116
|
+
export const inject = ['comfyui']
|
|
117
|
+
|
|
118
|
+
// THE IDENTITY RUNG (native 2026-09-10 — migrated from the frozen
|
|
119
|
+
// identity ring; the card owns its label/description/genre/icon).
|
|
120
|
+
export const identity = {
|
|
121
|
+
label: 'Tagger',
|
|
122
|
+
description: 'Image prompt inversion — booru keyword tags (WD14, JoyTag) and natural-language captions (Florence-2, JoyCaption) for recreating images in NovelAI / Pony / FLUX / Ideogram. Tags persist as a tags.txt run artifact.',
|
|
123
|
+
genre: 'image',
|
|
124
|
+
icon: 'tag',
|
|
125
|
+
principles: [
|
|
126
|
+
'input_image is required — the tag is anchored on it (absolute mount path or a prior-run artifact ref)',
|
|
127
|
+
'threshold is the general-tag confidence floor; character_threshold is the person-identity floor (higher — names are cheap to overclaim)',
|
|
128
|
+
'exclude_tags prunes what you already know is wrong — comma-separated, matched case-insensitively by the node',
|
|
129
|
+
'The lane outputs tags.txt (SaveText) — the queue trades in artifacts, not bare strings',
|
|
130
|
+
'First run downloads the WD14 weights (.onnx + .csv) — light ONNX lane, ~4 GB VRAM',
|
|
131
|
+
"JoyTag reads a pack-local checkpoint (no auto-download) and takes add/remove tag lists instead of WD14's character floor",
|
|
132
|
+
],
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function apply(ctx: Context): void {
|
|
136
|
+
// THE PLUGIN LAW'S FIRE (the L3 cure, 2026-11-16): prime the
|
|
137
|
+
// family seats before the card boards — fire-and-forget (the
|
|
138
|
+
// guards absorb an absent family; the registration never waits).
|
|
139
|
+
void primeFamilySeats()
|
|
140
|
+
ctx.effect(() => ctx.comfyui.registerCard({
|
|
141
|
+
id: 'tagger',
|
|
142
|
+
// stage-row id the compose emits (purge S-decls verdict: the
|
|
143
|
+
// retired row carried "" — engine truth wins).
|
|
144
|
+
skeleton: 'tagger',
|
|
145
|
+
// the four boarded families (the BOARDED literal above — the
|
|
146
|
+
// one spelling; RULE 5). The DECLs ride the seat loader, so a
|
|
147
|
+
// pruned family package removes only its own boarding here.
|
|
148
|
+
boarded: [...BOARDED],
|
|
149
|
+
tags: ['image', 'tag', 'analyze'],
|
|
150
|
+
identity,
|
|
151
|
+
// THE DISCOVERY ROWS (migrated 2026-09-10 from the frozen
|
|
152
|
+
// discovery export — the card owns its sidebar, surface, and
|
|
153
|
+
// flow-stage declarations; the discovery arms derive from here).
|
|
154
|
+
sidebar: { key: 'image', order: 19 },
|
|
155
|
+
flowKinds: {
|
|
156
|
+
inputs: { input_image: 'image' },
|
|
157
|
+
outputs: { default: 'text' },
|
|
158
|
+
requiresModel: false,
|
|
159
|
+
},
|
|
160
|
+
// THE SAVETEXT BINDING (the tagger publish-plane gap, 2026-10-24):
|
|
161
|
+
// the default channel resolves to the arm's SaveText mint — every
|
|
162
|
+
// arm ends in the shared taggerSaveText tail (one SaveText per
|
|
163
|
+
// graph), so the '*' wildcard (resolveCardFlowOutputs takes the
|
|
164
|
+
// LAST node of the class — the h3-timeline SaveVideo precedent)
|
|
165
|
+
// names the producer on both the single and merge paths. Without
|
|
166
|
+
// it the merge path resolved {} and the assert passed vacuously.
|
|
167
|
+
flowOutputBindings: [
|
|
168
|
+
{ channel: 'default', node: '*', nodeClass: 'SaveText' },
|
|
169
|
+
],
|
|
170
|
+
// Per-family gates (requires_by_family declaration — each arm's
|
|
171
|
+
// pack is checked only for its own family; a wd14 run never
|
|
172
|
+
// demands the florence pack). The flat list carries the UNION
|
|
173
|
+
// for flat consumers; the door gates the ACTIVE family's slice
|
|
174
|
+
// (gateway _find_card_requires precedent).
|
|
175
|
+
requires: ['ComfyUI-WD14-Tagger', 'Comfyui_joytag', 'ComfyUI-Florence2', 'joycaption_comfyui'],
|
|
176
|
+
requiresByFamily: {
|
|
177
|
+
wd14: ['ComfyUI-WD14-Tagger'],
|
|
178
|
+
joytag: ['Comfyui_joytag'],
|
|
179
|
+
florence2: ['ComfyUI-Florence2'],
|
|
180
|
+
joycaption: ['joycaption_comfyui'],
|
|
181
|
+
},
|
|
182
|
+
schema: schemaFn,
|
|
183
|
+
// checkpoint rides admits (the service's admission-extras law):
|
|
184
|
+
// the variant rail's route stamp, admitted but never rendered —
|
|
185
|
+
// no form field, no second picker.
|
|
186
|
+
admits: ['checkpoint'],
|
|
187
|
+
compose(p, model, g, runId) {
|
|
188
|
+
// THE SCHEMA GATE (the audio-trio admission precedent — the
|
|
189
|
+
// card's own declaration validates the last hop into the
|
|
190
|
+
// engine): schemastery walk enforces declared types + bounds
|
|
191
|
+
// (threshold/character_threshold are 0–1 — a threshold=5 draft
|
|
192
|
+
// refuses LOUD here, never composes), fills declared defaults.
|
|
193
|
+
// The composer's reads below are reads of the GATED doc.
|
|
194
|
+
const doc = gatedResolve('tagger', schemaFn, ['checkpoint', 'model'], p)
|
|
195
|
+
const img = typeof doc.input_image === 'string' ? doc.input_image : ''
|
|
196
|
+
if (!img.trim()) {
|
|
197
|
+
throw new Error("required param 'input_image' missing or blank on the tagger card (the tagger inverts an image; nothing to tag is a refusal)")
|
|
198
|
+
}
|
|
199
|
+
composeFamilyAction(doc, model, g, runId) },
|
|
200
|
+
finalize: finalizeTagger,
|
|
201
|
+
}))
|
|
202
|
+
}
|