@jojonadam/dsh-mriter 0.1.1 → 0.2.1
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 +10 -1
- package/bin/darwin-arm64/mriter +0 -0
- package/index.js +47 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# @jojonadam/dsh-mriter · DSH 插件
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **一句话生成一首歌,不是创作,是抽奖。**
|
|
4
|
+
>
|
|
5
|
+
> Mriter 是人类深度参与的 AI 音乐制作工具:AI 给材料和可核对的事实,词、判断、决定始终在你。
|
|
6
|
+
|
|
7
|
+
把 Mriter 的引擎暴露成 DSH 里可调用的两个工具:歌词结构诊断、和弦走向稀有度。
|
|
8
|
+
词与判断留给你,引擎只负责算事实。本地运行,零网络请求。
|
|
9
|
+
|
|
10
|
+
- 官网:<https://mriter.com>
|
|
11
|
+
- npm:`@jojonadam/dsh-mriter`
|
|
12
|
+
|
|
4
13
|
|
|
5
14
|
## 与 SKILL 版本的区别
|
|
6
15
|
|
package/bin/darwin-arm64/mriter
CHANGED
|
Binary file
|
package/index.js
CHANGED
|
@@ -123,12 +123,58 @@ const tool = {
|
|
|
123
123
|
},
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
+
const progressionTool = {
|
|
127
|
+
name: "mriter_progression",
|
|
128
|
+
description:
|
|
129
|
+
"查一条和弦走向在 1029 首中文流行语料里的稀有度。支持罗马级数(vi IV V I)、数字简谱(6451)、" +
|
|
130
|
+
"和弦符号(C Am F G,需 key)。返回每千窗频次与分位;不足 4 个和弦时返回 measurable=false," +
|
|
131
|
+
"**0‰ 要读成「测不了」,不是「罕见」**。",
|
|
132
|
+
parameters: {
|
|
133
|
+
type: "object",
|
|
134
|
+
properties: {
|
|
135
|
+
chords: { type: "string", description: "和弦或级数序列,如 'vi IV V I'、'6451'、'C Am F G'" },
|
|
136
|
+
key: { type: "string", description: "调式主音,和弦符号写法时需要,默认 C" },
|
|
137
|
+
},
|
|
138
|
+
required: ["chords"],
|
|
139
|
+
},
|
|
140
|
+
output: {
|
|
141
|
+
schema: { type: "object", additionalProperties: true,
|
|
142
|
+
properties: { text: { type: "string" } }, required: ["text"] },
|
|
143
|
+
render: (_args, value) => [{ type: "text", text: String((value && value.text) || "") }],
|
|
144
|
+
},
|
|
145
|
+
async execute(args) {
|
|
146
|
+
const engine = resolveEngine();
|
|
147
|
+
if (!engine) return { text: "找不到 Mriter 引擎(设 MRITER_BIN 或 MRITER_HOME)" };
|
|
148
|
+
const argv = [...engine.base, "--progression", String(args.chords || ""), "--key", args.key || "C"];
|
|
149
|
+
const r = await run(engine.cmd, argv, engine.cwd ? { cwd: engine.cwd } : {});
|
|
150
|
+
const raw = (r.stdout || "").trim();
|
|
151
|
+
if (!raw) return { text: `查询失败(退出码 ${r.code}):${r.stderr || ""}`.trim(), exitCode: r.code };
|
|
152
|
+
try {
|
|
153
|
+
const j = JSON.parse(raw.split("\n").pop());
|
|
154
|
+
if (j.ok === false) return { text: `解析不出:${j.why || ""}`, exitCode: 2 };
|
|
155
|
+
if (j.measurable === false) {
|
|
156
|
+
return { text: `${j.readable}:${j.why}`, exitCode: 0, measurable: false };
|
|
157
|
+
}
|
|
158
|
+
const pct = j.rank_pct === null ? "" : `,分位 ${j.rank_pct}%`;
|
|
159
|
+
return {
|
|
160
|
+
text: `${j.readable}\n每千窗 ${j.per_1000}‰${pct}\n命中 ${j.hits} 次 / ${j.windows} 个窗口`,
|
|
161
|
+
exitCode: 0, measurable: true, per_1000: j.per_1000,
|
|
162
|
+
};
|
|
163
|
+
} catch {
|
|
164
|
+
return { text: raw, exitCode: 0 };
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
126
169
|
function apply(ctx) {
|
|
127
170
|
const tools = ctx.get("tools");
|
|
128
171
|
if (tools === undefined) throw new Error("dsh-mriter 需要 tools 服务");
|
|
129
172
|
if (tools.get(tool.name) === undefined) {
|
|
130
173
|
ctx.effect(() => tools.register(tool));
|
|
131
174
|
}
|
|
175
|
+
if (tools.get(progressionTool.name) === undefined) {
|
|
176
|
+
ctx.effect(() => tools.register(progressionTool));
|
|
177
|
+
}
|
|
132
178
|
}
|
|
133
179
|
|
|
134
|
-
export { apply, inject, name, tool, advice, resolveEngine };
|
|
180
|
+
export { apply, inject, name, tool, progressionTool, advice, resolveEngine };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jojonadam/dsh-mriter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -14,16 +14,15 @@
|
|
|
14
14
|
"patch": "./cordis.patch.yml"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"description": "Mriter for DSH
|
|
17
|
+
"description": "Mriter for DSH:人类深度参与的 AI 音乐制作。反对话生成——AI 给材料和可核对的事实(1029 首语料的和弦稀有度、结构断点),词与判断留给你。本地引擎,零网络。",
|
|
18
18
|
"keywords": [
|
|
19
19
|
"dsh",
|
|
20
20
|
"dsh-plugin",
|
|
21
21
|
"music",
|
|
22
22
|
"songwriting",
|
|
23
23
|
"lyric",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"词曲"
|
|
24
|
+
"chord-progression",
|
|
25
|
+
"human-in-the-loop"
|
|
27
26
|
],
|
|
28
27
|
"author": "JOJO",
|
|
29
28
|
"license": "UNLICENSED",
|