dsh-folia 1.0.1 → 1.2.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.
@@ -1010,6 +1010,16 @@ const DEFAULTS = {
1010
1010
  voice: { name: '', muted: false },
1011
1011
  // 唤醒:点一下默认开;叫名字默认关(S6 才实现,先在设置里留位)
1012
1012
  wake: { click: true, name: false, keyword: '' },
1013
+ // v1.2:会话模式(聊天 / 讲故事 / 树洞 / 只观察)。默认聊天。
1014
+ conversationMode: 'chat',
1015
+ // v1.2:语音回答长度(0 = 不限;默认 8 句 —— 旧版写死 3 句,讲故事被截断的根因)。
1016
+ voiceLength: 8,
1017
+ // v1.2:主动思维(默认关;15/30/60 分钟才开)。勿扰时段跨零点也支持。
1018
+ proactive: { enabled: false, intervalMin: 15, quietFrom: '23:00', quietTo: '08:00' },
1019
+ // v1.2:屏幕感知(默认关;app = 只读前台应用/标题,ocr = 再加屏幕 OCR,需二次确认)。
1020
+ screen: { mode: 'off', confirmed: false },
1021
+ // v1.2:树洞安全提示里的求助热线(配置化;不写死成某一家的号码)。
1022
+ treehole: { hotline: '12356' },
1013
1023
  // 对话记忆默认开启且**不暴露开关**(追加决定 1):能力常开,用户只能在右键里查看/清空
1014
1024
  },
1015
1025
  };
@@ -1726,6 +1736,19 @@ const PET_CHAT_BASE_URL_MAX = 300;
1726
1736
  const PET_CHAT_API_KEY_MAX = 400;
1727
1737
  const PET_CHAT_MODEL_MAX = 120;
1728
1738
  const PET_CHAT_PERSONA_MAX = 200;
1739
+ /** v1.2:会话模式 / 语音长度 / 主动搭话 / 屏幕感知(全部**默认关闭**高风险项)。 */
1740
+ export const PET_CHAT_CONVERSATION_MODES = Object.freeze(['chat', 'story', 'treehole', 'observe']);
1741
+ /** 语音回答长度:0 = 不限;默认 8 句(v1.2 从 3 句改上来的)。 */
1742
+ export const PET_CHAT_VOICE_LENGTHS = Object.freeze([0, 3, 8]);
1743
+ /** 主动搭话间隔(分钟):0 = 关。默认关。 */
1744
+ export const PET_CHAT_PROACTIVE_INTERVALS = Object.freeze([0, 15, 30, 60]);
1745
+ /** 屏幕感知:off / app(前台应用)/ ocr(前台 + 屏幕 OCR)。默认 off。 */
1746
+ export const PET_CHAT_SCREEN_MODES = Object.freeze(['off', 'app', 'ocr']);
1747
+ const PET_CHAT_HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
1748
+ const petChatClock = (v, fallback) => {
1749
+ const text = typeof v === 'string' ? v.trim().slice(0, 5) : '';
1750
+ return PET_CHAT_HHMM.test(text) ? text : fallback;
1751
+ };
1729
1752
 
1730
1753
  const petChatStr = (v, max) => (typeof v === 'string' ? v.slice(0, max) : '');
