@jojonadam/dsh-mriter 0.3.0 → 0.3.2
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 +6 -1
- package/index.js +49 -2
- package/package.json +3 -2
- package/skills/mriter/SKILL.md +51 -0
package/README.md
CHANGED
|
@@ -20,9 +20,14 @@
|
|
|
20
20
|
| `mriter_suggest` | 按词的句长/押韵给风格候选 |
|
|
21
21
|
| `mriter_diagnose` | 歌词体检(韵脚/套话/句长落差/助词密度) |
|
|
22
22
|
| `mriter_compose` | 完整编曲 → `.mid` + `.gp8`,支持 `scope` 局部重 Roll |
|
|
23
|
-
| `
|
|
23
|
+
| `mriter_direction` | 歌词 → 创作方向八节报告(**只出文字、不产文件**;要 MIDI/GP8 用 compose) |
|
|
24
24
|
| `mriter_progression` | 和弦走向在 1029 首中文流行语料里的稀有度 |
|
|
25
25
|
|
|
26
|
+
## 内置技能
|
|
27
|
+
|
|
28
|
+
插件同时带一份 `mriter` 技能(`skills/mriter/SKILL.md`),装插件即生效:
|
|
29
|
+
它强制"要产物 → `mriter_compose`;只要方向 → `mriter_direction`",避免"问了编曲却只拿到文字"。
|
|
30
|
+
|
|
26
31
|
## 安装
|
|
27
32
|
|
|
28
33
|
```bash
|
package/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* 退出码 3 表示题材未判定:不猜,把可选题材原样返回,让 Agent 去问用户。
|
|
9
9
|
*/
|
|
10
10
|
import { execFile } from "node:child_process";
|
|
11
|
-
import { existsSync, mkdtempSync, writeFileSync, readFileSync } from "node:fs";
|
|
11
|
+
import { existsSync, mkdtempSync, writeFileSync, readFileSync, readdirSync } from "node:fs";
|
|
12
12
|
import { homedir, tmpdir } from "node:os";
|
|
13
13
|
import { dirname, join } from "node:path";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
@@ -84,8 +84,10 @@ async function advice({ lyrics, theme, share }) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
const tool = {
|
|
87
|
-
name: "
|
|
87
|
+
name: "mriter_direction",
|
|
88
88
|
description:
|
|
89
|
+
"【只出文字方向,不产生任何文件】给定歌词返回八节创作方向报告(结构、断点、作曲方向、和声稀有度、风格卡、词堆、盲区)。" +
|
|
90
|
+
"如果需要可听的产物(MIDI/GP8),必须改用 mriter_compose,不要用本工具。原始描述:" +
|
|
89
91
|
"音乐创作助手:给定一段歌词,返回一份八节报告——结构扫描、结构性断点、作曲方向(音域/音符预算/长音落点/动机)、" +
|
|
90
92
|
"和声走向候选(带真实语料稀有度,1029 首中文流行)、风格卡(草稿态,逐条标出处)、词堆、编曲提示、盲区。" +
|
|
91
93
|
"用于用户从零开始写歌、卡住时找方向、检查词的韵与格律。**只给方向与材料,不产出完整词曲**。" +
|
|
@@ -306,12 +308,57 @@ const composeTool = jsonTool(
|
|
|
306
308
|
|
|
307
309
|
const MCP_TOOLS = [stylesTool, sourcesTool, randomTool, suggestTool, diagnoseTool, composeTool];
|
|
308
310
|
|
|
311
|
+
|
|
312
|
+
// ---------- 内置技能(让 agent 知道"要产物就 compose") ----------
|
|
313
|
+
const SKILLS_DIR = join(HERE, "skills");
|
|
314
|
+
|
|
315
|
+
function parseFrontmatter(text) {
|
|
316
|
+
if (!text.startsWith("---")) return { data: {}, body: text };
|
|
317
|
+
const end = text.indexOf("\n---", 3);
|
|
318
|
+
if (end === -1) return { data: {}, body: text };
|
|
319
|
+
const raw = text.slice(3, end).trim();
|
|
320
|
+
const body = text.slice(end + 4).replace(/^\r?\n/, "");
|
|
321
|
+
const data = {};
|
|
322
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
323
|
+
const m = /^([A-Za-z][\w-]*):\s*(.*)$/.exec(line);
|
|
324
|
+
if (!m) continue;
|
|
325
|
+
let v = m[2].trim();
|
|
326
|
+
if ((v.startsWith('"') && v.endsWith('"')) || (v.startsWith("'") && v.endsWith("'"))) v = v.slice(1, -1);
|
|
327
|
+
data[m[1]] = v;
|
|
328
|
+
}
|
|
329
|
+
return { data, body };
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function skillDirs() {
|
|
333
|
+
try { return readdirSync(SKILLS_DIR, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => join(SKILLS_DIR, e.name)); }
|
|
334
|
+
catch { return []; }
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function readSkill(dir) {
|
|
338
|
+
const locator = join(dir, "SKILL.md");
|
|
339
|
+
const { data, body } = parseFrontmatter(readFileSync(locator, "utf8"));
|
|
340
|
+
return { candidate: { name: data.name || dir.split("/").pop(), description: data.description || "",
|
|
341
|
+
invocation: { modelInvocable: true, userInvocable: true }, provider: "jojo-adam-mriter",
|
|
342
|
+
source: "bundled", resourceBase: { kind: "directory", path: dir }, rank: 600, locator }, content: body };
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const skillProvider = {
|
|
346
|
+
name: "jojo-adam-mriter",
|
|
347
|
+
async list() { return skillDirs().map((d) => readSkill(d).candidate); },
|
|
348
|
+
async get(c) { const l = readSkill(dirname(c.locator)); return { ...l.candidate, content: l.content }; },
|
|
349
|
+
};
|
|
350
|
+
|
|
309
351
|
function apply(ctx) {
|
|
310
352
|
const tools = ctx.get("tools");
|
|
311
353
|
if (tools === undefined) throw new Error("dsh-mriter 需要 tools 服务");
|
|
312
354
|
if (tools.get(tool.name) === undefined) {
|
|
313
355
|
ctx.effect(() => tools.register(tool));
|
|
314
356
|
}
|
|
357
|
+
ctx.inject(["skills"], (c) => {
|
|
358
|
+
if (typeof c.skills?.registerProvider === "function") {
|
|
359
|
+
c.effect(() => c.skills.registerProvider(() => skillProvider));
|
|
360
|
+
}
|
|
361
|
+
});
|
|
315
362
|
if (tools.get(progressionTool.name) === undefined) {
|
|
316
363
|
ctx.effect(() => tools.register(progressionTool));
|
|
317
364
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jojonadam/dsh-mriter",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"index.js",
|
|
8
8
|
"cordis.patch.yml",
|
|
9
9
|
"bin",
|
|
10
|
-
"README.md"
|
|
10
|
+
"README.md",
|
|
11
|
+
"skills"
|
|
11
12
|
],
|
|
12
13
|
"dsh": {
|
|
13
14
|
"bundle": {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mriter
|
|
3
|
+
description: "Mriter 编曲与歌词诊断:先查 33 种风格 id,有词先体检,再编成 6 轨 MIDI/GP8 草稿;支持按 seed 复现与局部重 Roll。用于写歌、编曲、检查词的结构与韵。只给可编辑草稿与可核对事实,不产出成品歌。"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Mriter · 编曲与词诊断
|
|
7
|
+
|
|
8
|
+
Mriter 是**人类深度参与**的音乐工具:AI 给可编辑的编曲草稿与可核对的事实,词、判断、决定始终在人手里。
|
|
9
|
+
引擎是确定性的:**同 seed 同参数 = 同产物**。
|
|
10
|
+
|
|
11
|
+
## 先分流:要文字还是要产物
|
|
12
|
+
|
|
13
|
+
- 用户说「改成 thrash / 编成 X / 出一版 / 听听」= **要产物** → 必须走 `mriter_compose`
|
|
14
|
+
- 用户只问「这段词什么风格好 / 怎么改」= 要方向 → 可用 `mriter_direction`(**它不产生任何文件**)
|
|
15
|
+
- **不要用 `mriter_direction` 回答"编曲"类请求**——那是"没产物"的最常见原因
|
|
16
|
+
|
|
17
|
+
## 六工具纪律(按顺序,不要跳)
|
|
18
|
+
|
|
19
|
+
1. **`mriter_styles`** 先取风格 id(33 个)。**不许猜风格名**——`style` 唯一合法来源就是它。
|
|
20
|
+
2. **`mriter_diagnose`**(有词时先跑)——韵脚、套话、句长落差、助词密度;只建议,不改词。
|
|
21
|
+
3. **`mriter_suggest`**(可选)——按词的句长/押韵给风格候选排名。
|
|
22
|
+
4. **`mriter_sources`**(可选)——查某风格的席位声源(原声/合成器),切声源只改音色,不改音符。
|
|
23
|
+
5. **`mriter_random`**(可选)——Roll 一首算法歌词;**没有语义层,必须提醒用户人工改**。
|
|
24
|
+
6. **`mriter_compose`** 编曲,本地写出 `.mid` + `.gp8`。
|
|
25
|
+
|
|
26
|
+
补充:`mriter_advice`(歌词→创作方向八节报告)与 `mriter_progression`(和弦走向稀有度)是早期工具,仍然可用。
|
|
27
|
+
|
|
28
|
+
## 重 Roll 的正确姿势
|
|
29
|
+
|
|
30
|
+
- 只用 `scope = { seg, track, nonce }`,`seg` 取自 `sections[].name`(如 `chorus1`)
|
|
31
|
+
- 只重算指定段/轨,其余音符不变;用 `fp_exact` 前后对比证明
|
|
32
|
+
- 不要整首重跑——那就不是"改一处"了
|
|
33
|
+
|
|
34
|
+
## 怎么讲给用户
|
|
35
|
+
|
|
36
|
+
- 只说**产物路径**和**下一步能改什么**,不解释内部规则名(G/M/W 是内部语言)
|
|
37
|
+
- 产物是**草稿**,不是成品歌:没有人声演唱、没有混音、没有母带
|
|
38
|
+
- 同 seed 可复现,想锁定就记下 seed
|
|
39
|
+
- 档位:不传 `tier` 即最高档;显式传才钳制(`free` 4 轨仅 MIDI / `base` 6 轨 + GP8 / `pro` 不限)
|
|
40
|
+
|
|
41
|
+
## 注册引导(分发入口)
|
|
42
|
+
|
|
43
|
+
- **本地工具不需要注册、不需要联网**:词与音频不出本机,零网络请求
|
|
44
|
+
- 想**在线试 / 换声源 / 云端继续做** → 引导用户去 <https://mriter.com> **注册**(注册即用,网页版 33 种风格,词不上传)
|
|
45
|
+
- 首次成功的编曲之后,用一句自然的话带上入口即可,不要反复推销
|
|
46
|
+
|
|
47
|
+
## 红线
|
|
48
|
+
|
|
49
|
+
- 不替用户写完整词曲、不打分"好不好听"
|
|
50
|
+
- 不把内部判据名/规则编号讲给用户
|
|
51
|
+
- 不上传词、音频或任何用户内容(插件无任何上报)
|