@melite/audio-music 0.2.3-rc.4 → 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 +15 -6
- package/lib/card.js +56 -21
- package/lib/family-seats.d.ts +22 -0
- package/lib/family-seats.js +46 -0
- package/lib/tool.d.ts +6 -1
- package/lib/tool.js +27 -13
- package/package.json +9 -9
- package/src/card.ts +64 -21
package/lib/card.d.ts
CHANGED
|
@@ -25,12 +25,21 @@ export declare const schema: z<Schemastery.ObjectS<NoInfer<{
|
|
|
25
25
|
tiled_decode: z<boolean, boolean, "plain">;
|
|
26
26
|
}>>, "plain">;
|
|
27
27
|
export declare const BOARDED: string[];
|
|
28
|
-
/** THE
|
|
29
|
-
* family's declared compose action
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
28
|
+
/** THE SEAT-DRIVEN DISPATCH (the atom vocabulary, stroke 3): the
|
|
29
|
+
* owning family's declared compose action, resolved through the
|
|
30
|
+
* family's SEAT (family-seats.ts) at call time — the card owns
|
|
31
|
+
* only dispatch; the segment factories live in the family
|
|
32
|
+
* packages (the legacy lanes stay the declared fallback +
|
|
33
|
+
* byte-oracle). A family package absent from the install refuses
|
|
34
|
+
* loud HERE, by name; the card itself still loads and registers. */
|
|
35
|
+
export declare function composeFamilyAction(family: string, p: Record<string, unknown>, model: ModelFacts, g: GraphBuilder, runId: string): void;
|
|
36
|
+
/** THE ACTION BINDINGS: the dispatch table compose reads at call
|
|
37
|
+
* time, keyed by OWNING FAMILY (`model.family ?? model.id` — a
|
|
38
|
+
* route id keys nothing, the derived-row law). Each row closes
|
|
39
|
+
* over its literal family id and resolves the DECL through the
|
|
40
|
+
* seat, so a pruned family package costs its row's reach, never
|
|
41
|
+
* the table (the value-roundtrip corruption seats swap rows
|
|
42
|
+
* here). */
|
|
34
43
|
export declare const ACTION_BINDINGS: Record<string, (p: Record<string, unknown>, model: ModelFacts, g: GraphBuilder, runId: string) => void>;
|
|
35
44
|
/** The identity rung (label/description — the authored prose the
|
|
36
45
|
* emitted tool row carries; the ring's spelling, stated once). */
|
package/lib/card.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import z from '@deepseek-ai/schemastery';
|
|
2
2
|
import { declaredAction, instantiateAction } from '@melite/comfyui-card-kit';
|
|
3
|
-
import { DECL as music3Decl } from '@melite/models-music3';
|
|
4
|
-
import { MUSIC3_FULL_STEPS } from '@melite/models-music3';
|
|
5
|
-
import { DECL as yue2Decl } from '@melite/models-yue2';
|
|
6
3
|
import { vocabulary } from '@melite/comfyui-card-kit/vocab';
|
|
7
4
|
import { bag } from '@melite/contracts/extraKeys';
|
|
8
5
|
import { seedExtra } from '@melite/comfyui-card-kit/fields';
|
|
9
6
|
import { callableSchema, gatedResolve } from '@melite/comfyui-card-kit/admission';
|
|
7
|
+
import { primeFamilySeats, seatOf } from "./family-seats.js";
|
|
10
8
|
export const schema = z.object({
|
|
11
9
|
prompt: z.string().description("Tags / Description").extra('extra', bag({ order: 0, group: "prompt", columns: 1, tooltip: "Structured caption, three sections: Global Metadata (genre, mood, BPM) + Vocal Details (gender, timbre, range) + Arrangement (instruments, structure). Weak one-word captions end the song early — the tail turns to noise. E.g. 'A funk-pop soul track at 105 BPM; male baritone, warm rasp; clean guitar riff, brass stabs, tight pocket drums'.", required: true, wtype: 'textarea', })),
|
|
12
10
|
lyrics: z.string().description("Lyrics").extra('extra', bag({ order: 1, group: "prompt", tooltip: "The song's PLAN — length lives here, not in Duration. Sung words with structure tags ([verse], [chorus]) for a song. Instrumental: sequential section tags only, each on its own line — [intro] / [instrumental] / [solo] / [instrumental] / [outro] — the model grants ~20-40s per block; repeat blocks to reach target length. An EMPTY box (or a lone [instrumental]) plans one ~35s phrase and ends. Keep 'no vocals, no choir, no humming' in the caption so extended blocks stay instrumental.", wtype: 'textarea' })),
|
|
13
11
|
duration: z.number().description("Duration (s)").min(5).max(360).step(1).default(30).extra('extra', bag({ order: 0, group: "generation", width: 1, tooltip: "Audio length CEILING in seconds (5-360) — never a floor: the model ends the song when its plan ends, not when this number arrives. The plan lives in the LYRICS field — sung words for a song, sequential section tags ([intro] / [instrumental] / [solo] blocks, one per line, ~20-40s each) for an instrumental. An empty or single-tag lyrics box plans ONE phrase and wraps ~35s no matter how high this sits. Long track (>2min) + CUDA OOM: state tiled_decode.", wtype: 'slider' })),
|
|
14
12
|
mode: vocabulary(["full", "melody", "off"]).description("ABC Planning").default("full").extra('extra', bag({ order: 1, group: "generation", width: 1, tooltip: "YuE2 only: plan a symbolic score before generating. full = melody + chords; melody = melody only (cover-recommended); off = direct generation.", wtype: 'select', visible_when: 'model=yue2' })),
|
|
15
13
|
guidance_scale: z.number().description("CFG").min(0.1).max(10).step(0.1).default(1.7).extra('extra', bag({ order: 2, group: "generation", width: 1, tooltip: "Classifier-free guidance (KSampler cfg). 1.7 = the default.", visible_when: 'model=music3' })),
|
|
16
|
-
|
|
14
|
+
// THE SERVED DEFAULT (the full-schedule checkpoint tier's own
|
|
15
|
+
// default — the step↔checkpoint pairing; the tooltip carries the
|
|
16
|
+
|
|
17
|
+
// constant lives in the family package (music3's tier.ts,
|
|
18
|
+
// MUSIC3_FULL_STEPS.default) and this card loads WITHOUT it, so
|
|
19
|
+
// the number is a literal here — one home of the DERIVATION stays
|
|
20
|
+
// tier.ts (the DECL's resolver_defaults spread from it, and the
|
|
21
|
+
// step-tier wall judges the marriage on the dev tree); the
|
|
22
|
+
// compose action refuses a stated steps outside the resolved
|
|
23
|
+
// checkpoint's tier window at run time, never a silent drift.
|
|
24
|
+
n_diffusion_steps: z.number().description("Diffusion Steps").min(1).max(200).step(1).default(30).extra('extra', bag({ order: 3, group: "generation", width: 1, tooltip: "Denoising steps. 30 = the default (the full-schedule checkpoint tier's own default — the step↔checkpoint pairing). A distilled checkpoint states its own tier's window. Never 0.", wtype: 'number' })),
|
|
17
25
|
lm_cfg_scale: z.number().description("LM CFG").min(0.1).max(10).step(0.1).default(1.7).extra('extra', bag({ order: 4, group: "generation", width: 1, tooltip: "Lyric-encoder guidance (MiniMaxMusic3TextEncode cfg_scale). 1.7 = the default.", visible_when: 'model=music3' })),
|
|
18
26
|
seed: z.number().description("Seed").step(1).default(-1).extra('extra', bag(seedExtra({ order: 0, group: 'seed', width: 1 }))),
|
|
19
27
|
// THE DECODE TIER KNOB (audit 014 C3): NO .default() — absence is
|
|
@@ -23,22 +31,43 @@ export const schema = z.object({
|
|
|
23
31
|
tiled_decode: z.boolean().description("Tiled VAE Decode").extra('extra', bag({ order: 5, group: "generation", width: 1, tooltip: "Decode the audio latent in segments (lower VRAM, no quality loss at the template's 1536/64 seats). Absent = derived from the checkpoint's own numbers — a low-VRAM checkpoint or a track past 90s tiles; a roomy checkpoint at a short track decodes plain.", visible_when: 'model=music3' })),
|
|
24
32
|
});
|
|
25
33
|
const schemaFn = callableSchema(schema);
|
|
26
|
-
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
|
|
35
|
+
// "The Card can exist without a Family"): the family packages
|
|
36
|
+
// resolve through ./family-seats.ts (guarded dynamic seats, primed
|
|
37
|
+
// at registration) — a missing family package costs its OWN seat,
|
|
38
|
+
// never this card's load. A retyped id breaks the binding on the
|
|
39
|
+
// dev tree (the family-coverage wall judges every boarded entry
|
|
40
|
+
// against the live registry; the seat table skips a module whose
|
|
41
|
+
// DECL id names nothing), never silently at the not-boarded
|
|
42
|
+
// refusal.
|
|
43
|
+
export const BOARDED = ['music3', 'yue2'];
|
|
44
|
+
/** THE SEAT-DRIVEN DISPATCH (the atom vocabulary, stroke 3): the
|
|
45
|
+
* owning family's declared compose action, resolved through the
|
|
46
|
+
* family's SEAT (family-seats.ts) at call time — the card owns
|
|
47
|
+
* only dispatch; the segment factories live in the family
|
|
48
|
+
* packages (the legacy lanes stay the declared fallback +
|
|
49
|
+
* byte-oracle). A family package absent from the install refuses
|
|
50
|
+
* loud HERE, by name; the card itself still loads and registers. */
|
|
51
|
+
export function composeFamilyAction(family, p, model, g, runId) {
|
|
52
|
+
const seat = seatOf(family);
|
|
53
|
+
if (seat === undefined) {
|
|
54
|
+
throw new Error(`no declared action for family '${family}' on the music card — every boarded family (music3, yue2) composes its own declared segment; this address owns none (a family package absent from the install refuses here, by name)`);
|
|
55
|
+
}
|
|
56
|
+
instantiateAction(declaredAction(seat.decl, 'compose'), p, model, g, runId);
|
|
57
|
+
}
|
|
58
|
+
/** THE ACTION BINDINGS: the dispatch table compose reads at call
|
|
59
|
+
* time, keyed by OWNING FAMILY (`model.family ?? model.id` — a
|
|
60
|
+
* route id keys nothing, the derived-row law). Each row closes
|
|
61
|
+
* over its literal family id and resolves the DECL through the
|
|
62
|
+
* seat, so a pruned family package costs its row's reach, never
|
|
63
|
+
* the table (the value-roundtrip corruption seats swap rows
|
|
64
|
+
* here). */
|
|
36
65
|
export const ACTION_BINDINGS = {
|
|
37
|
-
[
|
|
38
|
-
|
|
66
|
+
['music3']: (p, model, g, runId) => {
|
|
67
|
+
composeFamilyAction('music3', p, model, g, runId);
|
|
39
68
|
},
|
|
40
|
-
[
|
|
41
|
-
|
|
69
|
+
['yue2']: (p, model, g, runId) => {
|
|
70
|
+
composeFamilyAction('yue2', p, model, g, runId);
|
|
42
71
|
},
|
|
43
72
|
};
|
|
44
73
|
/** The identity rung (label/description — the authored prose the
|
|
@@ -50,13 +79,19 @@ export const identity = {
|
|
|
50
79
|
icon: 'music',
|
|
51
80
|
};
|
|
52
81
|
export function registerCard(ctx, comfy) {
|
|
82
|
+
// THE PLUGIN LAW'S PRIMING (fire-and-forget, image-gen shape): the
|
|
83
|
+
// guarded dynamic imports of the boarded family packages start
|
|
84
|
+
// here; registration NEVER waits on a family package — a pruned
|
|
85
|
+
// family costs its own seat, never the estate boot.
|
|
86
|
+
void primeFamilySeats();
|
|
53
87
|
ctx.effect(() => comfy.registerCard({
|
|
54
88
|
id: 'music',
|
|
55
89
|
// stage-row id the compose emits (retired skeleton= verbatim; TS owns the truth post-flip).
|
|
56
90
|
skeleton: 'music',
|
|
57
|
-
|
|
58
|
-
//
|
|
59
|
-
//
|
|
91
|
+
// THE BOARDING LITERALS (the plugin law): ids stated once, judged
|
|
92
|
+
// on the dev tree by the family-coverage wall (a board naming
|
|
93
|
+
// nothing reds there), never derived at load from a package this
|
|
94
|
+
// card must load without.
|
|
60
95
|
boarded: [...BOARDED],
|
|
61
96
|
tags: ['audio', 'music', 'generate'],
|
|
62
97
|
identity,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ModelDecl } from '@melite/comfyui-card-kit/model-contract';
|
|
2
|
+
/** One family's runtime seat: its DECL. The seat is the pattern any
|
|
3
|
+
* future craft face the families export rides (image-gen's seat
|
|
4
|
+
* carries anima's promptTags restorer the same way). */
|
|
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 seats read the
|
|
11
|
+
* 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
|
+
/** The boarded knob's live ids — the PRESENT families in the
|
|
17
|
+
* FAMILY_MODULES order (a missing family costs its enum row, never
|
|
18
|
+
* the knob; an all-absent install serves an empty list and the
|
|
19
|
+
* tool face falls back to the BOARDED literal, where the run
|
|
20
|
+
* refuses loud at the model seat). */
|
|
21
|
+
export declare const boardedModels: () => string[];
|
|
22
|
+
//# sourceMappingURL=family-seats.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
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-music3',
|
|
14
|
+
'@melite/models-yue2',
|
|
15
|
+
];
|
|
16
|
+
const seats = new Map();
|
|
17
|
+
let priming = null;
|
|
18
|
+
/** Prime every family seat (idempotent; absent packages degrade to
|
|
19
|
+
* their own absence — the card never dies for a family). Fired
|
|
20
|
+
* fire-and-forget at registration; the post-boot seats read the
|
|
21
|
+
* filled table synchronously. */
|
|
22
|
+
export const primeFamilySeats = () => {
|
|
23
|
+
priming ??= Promise.allSettled(FAMILY_MODULES.map((spec) => import(__rewriteRelativeImportExtension(spec))))
|
|
24
|
+
.then((results) => {
|
|
25
|
+
for (const result of results) {
|
|
26
|
+
if (result.status !== 'fulfilled')
|
|
27
|
+
continue;
|
|
28
|
+
const mod = result.value;
|
|
29
|
+
const decl = mod?.DECL;
|
|
30
|
+
if (decl?.id === undefined || typeof decl.id !== 'string')
|
|
31
|
+
continue;
|
|
32
|
+
seats.set(decl.id, { decl });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return priming;
|
|
36
|
+
};
|
|
37
|
+
/** A family's seat — undefined when the package is absent (the
|
|
38
|
+
* compose door's own loud refusal names the family there). */
|
|
39
|
+
export const seatOf = (id) => seats.get(id);
|
|
40
|
+
/** The boarded knob's live ids — the PRESENT families in the
|
|
41
|
+
* FAMILY_MODULES order (a missing family costs its enum row, never
|
|
42
|
+
* the knob; an all-absent install serves an empty list and the
|
|
43
|
+
* tool face falls back to the BOARDED literal, where the run
|
|
44
|
+
* refuses loud at the model seat). */
|
|
45
|
+
export const boardedModels = () => [...seats.values()].map((seat) => seat.decl.id);
|
|
46
|
+
//# sourceMappingURL=family-seats.js.map
|
package/lib/tool.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
2
2
|
import type { EstateCall } from '@melite/estate-call';
|
|
3
3
|
export declare const TOOL_NAME = "music";
|
|
4
|
-
|
|
4
|
+
/** Async since the L3 cure: the knob derives from the PRESENT
|
|
5
|
+
* family seats (primeFamilySeats awaits the guarded dynamic
|
|
6
|
+
* imports; a missing family package costs its own enum row, never
|
|
7
|
+
* the tool face). The harness seat that builds this tool is
|
|
8
|
+
* already async (melite-tools' lane seat awaits the builder). */
|
|
9
|
+
export declare const buildMusicTool: (call: EstateCall) => Promise<ToolDefinition>;
|
|
5
10
|
//# sourceMappingURL=tool.d.ts.map
|
package/lib/tool.js
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import { defineCardTool } from '@melite/estate-call/cardTool';
|
|
2
2
|
import { emitParamsSpec } from '@melite/comfyui-card-kit/params-emit';
|
|
3
3
|
import { schema, identity, BOARDED } from "./card.js";
|
|
4
|
+
import { boardedModels, primeFamilySeats } from "./family-seats.js";
|
|
4
5
|
export const TOOL_NAME = 'music';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
/** Async since the L3 cure: the knob derives from the PRESENT
|
|
7
|
+
* family seats (primeFamilySeats awaits the guarded dynamic
|
|
8
|
+
* imports; a missing family package costs its own enum row, never
|
|
9
|
+
* the tool face). The harness seat that builds this tool is
|
|
10
|
+
* already async (melite-tools' lane seat awaits the builder). */
|
|
11
|
+
export const buildMusicTool = async (call) => {
|
|
12
|
+
await primeFamilySeats();
|
|
13
|
+
// The knob: the PRESENT families' ids, falling back to the
|
|
14
|
+
// BOARDED literal when no family package is installed (the enum
|
|
15
|
+
// serves the ids; the run refuses loud at the model seat — the
|
|
16
|
+
// image-gen fallback law).
|
|
17
|
+
const knob = boardedModels().length > 0 ? boardedModels() : [...BOARDED];
|
|
18
|
+
return defineCardTool(call, {
|
|
19
|
+
name: TOOL_NAME,
|
|
20
|
+
flow: 'music',
|
|
21
|
+
label: identity.label,
|
|
22
|
+
description: identity.description,
|
|
23
|
+
// THE MODEL INPUT: the params walk synthesizes the model knob
|
|
24
|
+
// from the boarded list (a CLOSED enum — the wrapper rejects
|
|
25
|
+
// ''/unknown models at the seam); execute resolves the unstated
|
|
26
|
+
// default itself (the DSL plane carries no defaults).
|
|
27
|
+
parameters: emitParamsSpec(schema, knob),
|
|
28
|
+
defaultModel: knob[0],
|
|
29
|
+
previewField: 'prompt',
|
|
30
|
+
});
|
|
31
|
+
};
|
|
18
32
|
//# sourceMappingURL=tool.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
|
"exports": {
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
22
|
-
"@deepseek-ai/schemastery": "^3.
|
|
23
|
-
"@melite/comfyui-card-kit": "0.
|
|
24
|
-
"@melite/
|
|
25
|
-
"@melite/
|
|
26
|
-
"@melite/models-music3": "0.
|
|
27
|
-
"@melite/
|
|
21
|
+
"@deepseek-ai/dsh-tools": "0.2.2-rc.5",
|
|
22
|
+
"@deepseek-ai/schemastery": "^3.19.0",
|
|
23
|
+
"@melite/comfyui-card-kit": "0.3.0-alpha",
|
|
24
|
+
"@melite/estate-call": "0.3.0-alpha",
|
|
25
|
+
"@melite/models-yue2": "0.3.0-alpha",
|
|
26
|
+
"@melite/models-music3": "0.3.0-alpha",
|
|
27
|
+
"@melite/contracts": "0.3.0-alpha"
|
|
28
28
|
},
|
|
29
29
|
"name": "@melite/audio-music",
|
|
30
30
|
"description": "Text-to-music card and agent tool over the MiniMax Music 3 and YuE2-3B stock ComfyUI nodes.",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"src/agents"
|
|
37
37
|
],
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@deepseek-ai/cordis": "^4.0
|
|
39
|
+
"@deepseek-ai/cordis": "^4.1.0"
|
|
40
40
|
},
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
package/src/card.ts
CHANGED
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
import type { Context } from '@melite/comfyui-card-kit/card-definition'
|
|
7
7
|
import z from '@deepseek-ai/schemastery'
|
|
8
8
|
import { declaredAction, instantiateAction } from '@melite/comfyui-card-kit'
|
|
9
|
-
import { DECL as music3Decl } from '@melite/models-music3'
|
|
10
|
-
import { MUSIC3_FULL_STEPS } from '@melite/models-music3'
|
|
11
|
-
import { DECL as yue2Decl } from '@melite/models-yue2'
|
|
12
9
|
import type { ModelFacts } from '@melite/comfyui-card-kit/facts'
|
|
13
10
|
import type { GraphBuilder } from '@melite/comfyui-card-kit/graph'
|
|
14
11
|
import { vocabulary } from '@melite/comfyui-card-kit/vocab'
|
|
@@ -16,6 +13,7 @@ import { ComfyUIServiceFace } from '@melite/comfyui-card-kit/service-faces'
|
|
|
16
13
|
import { bag } from '@melite/contracts/extraKeys'
|
|
17
14
|
import { seedExtra } from '@melite/comfyui-card-kit/fields'
|
|
18
15
|
import { callableSchema, gatedResolve } from '@melite/comfyui-card-kit/admission'
|
|
16
|
+
import { primeFamilySeats, seatOf } from './family-seats.ts'
|
|
19
17
|
|
|
20
18
|
export const schema = z.object({
|
|
21
19
|
prompt: z.string().description("Tags / Description").extra('extra', bag({ order: 0, group: "prompt", columns: 1, tooltip: "Structured caption, three sections: Global Metadata (genre, mood, BPM) + Vocal Details (gender, timbre, range) + Arrangement (instruments, structure). Weak one-word captions end the song early — the tail turns to noise. E.g. 'A funk-pop soul track at 105 BPM; male baritone, warm rasp; clean guitar riff, brass stabs, tight pocket drums'.", required: true, wtype: 'textarea', })),
|
|
@@ -23,7 +21,17 @@ export const schema = z.object({
|
|
|
23
21
|
duration: z.number().description("Duration (s)").min(5).max(360).step(1).default(30).extra('extra', bag({ order: 0, group: "generation", width: 1, tooltip: "Audio length CEILING in seconds (5-360) — never a floor: the model ends the song when its plan ends, not when this number arrives. The plan lives in the LYRICS field — sung words for a song, sequential section tags ([intro] / [instrumental] / [solo] blocks, one per line, ~20-40s each) for an instrumental. An empty or single-tag lyrics box plans ONE phrase and wraps ~35s no matter how high this sits. Long track (>2min) + CUDA OOM: state tiled_decode.", wtype: 'slider' })),
|
|
24
22
|
mode: vocabulary(["full", "melody", "off"]).description("ABC Planning").default("full").extra('extra', bag({ order: 1, group: "generation", width: 1, tooltip: "YuE2 only: plan a symbolic score before generating. full = melody + chords; melody = melody only (cover-recommended); off = direct generation.", wtype: 'select', visible_when: 'model=yue2' })),
|
|
25
23
|
guidance_scale: z.number().description("CFG").min(0.1).max(10).step(0.1).default(1.7).extra('extra', bag({ order: 2, group: "generation", width: 1, tooltip: "Classifier-free guidance (KSampler cfg). 1.7 = the default.", visible_when: 'model=music3' })),
|
|
26
|
-
|
|
24
|
+
// THE SERVED DEFAULT (the full-schedule checkpoint tier's own
|
|
25
|
+
// default — the step↔checkpoint pairing; the tooltip carries the
|
|
26
|
+
// number). THE PLUGIN LAW (L3 cure, 2026-11-16): the tier
|
|
27
|
+
// constant lives in the family package (music3's tier.ts,
|
|
28
|
+
// MUSIC3_FULL_STEPS.default) and this card loads WITHOUT it, so
|
|
29
|
+
// the number is a literal here — one home of the DERIVATION stays
|
|
30
|
+
// tier.ts (the DECL's resolver_defaults spread from it, and the
|
|
31
|
+
// step-tier wall judges the marriage on the dev tree); the
|
|
32
|
+
// compose action refuses a stated steps outside the resolved
|
|
33
|
+
// checkpoint's tier window at run time, never a silent drift.
|
|
34
|
+
n_diffusion_steps: z.number().description("Diffusion Steps").min(1).max(200).step(1).default(30).extra('extra', bag({ order: 3, group: "generation", width: 1, tooltip: "Denoising steps. 30 = the default (the full-schedule checkpoint tier's own default — the step↔checkpoint pairing). A distilled checkpoint states its own tier's window. Never 0.", wtype: 'number' })),
|
|
27
35
|
lm_cfg_scale: z.number().description("LM CFG").min(0.1).max(10).step(0.1).default(1.7).extra('extra', bag({ order: 4, group: "generation", width: 1, tooltip: "Lyric-encoder guidance (MiniMaxMusic3TextEncode cfg_scale). 1.7 = the default.", visible_when: 'model=music3' })),
|
|
28
36
|
seed: z.number().description("Seed").step(1).default(-1).extra('extra', bag(seedExtra({ order: 0, group: 'seed', width: 1 }))),
|
|
29
37
|
// THE DECODE TIER KNOB (audit 014 C3): NO .default() — absence is
|
|
@@ -35,23 +43,52 @@ export const schema = z.object({
|
|
|
35
43
|
|
|
36
44
|
const schemaFn = callableSchema(schema)
|
|
37
45
|
|
|
38
|
-
// THE FAMILY IDS
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
|
|
46
|
+
// THE FAMILY IDS ARE LITERALS (the plugin law, L3 cure, 2026-11-16:
|
|
47
|
+
// "The Card can exist without a Family"): the family packages
|
|
48
|
+
// resolve through ./family-seats.ts (guarded dynamic seats, primed
|
|
49
|
+
// at registration) — a missing family package costs its OWN seat,
|
|
50
|
+
// never this card's load. A retyped id breaks the binding on the
|
|
51
|
+
// dev tree (the family-coverage wall judges every boarded entry
|
|
52
|
+
// against the live registry; the seat table skips a module whose
|
|
53
|
+
// DECL id names nothing), never silently at the not-boarded
|
|
54
|
+
// refusal.
|
|
55
|
+
export const BOARDED: string[] = ['music3', 'yue2']
|
|
42
56
|
|
|
43
|
-
/** THE
|
|
44
|
-
* family's declared compose action
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
57
|
+
/** THE SEAT-DRIVEN DISPATCH (the atom vocabulary, stroke 3): the
|
|
58
|
+
* owning family's declared compose action, resolved through the
|
|
59
|
+
* family's SEAT (family-seats.ts) at call time — the card owns
|
|
60
|
+
* only dispatch; the segment factories live in the family
|
|
61
|
+
* packages (the legacy lanes stay the declared fallback +
|
|
62
|
+
* byte-oracle). A family package absent from the install refuses
|
|
63
|
+
* loud HERE, by name; the card itself still loads and registers. */
|
|
64
|
+
export function composeFamilyAction(
|
|
65
|
+
family: string,
|
|
66
|
+
p: Record<string, unknown>,
|
|
67
|
+
model: ModelFacts,
|
|
68
|
+
g: GraphBuilder,
|
|
69
|
+
runId: string,
|
|
70
|
+
): void {
|
|
71
|
+
const seat = seatOf(family)
|
|
72
|
+
if (seat === undefined) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
`no declared action for family '${family}' on the music card — every boarded family (music3, yue2) composes its own declared segment; this address owns none (a family package absent from the install refuses here, by name)`)
|
|
75
|
+
}
|
|
76
|
+
instantiateAction(declaredAction(seat.decl, 'compose'), p, model, g, runId)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** THE ACTION BINDINGS: the dispatch table compose reads at call
|
|
80
|
+
* time, keyed by OWNING FAMILY (`model.family ?? model.id` — a
|
|
81
|
+
* route id keys nothing, the derived-row law). Each row closes
|
|
82
|
+
* over its literal family id and resolves the DECL through the
|
|
83
|
+
* seat, so a pruned family package costs its row's reach, never
|
|
84
|
+
* the table (the value-roundtrip corruption seats swap rows
|
|
85
|
+
* here). */
|
|
49
86
|
export const ACTION_BINDINGS: Record<string, (p: Record<string, unknown>, model: ModelFacts, g: GraphBuilder, runId: string) => void> = {
|
|
50
|
-
[
|
|
51
|
-
|
|
87
|
+
['music3']: (p, model, g, runId) => {
|
|
88
|
+
composeFamilyAction('music3', p, model, g, runId)
|
|
52
89
|
},
|
|
53
|
-
[
|
|
54
|
-
|
|
90
|
+
['yue2']: (p, model, g, runId) => {
|
|
91
|
+
composeFamilyAction('yue2', p, model, g, runId)
|
|
55
92
|
},
|
|
56
93
|
}
|
|
57
94
|
|
|
@@ -65,13 +102,19 @@ export const identity = {
|
|
|
65
102
|
}
|
|
66
103
|
|
|
67
104
|
export function registerCard(ctx: Context, comfy: ComfyUIServiceFace): void {
|
|
105
|
+
// THE PLUGIN LAW'S PRIMING (fire-and-forget, image-gen shape): the
|
|
106
|
+
// guarded dynamic imports of the boarded family packages start
|
|
107
|
+
// here; registration NEVER waits on a family package — a pruned
|
|
108
|
+
// family costs its own seat, never the estate boot.
|
|
109
|
+
void primeFamilySeats()
|
|
68
110
|
ctx.effect(() => comfy.registerCard({
|
|
69
111
|
id: 'music',
|
|
70
112
|
// stage-row id the compose emits (retired skeleton= verbatim; TS owns the truth post-flip).
|
|
71
113
|
skeleton: 'music',
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
114
|
+
// THE BOARDING LITERALS (the plugin law): ids stated once, judged
|
|
115
|
+
// on the dev tree by the family-coverage wall (a board naming
|
|
116
|
+
// nothing reds there), never derived at load from a package this
|
|
117
|
+
// card must load without.
|
|
75
118
|
boarded: [...BOARDED],
|
|
76
119
|
tags: ['audio', 'music', 'generate'],
|
|
77
120
|
identity,
|