@melite/audio-music 0.2.2-alpha → 0.2.3-rc.4
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.js +10 -0
- package/package.json +9 -7
- package/src/agents/AGENT.md +64 -0
- package/src/agents/skills/gamekit-music/SKILL.md +42 -0
- package/src/card.ts +128 -0
package/lib/card.js
CHANGED
|
@@ -71,6 +71,16 @@ export function registerCard(ctx, comfy) {
|
|
|
71
71
|
},
|
|
72
72
|
// stock-only card: the MiniMax + YuE2 nodes ride upstream core
|
|
73
73
|
// (comfy_extras.nodes_minimax_music / nodes_yue2); no requires.
|
|
74
|
+
|
|
75
|
+
// doc through gatedResolve('music', schemaFn, ['model'], p) —
|
|
76
|
+
// the model row id is admitted BEYOND the schema knobs (the
|
|
77
|
+
// card's own lane branch reads it; flowKinds.requiresModel:
|
|
78
|
+
// false only lifts the flow-stage demand). Declared here so
|
|
79
|
+
// the registry's admission surface (cardsFacts: def.admits)
|
|
80
|
+
// matches what the compose door actually serves — the
|
|
81
|
+
// dropped-knob sweep (runs-graph-receipt ARM j) reds on the
|
|
82
|
+
|
|
83
|
+
admits: ['model'],
|
|
74
84
|
schema: schemaFn,
|
|
75
85
|
compose(p, model, g, runId) {
|
|
76
86
|
// THE SCHEMA GATE (the h3 admission precedent — the card's
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
2
|
+
"version": "0.2.3-rc.4",
|
|
3
3
|
"license": "AGPL-3.0-or-later",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
@@ -20,18 +20,20 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@deepseek-ai/dsh-tools": "0.2.1-rc.2",
|
|
22
22
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
23
|
-
"@melite/
|
|
24
|
-
"@melite/
|
|
25
|
-
"@melite/
|
|
26
|
-
"@melite/
|
|
27
|
-
"@melite/models-yue2": "0.2.
|
|
23
|
+
"@melite/comfyui-card-kit": "0.2.3-rc.4",
|
|
24
|
+
"@melite/contracts": "0.2.3-rc.4",
|
|
25
|
+
"@melite/estate-call": "0.2.3-rc.4",
|
|
26
|
+
"@melite/models-music3": "0.2.3-rc.4",
|
|
27
|
+
"@melite/models-yue2": "0.2.3-rc.4"
|
|
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.",
|
|
31
31
|
"files": [
|
|
32
32
|
"lib/index.js",
|
|
33
33
|
"lib/**/*.js",
|
|
34
|
-
"lib/**/*.d.ts"
|
|
34
|
+
"lib/**/*.d.ts",
|
|
35
|
+
"src/card.ts",
|
|
36
|
+
"src/agents"
|
|
35
37
|
],
|
|
36
38
|
"peerDependencies": {
|
|
37
39
|
"@deepseek-ai/cordis": "^4.0.5"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Music Card Agent
|
|
3
|
+
description: Drives the music card — MiniMax Music 3 (structured caption in params.prompt) and YuE2 (style + lyrics) through the queue
|
|
4
|
+
genre: audio
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Music Card Agent
|
|
8
|
+
|
|
9
|
+
You compose MUSIC action cards. You never execute — the queue does.
|
|
10
|
+
|
|
11
|
+
## Laws
|
|
12
|
+
|
|
13
|
+
1. ONE card per session. Compose, verify, done.
|
|
14
|
+
2. Structured caption rides **`params.prompt`** — there is NO
|
|
15
|
+
`caption` param. Genre + Vocal
|
|
16
|
+
Details + Arrangement — in that order, comma-separated.
|
|
17
|
+
3. Genre sets the foundation; vocals and arrangement add detail. A WEAK
|
|
18
|
+
caption ("Disco music") makes the model end the song early and the
|
|
19
|
+
tail run as noise — all three sections, always (engine-observed).
|
|
20
|
+
4. **DURATION IS A LEVER — for a SUNG song.** The lyrical plan carries
|
|
21
|
+
the clock and `duration` (5–360) caps it: set it near the target
|
|
22
|
+
and the song fills toward it. Draft ~30, final 90–120.
|
|
23
|
+
5. **THE INSTRUMENTAL IS THE EXCEPTION — the tags are the clock.**
|
|
24
|
+
With no words to carry the plan, the model emits its end-of-audio
|
|
25
|
+
stop token when the tag roadmap runs out: a blank box or a lone
|
|
26
|
+
`[instrumental]` wraps ~20–35s no matter how high `duration` sits.
|
|
27
|
+
The long-form instrumental formula (all three legs, always):
|
|
28
|
+
- **Tag roadmap in `params.lyrics`** — stack 8–12 structural tags,
|
|
29
|
+
ONE PER LINE, nothing else on the line and no text under the
|
|
30
|
+
tags (any words there get vocalized): `[intro]` / `[instrumental]`
|
|
31
|
+
/ `[interlude]` / `[solo]` / `[break]` / `[build up]` / `[outro]`.
|
|
32
|
+
Each tag is a distinct movement (~20–40s); repeat blocks to
|
|
33
|
+
reach the target length.
|
|
34
|
+
- **Disarm the vocal module in the caption's Vocal Details** —
|
|
35
|
+
explicit override: "Instrumental track — no vocals. Strictly
|
|
36
|
+
non-vocal composition without background humming, chops, or
|
|
37
|
+
synthesized vocal pads." The model is biased toward vocal
|
|
38
|
+
production; an omitted vocal line invites ad-libs, choir swells,
|
|
39
|
+
and humming into the extended blocks.
|
|
40
|
+
- **Coordinate the movement in Arrangement** — name lead and
|
|
41
|
+
rhythm instruments PER SECTION (intro: pads establish the key;
|
|
42
|
+
solo: lead takes the front; outro: fade to sustained pads).
|
|
43
|
+
With no singer to carry phrasing, per-section instrumentation
|
|
44
|
+
is what keeps the take from looping or cutting short.
|
|
45
|
+
- Set `duration` to the maximum you will allow — it is only the
|
|
46
|
+
cap; the roadmap decides the actual length.
|
|
47
|
+
6. THE FAMILY EDGE: MiniMax Music 3
|
|
48
|
+
carries INSTRUMENTALS well; YuE2 has the edge in RAP. Both
|
|
49
|
+
families are boarded — pick by the ask's genre before composing,
|
|
50
|
+
not after a weak first pass.
|
|
51
|
+
|
|
52
|
+
## Doors
|
|
53
|
+
|
|
54
|
+
- Compose: `melite_construct` — `add_stage` this card onto the shared
|
|
55
|
+
bench (`patch` / `rewire` to refine). The flow is live in the user's
|
|
56
|
+
cards tab; keep editing it as the user asks.
|
|
57
|
+
- Run: THE USER'S Run press on the card — never yours by default.
|
|
58
|
+
THE LANE LAW: when both lanes feel true,
|
|
59
|
+
THE LANE TEST decides — is the brief addressed to you as a DELIVERABLE?
|
|
60
|
+
Then compose it fully and say it is ready to run.
|
|
61
|
+
A question or joint exploration is not a deliverable — answer
|
|
62
|
+
it and shape the bench; either way your contract ends
|
|
63
|
+
at melite_construct and "ready to run".
|
|
64
|
+
- Progress: on the card itself (the user watches it run).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gamekit-music
|
|
3
|
+
description: Survival theme music via music3 - three-section structured caption; the Recipe rows are short-sting (5s) / full-length (360s).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Caption contract (90% of quality)
|
|
7
|
+
Plain `Label: text` lines, exactly three sections:
|
|
8
|
+
Genre (2-4 tags + era) / Vocal Details (or "instrumental, no vocals") /
|
|
9
|
+
Arrangement (instrumentation timeline, bpm, key).
|
|
10
|
+
|
|
11
|
+
## Run (queue door — the only inference door)
|
|
12
|
+
Gateway: in-process estate lanes (DSH host; no port).
|
|
13
|
+
Compose via `melite_construct` `add_stage` onto the shared bench — the
|
|
14
|
+
run starts at the user's Run press, never the agent's.
|
|
15
|
+
Iterate ONLY at **`duration: 30`**; render the final at `duration: 90–120`
|
|
16
|
+
once the caption is locked (no `preset` knob exists — duration is the
|
|
17
|
+
draft/final lever; the caption itself rides `params.prompt`).
|
|
18
|
+
**LENGTH LIVES IN `params.lyrics`, not duration**: duration is a LEVER for
|
|
19
|
+
sung songs (the plan fills toward the cap) — but an INSTRUMENTAL has no
|
|
20
|
+
words to carry the clock, so the section tags ARE the roadmap and the
|
|
21
|
+
model stops when they run out (blank or lone `[instrumental]` wraps
|
|
22
|
+
~20-35s no matter the duration). Long-form formula:
|
|
23
|
+
- 8-12 structural tags, one per line, NOTHING on the line or under the
|
|
24
|
+
tags (`[intro]` / `[instrumental]` / `[interlude]` / `[solo]` /
|
|
25
|
+
`[break]` / `[build up]` / `[outro]`) — ~20-40s per movement, repeat
|
|
26
|
+
to target length.
|
|
27
|
+
- Vocal Details carries the disarm directive: "Instrumental track — no
|
|
28
|
+
vocals. Strictly non-vocal composition without background humming,
|
|
29
|
+
chops, or synthesized vocal pads."
|
|
30
|
+
- Arrangement names lead/rhythm instruments PER SECTION so the take
|
|
31
|
+
doesn't loop or cut short.
|
|
32
|
+
- `duration` rides at the max you'll allow — cap only, the roadmap
|
|
33
|
+
decides.
|
|
34
|
+
Variations = same caption, new seeds.
|
|
35
|
+
|
|
36
|
+
## Gotcha
|
|
37
|
+
The status endpoint may list NO artifacts while the FLAC lands in the run dir -
|
|
38
|
+
trust disk (`ls data/runs/<run_id>/`).
|
|
39
|
+
|
|
40
|
+
## Deliver
|
|
41
|
+
FLAC in the run output dir — hand the artifact path to the asker
|
|
42
|
+
(the destination is the caller's product, not this skill's).
|
package/src/card.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// Tier 3 — the music card (the music_t1 renderer port).
|
|
2
|
+
// Decl + admission + one kit recipe call — the lane body rides @melite/comfyui-card-kit (musicT1/yue2T1).
|
|
3
|
+
// Instrumental = lyrics "" (MiniMax's own convention — baked, never
|
|
4
|
+
// an absent ref). Stock-only: the MiniMax + YuE2 nodes ride upstream
|
|
5
|
+
// core; no extension to declare (the retired card carried no requires).
|
|
6
|
+
import type { Context } from '@melite/comfyui-card-kit/card-definition'
|
|
7
|
+
import z from '@deepseek-ai/schemastery'
|
|
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
|
+
import type { ModelFacts } from '@melite/comfyui-card-kit/facts'
|
|
13
|
+
import type { GraphBuilder } from '@melite/comfyui-card-kit/graph'
|
|
14
|
+
import { vocabulary } from '@melite/comfyui-card-kit/vocab'
|
|
15
|
+
import { ComfyUIServiceFace } from '@melite/comfyui-card-kit/service-faces'
|
|
16
|
+
import { bag } from '@melite/contracts/extraKeys'
|
|
17
|
+
import { seedExtra } from '@melite/comfyui-card-kit/fields'
|
|
18
|
+
import { callableSchema, gatedResolve } from '@melite/comfyui-card-kit/admission'
|
|
19
|
+
|
|
20
|
+
export const schema = z.object({
|
|
21
|
+
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', })),
|
|
22
|
+
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' })),
|
|
23
|
+
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
|
+
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
|
+
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
|
+
n_diffusion_steps: z.number().description("Diffusion Steps").min(1).max(200).step(1).default(MUSIC3_FULL_STEPS.default).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
|
+
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
|
+
seed: z.number().description("Seed").step(1).default(-1).extra('extra', bag(seedExtra({ order: 0, group: 'seed', width: 1 }))),
|
|
29
|
+
// THE DECODE TIER KNOB (audit 014 C3): NO .default() — absence is
|
|
30
|
+
// the derivation's seat (the action derives plain/tiled from the
|
|
31
|
+
// lane's own VRAM/size signal; a stamped literal here would be the
|
|
32
|
+
// second default home the cure forbids). Stated, it overrides.
|
|
33
|
+
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' })),
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const schemaFn = callableSchema(schema)
|
|
37
|
+
|
|
38
|
+
// THE FAMILY IDS COME FROM THEIR DECLS (the closure gate's RULE 5):
|
|
39
|
+
// a retyped id breaks the card at RUNTIME — not-boarded — with every
|
|
40
|
+
// wall green. image-gen has done it this way all along.
|
|
41
|
+
export const BOARDED: string[] = [music3Decl.id, yue2Decl.id]
|
|
42
|
+
|
|
43
|
+
/** THE ACTION BINDINGS (the atom vocabulary, stroke 3): the owning
|
|
44
|
+
* family's declared compose action per boarded family — the card
|
|
45
|
+
* owns only dispatch; the segment factories live in the family
|
|
46
|
+
* packages (the legacy lanes stay the declared fallback +
|
|
47
|
+
* byte-oracle). Keyed by OWNING FAMILY (`model.family ?? model.id`
|
|
48
|
+
* at dispatch — a route id keys nothing, the derived-row law). */
|
|
49
|
+
export const ACTION_BINDINGS: Record<string, (p: Record<string, unknown>, model: ModelFacts, g: GraphBuilder, runId: string) => void> = {
|
|
50
|
+
[music3Decl.id]: (p, model, g, runId) => {
|
|
51
|
+
instantiateAction(declaredAction(music3Decl, 'compose'), p, model, g, runId)
|
|
52
|
+
},
|
|
53
|
+
[yue2Decl.id]: (p, model, g, runId) => {
|
|
54
|
+
instantiateAction(declaredAction(yue2Decl, 'compose'), p, model, g, runId)
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The identity rung (label/description — the authored prose the
|
|
59
|
+
* emitted tool row carries; the ring's spelling, stated once). */
|
|
60
|
+
export const identity = {
|
|
61
|
+
label: 'Music',
|
|
62
|
+
description: 'Generate music — MiniMax Music 3 (structured captions with tagged lyrics) or YuE2-3B (style + lyrics with ABC planning)',
|
|
63
|
+
genre: 'audio',
|
|
64
|
+
icon: 'music',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function registerCard(ctx: Context, comfy: ComfyUIServiceFace): void {
|
|
68
|
+
ctx.effect(() => comfy.registerCard({
|
|
69
|
+
id: 'music',
|
|
70
|
+
// stage-row id the compose emits (retired skeleton= verbatim; TS owns the truth post-flip).
|
|
71
|
+
skeleton: 'music',
|
|
72
|
+
// (A-C3, 2026-09-28: the literals were the drift class — a DECL
|
|
73
|
+
// rename silently diverged from this hand list. The spread is
|
|
74
|
+
// the derivation; closure-gate RULE 5 pins it.)
|
|
75
|
+
boarded: [...BOARDED],
|
|
76
|
+
tags: ['audio', 'music', 'generate'],
|
|
77
|
+
identity,
|
|
78
|
+
// THE DISCOVERY ROWS (migrated 2026-09-10 from the frozen
|
|
79
|
+
// discovery export — the card owns its sidebar, surface, and
|
|
80
|
+
// flow-stage declarations; the discovery arms derive from here).
|
|
81
|
+
sidebar: { key: 'audio', order: 5 },
|
|
82
|
+
flowKinds: {
|
|
83
|
+
inputs: { prompt: 'text', lyrics: 'text' },
|
|
84
|
+
outputs: { default: 'audio' },
|
|
85
|
+
requiresModel: false,
|
|
86
|
+
},
|
|
87
|
+
// stock-only card: the MiniMax + YuE2 nodes ride upstream core
|
|
88
|
+
// (comfy_extras.nodes_minimax_music / nodes_yue2); no requires.
|
|
89
|
+
// THE MODEL ADMISSION (F3-04, 2026-11-15): compose resolves the
|
|
90
|
+
// doc through gatedResolve('music', schemaFn, ['model'], p) —
|
|
91
|
+
// the model row id is admitted BEYOND the schema knobs (the
|
|
92
|
+
// card's own lane branch reads it; flowKinds.requiresModel:
|
|
93
|
+
// false only lifts the flow-stage demand). Declared here so
|
|
94
|
+
// the registry's admission surface (cardsFacts: def.admits)
|
|
95
|
+
// matches what the compose door actually serves — the
|
|
96
|
+
// dropped-knob sweep (runs-graph-receipt ARM j) reds on the
|
|
97
|
+
// gap this row used to be.
|
|
98
|
+
admits: ['model'],
|
|
99
|
+
schema: schemaFn,
|
|
100
|
+
compose(p, model, g, runId) {
|
|
101
|
+
// THE SCHEMA GATE (the h3 admission precedent — the card's
|
|
102
|
+
// own declaration validates the last hop into the engine):
|
|
103
|
+
// schemastery walk enforces declared types + bounds (a
|
|
104
|
+
// duration=900 draft refuses LOUD here, never composes),
|
|
105
|
+
// fills defaults, admits legacy keys inert. The composer's
|
|
106
|
+
// reads below are reads of the GATED doc.
|
|
107
|
+
const doc = gatedResolve('music', schemaFn, ['model'], p)
|
|
108
|
+
if (!doc.prompt) {
|
|
109
|
+
throw new Error("required param 'prompt' missing or empty on the music card (the music caption — what the song IS)")
|
|
110
|
+
}
|
|
111
|
+
// THE LANE BRANCH (data never a family-id switch — the
|
|
112
|
+
// latent_node precedent): yue2's rail resolves a checkpoint
|
|
113
|
+
// row (one file carries model+clip+vae); music3's resolves
|
|
114
|
+
// the unet/clip/vae trio. THE DECLARED ACTIONS (the atom
|
|
115
|
+
// vocabulary, stroke 3): each boarded family's own compose
|
|
116
|
+
// action composes first — the data branch below is the
|
|
117
|
+
// declared legacy-lane fallback for family-less rows, never a
|
|
118
|
+
// silent second copy.
|
|
119
|
+
const bound = ACTION_BINDINGS[model.family ?? model.id]
|
|
120
|
+
if (bound) {
|
|
121
|
+
bound(doc, model, g, runId)
|
|
122
|
+
} else {
|
|
123
|
+
throw new Error(
|
|
124
|
+
`no declared action for family '${String(model.family ?? model.id)}' on the music card — every boarded family (music3, yue2) composes its own declared segment; this address owns none. State params.model (one of the boarded families) on the stage to compose it`)
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
}))
|
|
128
|
+
}
|