@yoonion/mimi-seed-mcp 0.31.0 → 0.33.0
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 +3 -1
- package/assets/agent-guide.md +4 -3
- package/dist/i18n/tools-en/video.d.ts +18 -0
- package/dist/i18n/tools-en/video.js +18 -0
- package/dist/lib/telegram-approval.d.ts +4 -2
- package/dist/lib/telegram-approval.js +165 -14
- package/dist/lib/telegram-relay.d.ts +93 -0
- package/dist/lib/telegram-relay.js +234 -0
- package/dist/registers/video.js +78 -2
- package/dist/video/clips.d.ts +183 -0
- package/dist/video/clips.js +457 -0
- package/dist/video/narration.d.ts +110 -0
- package/dist/video/narration.js +326 -0
- package/dist/video/project.d.ts +1 -1
- package/dist/video/project.js +7 -4
- package/dist/video/providers.d.ts +3 -2
- package/dist/video/providers.js +3 -3
- package/dist/video/render.d.ts +7 -0
- package/dist/video/render.js +50 -3
- package/dist/video/schemas.d.ts +1 -0
- package/dist/video/schemas.js +1 -0
- package/dist/video/types.d.ts +2 -0
- package/dist/video/windows-voice.d.ts +22 -0
- package/dist/video/windows-voice.js +143 -0
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
- package/tool-manifest.json +12 -4
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// Windows 기본 목소리 — 키 없이 이 컴퓨터에 깔린 음성(System.Speech)으로 장면 음성을 만든다.
|
|
2
|
+
//
|
|
3
|
+
// - 돈이 들지 않고 인터넷도 쓰지 않는다. 대신 Windows 에서만 되고, 소리는 기계 느낌이 난다.
|
|
4
|
+
// - 문구와 경로는 명령줄이 아니라 환경변수와 임시 파일로 넘긴다 (따옴표·명령 끼워 넣기 걱정 없음).
|
|
5
|
+
// - 음성 길이는 만든 WAV 머리에서 잰다 (ElevenLabs 처럼 글자별 시각을 주지 않으므로).
|
|
6
|
+
import { execFile } from 'node:child_process';
|
|
7
|
+
import { randomUUID } from 'node:crypto';
|
|
8
|
+
import { mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { promisify } from 'node:util';
|
|
11
|
+
import { catalog } from '#core/lang.js';
|
|
12
|
+
const execFileAsync = promisify(execFile);
|
|
13
|
+
const M = catalog({
|
|
14
|
+
notWindows: '❌ Windows 기본 목소리는 Windows 에서만 쓸 수 있습니다. engine 을 elevenlabs 로 바꾸세요.',
|
|
15
|
+
failed: (detail) => `Windows 목소리로 음성을 만들지 못했습니다: ${detail}`,
|
|
16
|
+
badWav: 'Windows 목소리가 만든 파일이 올바른 WAV 가 아닙니다.',
|
|
17
|
+
}, {
|
|
18
|
+
notWindows: '❌ The Windows built-in voice only works on Windows. Switch engine to elevenlabs.',
|
|
19
|
+
failed: (detail) => `The Windows voice could not make the audio: ${detail}`,
|
|
20
|
+
badWav: 'The file made by the Windows voice is not a valid WAV.',
|
|
21
|
+
});
|
|
22
|
+
/** Windows 음성 이름 (예: "Microsoft Heami Desktop"). 따옴표·세미콜론 같은 글자는 받지 않는다. */
|
|
23
|
+
export const WINDOWS_VOICE = /^[A-Za-z0-9][A-Za-z0-9 ._()-]{0,99}$/;
|
|
24
|
+
const TIMEOUT_MS = 120_000;
|
|
25
|
+
function assertWindows() {
|
|
26
|
+
if (process.platform !== 'win32')
|
|
27
|
+
throw new Error(M().notWindows);
|
|
28
|
+
}
|
|
29
|
+
/** 스크립트는 고정 문자열이다. 바뀌는 값은 모두 MIMI_TTS_* 환경변수로 들어간다. */
|
|
30
|
+
async function runPowerShell(script, env) {
|
|
31
|
+
assertWindows();
|
|
32
|
+
// 오류는 한 줄 글로 stderr 에 쓴다 (그냥 두면 -EncodedCommand 의 오류가 CLIXML 덩어리로 나온다).
|
|
33
|
+
// 출력 인코딩을 UTF-8 로 먼저 바꿔 Windows 가 한국어로 낸 오류도 깨지지 않게 한다.
|
|
34
|
+
const wrapped = [
|
|
35
|
+
"$ErrorActionPreference = 'Stop'",
|
|
36
|
+
"$ProgressPreference = 'SilentlyContinue'",
|
|
37
|
+
'[Console]::OutputEncoding = [Text.Encoding]::UTF8',
|
|
38
|
+
`try {\n${script}\n} catch { [Console]::Error.WriteLine($_.Exception.Message); exit 1 }`,
|
|
39
|
+
].join('\n');
|
|
40
|
+
const encoded = Buffer.from(wrapped, 'utf16le').toString('base64');
|
|
41
|
+
try {
|
|
42
|
+
// System.Speech 는 .NET Framework 어셈블리라 pwsh(7) 가 아니라 Windows PowerShell 로 돌린다.
|
|
43
|
+
const { stdout } = await execFileAsync('powershell.exe', ['-NoLogo', '-NoProfile', '-NonInteractive', '-EncodedCommand', encoded], { env: { ...process.env, ...env }, timeout: TIMEOUT_MS, windowsHide: true, maxBuffer: 1024 * 1024 });
|
|
44
|
+
return stdout;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
const raw = error.stderr;
|
|
48
|
+
const stderr = (typeof raw === 'string' ? raw : raw?.toString('utf8') ?? '').trim();
|
|
49
|
+
const detail = stderr.split(/\r?\n/).filter(Boolean).slice(0, 3).join(' ') || error.message;
|
|
50
|
+
throw new Error(M().failed(detail.slice(0, 500)), { cause: error });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const LIST_SCRIPT = `
|
|
54
|
+
Add-Type -AssemblyName System.Speech
|
|
55
|
+
$s = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
|
56
|
+
try {
|
|
57
|
+
$list = @($s.GetInstalledVoices() | Where-Object { $_.Enabled } | ForEach-Object {
|
|
58
|
+
[pscustomobject]@{ name = $_.VoiceInfo.Name; culture = $_.VoiceInfo.Culture.Name; gender = [string]$_.VoiceInfo.Gender }
|
|
59
|
+
})
|
|
60
|
+
[Console]::Out.Write((ConvertTo-Json -InputObject $list -Compress))
|
|
61
|
+
} finally { $s.Dispose() }
|
|
62
|
+
`;
|
|
63
|
+
export async function listWindowsVoices() {
|
|
64
|
+
const out = await runPowerShell(LIST_SCRIPT, {});
|
|
65
|
+
const parsed = JSON.parse(out.trim() || '[]');
|
|
66
|
+
return parsed
|
|
67
|
+
.filter((v) => typeof v.name === 'string' && WINDOWS_VOICE.test(v.name))
|
|
68
|
+
.map((v) => ({
|
|
69
|
+
voiceId: v.name,
|
|
70
|
+
name: v.name,
|
|
71
|
+
culture: typeof v.culture === 'string' ? v.culture : '',
|
|
72
|
+
gender: typeof v.gender === 'string' ? v.gender : '',
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
const SPEAK_SCRIPT = `
|
|
76
|
+
Add-Type -AssemblyName System.Speech
|
|
77
|
+
$s = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
|
78
|
+
try {
|
|
79
|
+
if ($env:MIMI_TTS_VOICE) {
|
|
80
|
+
$s.SelectVoice($env:MIMI_TTS_VOICE)
|
|
81
|
+
} else {
|
|
82
|
+
$lang = $env:MIMI_TTS_LANG
|
|
83
|
+
$pick = $s.GetInstalledVoices() | Where-Object { $_.Enabled -and ($_.VoiceInfo.Culture.Name -eq $lang -or $_.VoiceInfo.Culture.TwoLetterISOLanguageName -eq $lang) } | Select-Object -First 1
|
|
84
|
+
# Stop instead of reading with the default voice: an English voice reading Korean is unintelligible
|
|
85
|
+
if (-not $pick) { throw "No installed Windows voice for language '$lang'. Install that language's speech pack in Windows Settings, or pass voiceId." }
|
|
86
|
+
$s.SelectVoice($pick.VoiceInfo.Name)
|
|
87
|
+
}
|
|
88
|
+
$text = [IO.File]::ReadAllText($env:MIMI_TTS_TEXT, [Text.Encoding]::UTF8)
|
|
89
|
+
$s.SetOutputToWaveFile($env:MIMI_TTS_OUT)
|
|
90
|
+
$s.Speak($text)
|
|
91
|
+
$s.SetOutputToNull()
|
|
92
|
+
[Console]::Out.Write($s.Voice.Name)
|
|
93
|
+
} finally { $s.Dispose() }
|
|
94
|
+
`;
|
|
95
|
+
/** WAV(RIFF) 머리에서 소리 길이(초)를 잰다. fmt 의 초당 바이트 수와 data 크기로 계산한다. */
|
|
96
|
+
export function wavSeconds(bytes) {
|
|
97
|
+
if (bytes.length < 12 || bytes.toString('ascii', 0, 4) !== 'RIFF' || bytes.toString('ascii', 8, 12) !== 'WAVE') {
|
|
98
|
+
throw new Error(M().badWav);
|
|
99
|
+
}
|
|
100
|
+
let byteRate = 0;
|
|
101
|
+
let offset = 12;
|
|
102
|
+
while (offset + 8 <= bytes.length) {
|
|
103
|
+
const id = bytes.toString('ascii', offset, offset + 4);
|
|
104
|
+
const size = bytes.readUInt32LE(offset + 4);
|
|
105
|
+
if (id === 'fmt ' && offset + 16 <= bytes.length)
|
|
106
|
+
byteRate = bytes.readUInt32LE(offset + 16);
|
|
107
|
+
if (id === 'data') {
|
|
108
|
+
if (!byteRate)
|
|
109
|
+
break;
|
|
110
|
+
const dataSize = Math.min(size, bytes.length - offset - 8);
|
|
111
|
+
return dataSize / byteRate;
|
|
112
|
+
}
|
|
113
|
+
offset += 8 + size + (size % 2);
|
|
114
|
+
}
|
|
115
|
+
throw new Error(M().badWav);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 문구 하나를 WAV 로 만든다. voice 를 주지 않으면 lang(예: ko) 에 맞는 첫 목소리. 맞는 목소리가 없으면 실패한다.
|
|
119
|
+
* 돌려주는 값: 실제로 쓴 목소리 이름과 음성 길이(초).
|
|
120
|
+
*/
|
|
121
|
+
export async function speakToWav(text, outPath, options) {
|
|
122
|
+
assertWindows();
|
|
123
|
+
mkdirSync(path.dirname(outPath), { recursive: true });
|
|
124
|
+
const textPath = path.join(path.dirname(outPath), `.tts-${randomUUID()}.txt`);
|
|
125
|
+
writeFileSync(textPath, text, { encoding: 'utf8', flag: 'wx' });
|
|
126
|
+
try {
|
|
127
|
+
const voice = await runPowerShell(SPEAK_SCRIPT, {
|
|
128
|
+
MIMI_TTS_VOICE: options.voice ?? '',
|
|
129
|
+
MIMI_TTS_LANG: options.lang,
|
|
130
|
+
MIMI_TTS_TEXT: textPath,
|
|
131
|
+
MIMI_TTS_OUT: outPath,
|
|
132
|
+
});
|
|
133
|
+
return { voice: voice.trim(), speechSec: wavSeconds(readFileSync(outPath)) };
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
try {
|
|
137
|
+
unlinkSync(textPath);
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
// 이미 지워졌으면 그만이다.
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoonion/mimi-seed-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@yoonion/mimi-seed-mcp",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.33.0",
|
|
10
10
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@googleapis/admob": "^11.0.1",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"node_modules/@anthropic-ai/sdk": {
|
|
62
|
-
"version": "1.
|
|
63
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.
|
|
64
|
-
"integrity": "sha512-
|
|
62
|
+
"version": "1.14.0",
|
|
63
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.14.0.tgz",
|
|
64
|
+
"integrity": "sha512-nADYXUd5fn9Zgw2nHi1iKyt/kb1UUt1cN3RbdxEI6XjTDTxbx4LLG4GnMrxWyS9GgXQllFOyAKSiFM3joDNK9A==",
|
|
65
65
|
"license": "Apache-2.0",
|
|
66
66
|
"optional": true,
|
|
67
67
|
"dependencies": {
|
package/package.json
CHANGED
package/tool-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "등록된 MCP 도구 + 도메인 메타데이터(label·credential·summary) + 도구 분류(write·destructive·local·idempotent → MCP annotations·confirm 가드) + toolset 그룹·폐기 별칭의 SSOT (src/lib/tool-registrar.ts 가 읽는다). src/__tests__/tool-manifest.test.ts 가 실제 서버 등록 목록과 diff 하고 메타데이터 정합성을 검사한다. 도구 추가/삭제/개명 시 이 파일을 함께 갱신할 것 — 산문 문서에는 정확한 개수를 쓰지 말고 이 파일을 가리킬 것. mimi-seed://tools/catalog 리소스가 이 파일을 그대로 서빙한다.",
|
|
3
|
-
"total":
|
|
3
|
+
"total": 285,
|
|
4
4
|
"alwaysOn": [
|
|
5
5
|
"auth",
|
|
6
6
|
"checks",
|
|
@@ -903,7 +903,11 @@
|
|
|
903
903
|
"video_build_timeline",
|
|
904
904
|
"video_render",
|
|
905
905
|
"video_job_status",
|
|
906
|
-
"video_validate"
|
|
906
|
+
"video_validate",
|
|
907
|
+
"video_list_voices",
|
|
908
|
+
"video_generate_narration",
|
|
909
|
+
"video_generate_clip",
|
|
910
|
+
"video_clip_status"
|
|
907
911
|
],
|
|
908
912
|
"write": [
|
|
909
913
|
"video_plan_from_story",
|
|
@@ -917,7 +921,10 @@
|
|
|
917
921
|
"video_build_timeline",
|
|
918
922
|
"video_render",
|
|
919
923
|
"youtube_upload_video",
|
|
920
|
-
"youtube_update_video_privacy"
|
|
924
|
+
"youtube_update_video_privacy",
|
|
925
|
+
"video_generate_narration",
|
|
926
|
+
"video_generate_clip",
|
|
927
|
+
"video_clip_status"
|
|
921
928
|
],
|
|
922
929
|
"destructive": [],
|
|
923
930
|
"ownGate": [],
|
|
@@ -931,7 +938,8 @@
|
|
|
931
938
|
],
|
|
932
939
|
"idempotent": [
|
|
933
940
|
"video_build_timeline",
|
|
934
|
-
"youtube_update_video_privacy"
|
|
941
|
+
"youtube_update_video_privacy",
|
|
942
|
+
"video_clip_status"
|
|
935
943
|
]
|
|
936
944
|
},
|
|
937
945
|
"youtube": {
|