1731
1754
  const petChatFloat = (v, lo, hi, fallback) => {
@@ -1769,6 +1792,9 @@ export function readPetChat(raw) {
1769
1792
  const src = raw && typeof raw === 'object' && !Array.isArray(raw) ? raw : {};
1770
1793
  const persona = src.persona && typeof src.persona === 'object' && !Array.isArray(src.persona) ? src.persona : {};
1771
1794
  const wake = src.wake && typeof src.wake === 'object' && !Array.isArray(src.wake) ? src.wake : {};
1795
+ const proactive = src.proactive && typeof src.proactive === 'object' && !Array.isArray(src.proactive) ? src.proactive : {};
1796
+ const screen = src.screen && typeof src.screen === 'object' && !Array.isArray(src.screen) ? src.screen : {};
1797
+ const treehole = src.treehole && typeof src.treehole === 'object' && !Array.isArray(src.treehole) ? src.treehole : {};
1772
1798
  const baseUrl = petChatStr(src.baseUrl, PET_CHAT_BASE_URL_MAX).trim();
1773
1799
  return {
1774
1800
  enabled: src.enabled === true,
@@ -1786,6 +1812,25 @@ export function readPetChat(raw) {
1786
1812
  name: wake.name === true,
1787
1813
  keyword: petChatStr(wake.keyword, 40).trim(),
1788
1814
  },
1815
+ // v1.2:认不出的模式 / 长度 / 间隔一律回落默认(不猜近似值)
1816
+ conversationMode: PET_CHAT_CONVERSATION_MODES.includes(src.conversationMode) ? src.conversationMode : def.conversationMode,
1817
+ voiceLength: PET_CHAT_VOICE_LENGTHS.includes(Number(src.voiceLength)) ? Number(src.voiceLength) : def.voiceLength,
1818
+ proactive: {
1819
+ enabled: proactive.enabled === true,
1820
+ intervalMin: PET_CHAT_PROACTIVE_INTERVALS.includes(Number(proactive.intervalMin))
1821
+ ? Number(proactive.intervalMin) : def.proactive.intervalMin,
1822
+ quietFrom: petChatClock(proactive.quietFrom, def.proactive.quietFrom),
1823
+ quietTo: petChatClock(proactive.quietTo, def.proactive.quietTo),
1824
+ },
1825
+ screen: {
1826
+ mode: PET_CHAT_SCREEN_MODES.includes(screen.mode) ? screen.mode : def.screen.mode,
1827
+ // 二次确认是**一次性**授权:只有旧值为 confirm 过且 mode 仍非 off 才算数;
1828
+ // 单独把 confirmed 置 true 但没有 mode 也不生效(读的时候按 mode 判定,见路由)。
1829
+ confirmed: screen.confirmed === true,
1830
+ },
1831
+ treehole: {
1832
+ hotline: petChatStr(treehole.hotline, 40).trim() || def.treehole.hotline,
1833
+ },
1789
1834
  // 记忆常开:设置里没有这个开关(追加决定 1),旧档里的 false 也不再尊重
1790
1835
  memoryEnabled: true,
1791
1836
  };
package/lib/tts/tts.js CHANGED
@@ -65,9 +65,112 @@ export function ttsCacheKey(engine, voice, rate, text) {
65
65
 
66
66
  const WORKER_FILE = fileURLToPath(new URL('./tts-worker.cjs', import.meta.url));
67
67
 
68
+ /* ── 朗读文本清洗(需求八 / v1.2)──────────────────────────────────────────
69
+ * **显示文本与朗读文本分离**:气泡保留完整标点/Markdown/emoji;合成器只拿
70
+ * `sanitizeForSpeech()` 的输出。为什么必须在这里做:各引擎对 `*` `#` `【】` `…`
71
+ * 的处理不一致,有的直接念出符号名、有的把 Markdown 链接读成一串 URL。
72
+ * 规则与任务书 §11 一一对应(顺序有讲究:先块级结构,再链接,再符号)。
73
+ */
74
+
75
+ /** emoji / 装饰符号(含变体选择符与零宽连接符)。 */
76
+ const SPEECH_EMOJI_RE = /[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}\u{2B00}-\u{2BFF}\u{FE0F}\u{200D}\u{20E3}\u{E0020}-\u{E007F}]/gu;
77
+ /** 纯装饰字符(• · → ★ ♪ 等;不承载语义)。 */
78
+ const SPEECH_DECOR_RE = /[•·●○◆◇■□→←↑↓★☆♪♫♬✦✧✿❀☀☁♥♡]/g;
79
+ /** 句读标点 → 空格(数字里的 . , : 在保护之后处理,不受影响)。 */
80
+ const SPEECH_PUNCT_RE = /[,。!?;:、…—–~,.!?;:"'`~#]/g;
81
+ /** 括号类:只去括号本身,括号内文字保留(任务书原文)。 */
82
+ const SPEECH_BRACKET_RE = /[【】\[\]{}<>《》「」『』()()]/g;
83
+
84
+ /**
85
+ * 把数字里的 `.` `,` `:` 先换成占位符,清洗完再还原。
86
+ * 保护三类:时间 10:30(:15)、千分位 1,000,000、小数/版本 3.14 / 1.2.0。
87
+ * 顺序:时间 → 千分位 → 小数(时间必须先抢,否则 10:30 的冒号会被当标点)。
88
+ */
89
+ function protectSpeechNumbers(text) {
90
+ const saved = [];
91
+ const keep = (match) => {
92
+ saved.push(match);
93
+ return '\u0001' + (saved.length - 1) + '\u0001';
94
+ };
95
+ const masked = text
96
+ .replace(/\b\d{1,2}:\d{2}(?::\d{2})?\b/g, keep)
97
+ .replace(/\b\d{1,3}(?:,\d{3})+\b/g, keep)
98
+ .replace(/\b\d+(?:\.\d+)+\b/g, keep);
99
+ return {
100
+ text: masked,
101
+ restore: (value) => value.replace(/\u0001(\d+)\u0001/g, (_, index) => saved[Number(index)] || ''),
102
+ };
103
+ }
104
+
105
+ /**
106
+ * 朗读清洗(纯函数,路由与缓存键共用)。
107
+ *
108
+ * @param {string} text 气泡里的**原始**文本
109
+ * @param {{maxChars?:number}} [options] maxChars=0 ⇒ 不截断(故事分批时由调用方自己控制)
110
+ * @returns {string} 可直接交给合成器的文本(已折叠空白;空串表示「不要合成」)
111
+ */
112
+ export function sanitizeForSpeech(text, options = {}) {
113
+ let value = String(text == null ? '' : text);
114
+ if (!value.trim()) return '';
115
+
116
+ // ① 代码块 → 「一段代码」(未闭合的代码块也按到结尾处理,避免把代码念出来)
117
+ value = value.replace(/```[\s\S]*?(?:```|$)/g, ' 一段代码 ');
118
+ // ② 行内代码:去反引号、保留内容
119
+ value = value.replace(/`([^`]*)`/g, ' $1 ');
120
+ // ③ 图片 → alt(没有 alt 就读「图片」)
121
+ value = value.replace(/!\[([^\]]*)\]\([^)]*\)/g, (_, alt) => (String(alt).trim() ? ' ' + alt + ' ' : ' 图片 '));
122
+ // ④ 链接 [文字](url) → 只读文字;没有文字读「链接」
123
+ value = value.replace(/\[([^\]]*)\]\([^)]*\)/g, (_, label) => (String(label).trim() ? ' ' + label + ' ' : ' 链接 '));
124
+ value = value.replace(/<((?:https?|mailto):[^>]*)>/gi, ' 链接 ');
125
+ // ⑤ HTML 标签(<br> / <b>)不念
126
+ value = value.replace(/<\/?[a-zA-Z][^>]{0,80}>/g, ' ');
127
+ // ⑥ 裸 URL → 「链接」;邮箱 → 「邮箱」
128
+ value = value.replace(/https?:\/\/[^\s<>"')),。!?;、]+/gi, ' 链接 ');
129
+ value = value.replace(/\b[\w.+-]+@[\w-]+\.[\w.-]+\b/g, ' 邮箱 ');
130
+ // ⑦ Markdown 块级标记:标题 # / 引用 > / 列表 - 1.
131
+ value = value.replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm, '');
132
+ value = value.replace(/^[ \t]*>[ \t]?/gm, '');
133
+ value = value.replace(/^[ \t]*(?:[-+*]|\d+[.)])[ \t]+/gm, '');
134
+ // ⑧ 强调/表格/分隔线符号
135
+ value = value.replace(/[|*_]/g, ' ');
136
+
137
+ // ⑨ 数字保护(时间/千分位/小数),再统一去标点
138
+ const numbers = protectSpeechNumbers(value);
139
+ value = numbers.text
140
+ .replace(SPEECH_BRACKET_RE, ' ')
141
+ .replace(SPEECH_EMOJI_RE, ' ')
142
+ .replace(SPEECH_DECOR_RE, ' ')
143
+ .replace(/[—–\-]/g, ' ')
144
+ .replace(SPEECH_PUNCT_RE, ' ');
145
+ value = numbers.restore(value);
146
+
147
+ // ⑩ 折叠空白;按上限截断(0 = 不截断)
148
+ value = value.replace(/\s+/g, ' ').trim();
149
+ const limit = options.maxChars === 0 ? 0 : Math.max(1, Number(options.maxChars) || TTS_MAX_CHARS);
150
+ if (limit && [...value].length > limit) value = [...value].slice(0, limit).join('').trim();
151
+ return value;
152
+ }
153
+
154
+ /**
155
+ * 唱歌歌词清洗:**只**去 Markdown/URL/代码块,保留标点与歌词文字(任务书 §11④)。
156
+ * 歌词是"唱"的,不能像朗读那样把句读全删掉(那会破坏断句与押韵)。
157
+ */
158
+ export function sanitizeLyrics(text) {
159
+ let value = String(text == null ? '' : text);
160
+ if (!value.trim()) return '';
161
+ value = value.replace(/```[\s\S]*?(?:```|$)/g, ' ');
162
+ value = value.replace(/`([^`]*)`/g, '$1');
163
+ value = value.replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1');
164
+ value = value.replace(/\[([^\]]*)\]\([^)]*\)/g, '$1');
165
+ value = value.replace(/https?:\/\/[^\s<>"')),。!?;、]+/gi, ' ');
166
+ value = value.replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm, '');
167
+ value = value.replace(/[|*_#>]/g, ' ');
168
+ return value.replace(/\s+/g, ' ').trim();
169
+ }
170
+
68
171
  /** 去掉控制字符、折叠空白;超过上限截断(路由已先做一次,这里是兜底)。 */
69
172
  export function normalizeTtsText(text) {
70
- return String(text == null ? '' : text)
173
+ return sanitizeForSpeech(text, { maxChars: TTS_MAX_CHARS })
71
174
  .replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g, '')
72
175
  .replace(/\s+/g, ' ')
73
176
  .trim()
@@ -0,0 +1,196 @@
1
+ /**
2
+ * tts/voice-pack.js — 用户音色包导入(v1.2 需求九)+ 4 个内置系统音效。
3
+ *
4
+ * 授权边界(写进代码也写进界面提示):
5
+ * · 本仓库**不携带任何角色语音/声优素材**(不复制 Shinsekai,也不内置社区包);
6
+ * · 角色音色只能由用户「下载 / 本地导入」,导入时必须填 license + 作者/来源;
7
+ * · 内置的只有 **4 个系统音效**(本项目用代码合成的提示音,MIT,可再分发)。
8
+ *
9
+ * voice pack 格式(任务书 §10):
10
+ * { id, name, engine, refAudio, refText, model?, license, author, sha256 }
11
+ * · engine:'gpt-sovits' | 'http' | 'piper-ref'(都是「用户自带服务/模型」)
12
+ * · refAudio 是**本地文件路径**(用户自己拥有权利);导入时复制到
13
+ * `<DSH_FOLIA_HOME>/voices/packs/<id>/ref.wav`,原文件不动。
14
+ * · sha256 校验参考音频(不给就现算并回填)。
15
+ *
16
+ * 存储在用户目录,**不进 npm 包、不上传**;删除包 = 删这个目录。
17
+ */
18
+ import { createHash } from 'node:crypto';
19
+ import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
20
+ import { homedir } from 'node:os';
21
+ import { join } from 'node:path';
22
+
23
+ /** 内置系统音效:4 个,代码合成、MIT,不涉及角色/声优版权。 */
24
+ export const SYSTEM_SOUNDS = Object.freeze([
25
+ { id: 'system-ding', name: '提示', file: 'ding.wav', desc: '一条提醒/消息落地的轻提示音', license: 'MIT(本仓库合成)', author: 'dsh-folia', licenseUrl: '' },
26
+ { id: 'system-ok', name: '完成', file: 'ok.wav', desc: '任务/安装完成的确认音', license: 'MIT(本仓库合成)', author: 'dsh-folia', licenseUrl: '' },
27
+ { id: 'system-warn', name: '提醒', file: 'warn.wav', desc: '失败/需要注意的短提示', license: 'MIT(本仓库合成)', author: 'dsh-folia', licenseUrl: '' },
28
+ { id: 'system-tap', name: '轻触', file: 'tap.wav', desc: '点桌宠/切换动作的触感音', license: 'MIT(本仓库合成)', author: 'dsh-folia', licenseUrl: '' },
29
+ ]);
30
+
31
+ const SOUND_DIR = new URL('../../assets/system/sound/', import.meta.url);
32
+
33
+ export function systemSoundPath(id) {
34
+ const sound = SYSTEM_SOUNDS.find((item) => item.id === String(id || ''));
35
+ if (!sound) return '';
36
+ try { return new URL(sound.file, SOUND_DIR).pathname.replace(/^\/([A-Za-z]:)/, '$1'); } catch { return ''; }
37
+ }
38
+
39
+ export function listSystemSounds() {
40
+ return SYSTEM_SOUNDS.map((sound) => ({
41
+ ...sound,
42
+ bundled: true,
43
+ path: '',
44
+ exists: (() => { try { return existsSync(systemSoundPath(sound.id)); } catch { return false; } })(),
45
+ }));
46
+ }
47
+
48
+ /** 用户音色包根目录。 */
49
+ export function voicePacksDir() {
50
+ const home = process.env.DSH_FOLIA_HOME || join(homedir(), '.dsh-folia');
51
+ return join(home, 'voices', 'packs');
52
+ }
53
+
54
+ export const VOICE_PACK_ENGINES = Object.freeze(['gpt-sovits', 'http', 'piper-ref']);
55
+ const ID_RE = /^vp_[a-z0-9]{4,40}$/;
56
+ const MAX_REF_BYTES = 8 * 1024 * 1024;
57
+
58
+ const clip = (value, max) => {
59
+ const chars = [...String(value == null ? '' : value)];
60
+ return chars.length > max ? chars.slice(0, max).join('') : chars.join('');
61
+ };
62
+
63
+ function sha256(buffer) {
64
+ return createHash('sha256').update(buffer).digest('hex');
65
+ }
66
+
67
+ /** 读一个包的 meta(readdir 用)。 */
68
+ function readMeta(dir) {
69
+ try {
70
+ const doc = JSON.parse(readFileSync(join(dir, 'pack.json'), 'utf8'));
71
+ if (!doc || typeof doc !== 'object') return null;
72
+ if (!ID_RE.test(String(doc.id || ''))) return null;
73
+ return {
74
+ id: String(doc.id),
75
+ name: clip(doc.name, 60),
76
+ engine: VOICE_PACK_ENGINES.includes(doc.engine) ? doc.engine : 'gpt-sovits',
77
+ refText: clip(doc.refText, 500),
78
+ model: clip(doc.model, 200),
79
+ license: clip(doc.license, 200),
80
+ author: clip(doc.author, 120),
81
+ source: clip(doc.source, 200),
82
+ sha256: String(doc.sha256 || ''),
83
+ serviceUrl: clip(doc.serviceUrl, 300),
84
+ refAudio: String(doc.refAudio || ''),
85
+ importedAt: Number(doc.importedAt) || 0,
86
+ bytes: Number(doc.bytes) || 0,
87
+ };
88
+ } catch {
89
+ return null;
90
+ }
91
+ }
92
+
93
+ /** 已导入的用户音色包(不含本机绝对路径)。 */
94
+ export function listUserVoicePacks() {
95
+ const root = voicePacksDir();
96
+ if (!existsSync(root)) return [];
97
+ const out = [];
98
+ for (const name of readdirSync(root, { withFileTypes: true })) {
99
+ if (!name.isDirectory()) continue;
100
+ const meta = readMeta(join(root, name.name));
101
+ if (!meta) continue;
102
+ out.push({
103
+ ...meta,
104
+ refAudio: meta.refAudio ? meta.refAudio.replace(/^.*[\\/]/, '') : '',
105
+ installed: existsSync(join(root, name.name, 'ref.wav')),
106
+ dir: '',
107
+ });
108
+ }
109
+ return out.sort((a, b) => b.importedAt - a.importedAt);
110
+ }
111
+
112
+ /** 校验并导入一个 voice pack。 */
113
+ export function importVoicePack(input = {}, options = {}) {
114
+ const root = options.dir || voicePacksDir();
115
+ const name = clip(String(input.name || '').trim(), 60);
116
+ const engine = String(input.engine || 'gpt-sovits');
117
+ const license = clip(String(input.license || '').trim(), 200);
118
+ const author = clip(String(input.author || input.source || '').trim(), 120);
119
+ const refText = clip(String(input.refText || '').trim(), 500);
120
+ const model = clip(String(input.model || '').trim(), 200);
121
+ const serviceUrl = clip(String(input.serviceUrl || '').trim(), 300);
122
+
123
+ // 授权是硬门槛:没有 license / 作者(或来源),一律拒绝 —— 不替用户承担版权风险。
124
+ if (!name) return { ok: false, error: 'missing-name', hint: '音色包需要一个名字' };
125
+ if (!VOICE_PACK_ENGINES.includes(engine)) {
126
+ return { ok: false, error: 'bad-engine', hint: '只支持用户自带的 gpt-sovits / http / piper-ref' };
127
+ }
128
+ if (!license) return { ok: false, error: 'missing-license', hint: '必须填写素材许可证(例如「本人录制,仅自用」)' };
129
+ if (!author) return { ok: false, error: 'missing-author', hint: '必须填写作者/来源,便于追溯授权' };
130
+ if (serviceUrl && !/^https?:\/\//i.test(serviceUrl)) {
131
+ return { ok: false, error: 'bad-service-url', hint: 'GPT-SoVITS 服务地址必须是 http(s)://' };
132
+ }
133
+
134
+ let audio = null;
135
+ if (typeof input.audioBase64 === 'string' && input.audioBase64) {
136
+ try { audio = Buffer.from(input.audioBase64.replace(/^data:[^;]+;base64,/, ''), 'base64'); } catch { audio = null; }
137
+ } else if (typeof input.refAudioPath === 'string' && input.refAudioPath) {
138
+ try {
139
+ const stat = statSync(input.refAudioPath);
140
+ if (stat.size > MAX_REF_BYTES) return { ok: false, error: 'ref-too-large', hint: '参考音频最大 8MB' };
141
+ audio = readFileSync(input.refAudioPath);
142
+ } catch { audio = null; }
143
+ }
144
+ if (!audio || !audio.length) {
145
+ return { ok: false, error: 'missing-ref-audio', hint: '需要一个参考音频(wav/mp3,用户自己拥有权利)' };
146
+ }
147
+ if (audio.length > MAX_REF_BYTES) return { ok: false, error: 'ref-too-large', hint: '参考音频最大 8MB' };
148
+ const digest = sha256(audio);
149
+ if (input.sha256 && String(input.sha256).toLowerCase() !== digest) {
150
+ return { ok: false, error: 'sha256-mismatch', hint: '参考音频的 sha256 与声明不一致' };
151
+ }
152
+
153
+ const id = 'vp_' + digest.slice(0, 12);
154
+ const dir = join(root, id);
155
+ if (existsSync(join(dir, 'pack.json'))) {
156
+ return { ok: false, error: 'already-imported', hint: '这个音色包已经导入过', id };
157
+ }
158
+ mkdirSync(dir, { recursive: true });
159
+ writeFileSync(join(dir, 'ref.wav'), audio);
160
+ const meta = {
161
+ id, name, engine, refAudio: 'ref.wav', refText, model, license, author,
162
+ source: clip(String(input.source || author), 200), sha256: digest,
163
+ serviceUrl, importedAt: Date.now(), bytes: audio.length,
164
+ // 明确记录“这是用户导入的素材,不是本仓库随包分发”
165
+ origin: 'user-import',
166
+ };
167
+ writeFileSync(join(dir, 'pack.json'), JSON.stringify(meta, null, 2));
168
+ return { ok: true, pack: { ...meta, installed: true } };
169
+ }
170
+
171
+ export function removeUserVoicePack(id) {
172
+ const clean = String(id || '');
173
+ if (!ID_RE.test(clean)) return { ok: false, error: 'bad-id' };
174
+ const dir = join(voicePacksDir(), clean);
175
+ if (!existsSync(dir)) return { ok: false, error: 'not-found' };
176
+ try { rmSync(dir, { recursive: true, force: true }); } catch { return { ok: false, error: 'remove-failed' }; }
177
+ return { ok: true, id: clean };
178
+ }
179
+
180
+ /** 汇总:内置 4 个音效 + 用户导入包(供设置页展示授权/来源)。 */
181
+ export function voicePackSummary() {
182
+ const user = listUserVoicePacks();
183
+ return {
184
+ ok: true,
185
+ builtinSounds: listSystemSounds(),
186
+ builtinCount: SYSTEM_SOUNDS.length,
187
+ userPacks: user,
188
+ userCount: user.length,
189
+ // 明确口径:角色语音不走内置
190
+ policy: {
191
+ builtinSoundsOnly: true,
192
+ characterVoices: 'user-download-or-import',
193
+ note: '本仓库只内置 4 个系统音效;角色音色须由用户下载/导入,并自带 license 与来源。',
194
+ },
195
+ };
196
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-folia",
3
3
  "displayName": "dshAI · 壁纸引擎与 AI 桌宠",
4
- "version": "1.0.1",
4
+ "version": "1.2.0",
5
5
  "description": "dshAI:壁纸引擎 + AI 桌宠语音助手 + 多人设角色卡 + 皮肤/开机动画 + 能力市场,一站式桌面伴侣。",
6
6
  "type": "module",
7
7
  "engines": {
@@ -50,6 +50,9 @@
50
50
  "lib/persona-card.js",
51
51
  "lib/persona-growth.js",
52
52
  "lib/persona-memory.js",
53
+ "lib/memory-db.js",
54
+ "lib/pet-chat-mind.js",
55
+ "lib/desktop-context.js",
53
56
  "lib/persona-store.js",
54
57
  "lib/persona-tool-log.js",
55
58
  "lib/persona-doc.js",
@@ -99,6 +102,7 @@
99
102
  "lib/media-origin.js",
100
103
  "lib/capabilities-catalog.js",
101
104
  "lib/capabilities-curated.js",
105
+ "lib/curated-personal.js",
102
106
  "lib/inventory.js",
103
107
  "lib/serve.js",
104
108
  "lib/faststart.js",
@@ -124,6 +128,7 @@
124
128
  "README.en.md",
125
129
  "README.beginner.md",
126
130
  "lib/components/",
131
+ "assets/system/sound/",
127
132
  "lib/features.js",
128
133
  "lib/route-registry.js",
129
134
  "lib/settings/",