dsh-plugin-cyrene-live2d 0.2.9 → 0.3.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 +8 -2
- package/assets/default-prefs.json +8 -8
- package/assets/icon.svg +89 -89
- package/assets/locale/notes/en.json +6 -6
- package/assets/locale/notes/zh-CN.json +6 -6
- package/assets/locale/reminder/en.json +6 -6
- package/assets/locale/reminder/zh-CN.json +6 -6
- package/assets/model/Cyrene.model3.json +441 -441
- package/assets/model/bongo-standard/Live2d_expression0.exp3.json +9 -9
- package/assets/model/bongo-standard/cat.cdi3.json +296 -296
- package/assets/model/bongo-standard/cat.model3.json +33 -33
- package/assets/model/bongo-standard/cat.physics3.json +232 -232
- package/assets/model/expressions/0.exp3.json +24 -24
- package/assets/model/expressions/1.exp3.json +11 -11
- package/assets/model/expressions/10.exp3.json +9 -9
- package/assets/model/expressions/11.exp3.json +9 -9
- package/assets/model/expressions/2.exp3.json +9 -9
- package/assets/model/expressions/3.exp3.json +9 -9
- package/assets/model/expressions/4.exp3.json +11 -11
- package/assets/model/expressions/5.exp3.json +11 -11
- package/assets/model/expressions/6.exp3.json +11 -11
- package/assets/model/expressions/7.exp3.json +11 -11
- package/assets/model/expressions/8.exp3.json +11 -11
- package/assets/model/expressions/9.exp3.json +9 -9
- package/assets/model/model.physics3.json +641 -641
- package/assets/model/motions/Tick3_3.motion3.json +1347 -1347
- package/assets/model/motions//345/212/250/344/275/2346_0.motion3.json +699 -699
- package/assets/model/motions//345/212/250/344/275/2346_1.motion3.json +1241 -1241
- package/assets/model/motions//345/212/250/344/275/2346_2.motion3.json +1117 -1117
- package/assets/model/motions//345/212/250/344/275/2346_3.motion3.json +1106 -1106
- package/assets/model/we-q/expressions/FileReferences_Expressions_0_File_0.exp3.json +19 -19
- package/assets/model/we-q/expressions/FileReferences_Expressions_1_File_0.exp3.json +41 -41
- package/assets/model/we-q/expressions/FileReferences_Expressions_2_File_0.exp3.json +104 -104
- package/assets/model/we-q/model0.model3.json +245 -245
- package/assets/model/we-q/motions/FileReferences_Motions_shake#1_0_File_0.motion3.json +520 -520
- package/assets/model/we-q/motions/FileReferences_Motions_talk#1_0_File_0.motion3.json +499 -499
- package/assets/model/we-q/motions/FileReferences_Motions_talk#1_1_File_0.motion3.json +453 -453
- package/assets/model/we-q/motions/FileReferences_Motions_wink#1_0_File_0.motion3.json +478 -478
- package/assets/model/we-q/motions/FileReferences_Motions_/346/212/254/346/211/213_0_File_0.motion3.json +450 -450
- package/assets/model/we-q/motions/FileReferences_Motions_/346/212/254/346/211/213_1_File_0.motion3.json +450 -450
- package/assets/model/we-q/motions/idle/FileReferences_Motions_Idleidle_0_File_0.motion3.json +422 -422
- package/assets/model/we-q/physics/FileReferences_Physics_0.physic3.json +236 -236
- package/assets/runtime/live2dcubismcore.min.js +8 -8
- package/assets/stickers.json +84 -84
- package/assets/vendor/cubism4.min.js +1 -1
- package/assets/vendor/pixi.min.js +9 -9
- package/assets/vendor/theme-cyrene-factory.js +4314 -4314
- package/assets/vendor/theme-cyrene.js +4317 -4317
- package/assets/voice/angry-00.opus +0 -0
- package/assets/voice/angry-02.opus +0 -0
- package/assets/voice/approval-00.opus +0 -0
- package/assets/voice/approval-01.opus +0 -0
- package/assets/voice/approval-02.opus +0 -0
- package/assets/voice/askAck-00.opus +0 -0
- package/assets/voice/away-01.opus +0 -0
- package/assets/voice/away-02.opus +0 -0
- package/assets/voice/away-03.opus +0 -0
- package/assets/voice/away-05.opus +0 -0
- package/assets/voice/back-00.opus +0 -0
- package/assets/voice/back-01.opus +0 -0
- package/assets/voice/backLong-05.opus +0 -0
- package/assets/voice/backShort-03.opus +0 -0
- package/assets/voice/backShort-04.opus +0 -0
- package/assets/voice/backShort-07.opus +0 -0
- package/assets/voice/backVeryLong-01.opus +0 -0
- package/assets/voice/backVeryLong-02.opus +0 -0
- package/assets/voice/backVeryLong-03.opus +0 -0
- package/assets/voice/backVeryLong-04.opus +0 -0
- package/assets/voice/backVeryLong-05.opus +0 -0
- package/assets/voice/backVeryLong-07.opus +0 -0
- package/assets/voice/backVeryLong-08.opus +0 -0
- package/assets/voice/balLow-00.opus +0 -0
- package/assets/voice/balLow-01.opus +0 -0
- package/assets/voice/birthday-02.opus +0 -0
- package/assets/voice/click-00.opus +0 -0
- package/assets/voice/click-01.opus +0 -0
- package/assets/voice/click-07.opus +0 -0
- package/assets/voice/click-10.opus +0 -0
- package/assets/voice/click-11.opus +0 -0
- package/assets/voice/click-12.opus +0 -0
- package/assets/voice/click-16.opus +0 -0
- package/assets/voice/click-17.opus +0 -0
- package/assets/voice/click-18.opus +0 -0
- package/assets/voice/comfort-03.opus +0 -0
- package/assets/voice/comfort-04.opus +0 -0
- package/assets/voice/cost10-00.opus +0 -0
- package/assets/voice/cost2-00.opus +0 -0
- package/assets/voice/cost5-00.opus +0 -0
- package/assets/voice/costTurn-01.opus +0 -0
- package/assets/voice/costTurn-02.opus +0 -0
- package/assets/voice/ctxFull-01.opus +0 -0
- package/assets/voice/ctxHigh-00.opus +0 -0
- package/assets/voice/dawn-01.opus +0 -0
- package/assets/voice/dawn-04.opus +0 -0
- package/assets/voice/dawn-06.opus +0 -0
- package/assets/voice/dawn-07.opus +0 -0
- package/assets/voice/deepWake-03.opus +0 -0
- package/assets/voice/deepWake-04.opus +0 -0
- package/assets/voice/deepWake-06.opus +0 -0
- package/assets/voice/deepWake-07.opus +0 -0
- package/assets/voice/done-05.opus +0 -0
- package/assets/voice/done-08.opus +0 -0
- package/assets/voice/done-09.opus +0 -0
- package/assets/voice/done-11.opus +0 -0
- package/assets/voice/empty-00.opus +0 -0
- package/assets/voice/encourage-02.opus +0 -0
- package/assets/voice/failed-01.opus +0 -0
- package/assets/voice/failed-05.opus +0 -0
- package/assets/voice/failkind-auth-01.opus +0 -0
- package/assets/voice/failkind-auth-02.opus +0 -0
- package/assets/voice/failkind-ctx-00.opus +0 -0
- package/assets/voice/failkind-missing-01.opus +0 -0
- package/assets/voice/focusEnd-02.opus +0 -0
- package/assets/voice/focusEnd-04.opus +0 -0
- package/assets/voice/forgive-00.opus +0 -0
- package/assets/voice/hello-00.opus +0 -0
- package/assets/voice/hello-03.opus +0 -0
- package/assets/voice/hold-00.opus +0 -0
- package/assets/voice/idleTap-00.opus +0 -0
- package/assets/voice/idleTapLong-02.opus +0 -0
- package/assets/voice/lateNight-00.opus +0 -0
- package/assets/voice/lateNight-02.opus +0 -0
- package/assets/voice/lateNight-03.opus +0 -0
- package/assets/voice/lateNight-06.opus +0 -0
- package/assets/voice/lateNight-07.opus +0 -0
- package/assets/voice/murmur-04.opus +0 -0
- package/assets/voice/night-01.opus +0 -0
- package/assets/voice/night-03.opus +0 -0
- package/assets/voice/night-05.opus +0 -0
- package/assets/voice/noon-04.opus +0 -0
- package/assets/voice/petArm-02.opus +0 -0
- package/assets/voice/petCheek-00.opus +0 -0
- package/assets/voice/petCheek-01.opus +0 -0
- package/assets/voice/petCheek-02.opus +0 -0
- package/assets/voice/petHead-01.opus +0 -0
- package/assets/voice/petHead-03.opus +0 -0
- package/assets/voice/petHead-04.opus +0 -0
- package/assets/voice/praised-01.opus +0 -0
- package/assets/voice/praised-03.opus +0 -0
- package/assets/voice/question-00.opus +0 -0
- package/assets/voice/question-03.opus +0 -0
- package/assets/voice/question-04.opus +0 -0
- package/assets/voice/question-06.opus +0 -0
- package/assets/voice/shy-00.opus +0 -0
- package/assets/voice/spot-0-0.opus +0 -0
- package/assets/voice/spot-0-1.opus +0 -0
- package/assets/voice/spot-0-2.opus +0 -0
- package/assets/voice/spot-3-0.opus +0 -0
- package/assets/voice/spot-4-0.opus +0 -0
- package/assets/voice/spot-4-2.opus +0 -0
- package/assets/voice/spot-5-2.opus +0 -0
- package/assets/voice/spot-6-0.opus +0 -0
- package/assets/voice/spot-6-1.opus +0 -0
- package/assets/voice/spot-7-0.opus +0 -0
- package/assets/voice/spot-7-2.opus +0 -0
- package/assets/voice/spot-8-1.opus +0 -0
- package/assets/voice/tagent-00.opus +0 -0
- package/assets/voice/thinkFast-01.opus +0 -0
- package/assets/voice/thinkFast-02.opus +0 -0
- package/assets/voice/thinkFast-03.opus +0 -0
- package/assets/voice/thinkSlow-01.opus +0 -0
- package/assets/voice/thinkSlow-03.opus +0 -0
- package/assets/voice/thinking-01.opus +0 -0
- package/assets/voice/thinking-02.opus +0 -0
- package/assets/voice/thinking-03.opus +0 -0
- package/assets/voice/thinking-09.opus +0 -0
- package/assets/voice/tread-00.opus +0 -0
- package/assets/voice/tread-01.opus +0 -0
- package/assets/voice/trun-02.opus +0 -0
- package/assets/voice/tsun-00.opus +0 -0
- package/assets/voice/tsun-01.opus +0 -0
- package/assets/voice/tsun-04.opus +0 -0
- package/assets/voice/twrite-00.opus +0 -0
- package/assets/voice/unknown-01.opus +0 -0
- package/assets/voice/waitApproval-00.opus +0 -0
- package/assets/voice/waitApproval-01.opus +0 -0
- package/assets/voice/waitApproval-02.opus +0 -0
- package/assets/voice/waitApproval-03.opus +0 -0
- package/assets/voice/waitApprovalLate-02.opus +0 -0
- package/assets/voice/waitApprovalLate-03.opus +0 -0
- package/assets/voice/waitAsk-00.opus +0 -0
- package/assets/voice/waitAsk-02.opus +0 -0
- package/assets/voice/waitAskLate-03.opus +0 -0
- package/assets/voice/wake-03.opus +0 -0
- package/assets/voice/wake-04.opus +0 -0
- package/assets/voice/wake-05.opus +0 -0
- package/assets/voice/wake-06.opus +0 -0
- package/lib/client.js +7 -7
- package/lib/features/notes.js +172 -172
- package/lib/features/reminder.js +216 -216
- package/lib/l2d-plan.js +295 -295
- package/lib/l2d-tools.js +293 -293
- package/lib/ledger.js +163 -163
- package/lib/mys/config.js +183 -183
- package/lib/mys/ds.js +209 -209
- package/lib/mys/http.js +85 -85
- package/lib/mys/mys.js +419 -419
- package/lib/mys/qr.js +434 -434
- package/lib/mys/scheduler.js +206 -206
- package/lib/mys/store.js +248 -248
- package/lib/mys/tz.js +174 -174
- package/lib/wavtrim.js +245 -245
- package/lib/worldbook/NOTICE.md +18 -18
- package/lib/worldbook/data/Cyrene.md +111 -111
- package/lib/worldbook/data/_glossary.md +181 -181
- package/lib/worldbook/data/characters.md +289 -289
- package/lib/worldbook/data/story.md +130 -130
- package/lib/worldbook/data/world.md +182 -182
- package/lib/worldbook.js +189 -189
- package/package.json +72 -69
package/lib/l2d-tools.js
CHANGED
|
@@ -1,293 +1,293 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 小昔涟 · 语义动作协议 v1 · 宿主侧五个工具
|
|
3
|
-
*
|
|
4
|
-
* 借自鲸语 Jingyu 的 agent-tools.json(MIT),工具名与职责一一对应:
|
|
5
|
-
* capabilities → 先读能力目录(模型真实参数/范围/表情)
|
|
6
|
-
* compile → 只校验、不执行(失败就把错误还给模型去改一次)
|
|
7
|
-
* execute → 下发已经校验过的计划,拿 jobId
|
|
8
|
-
* state → 读回执(只有 renderer 真的播完才算 completed)
|
|
9
|
-
* stop → 平滑回待机
|
|
10
|
-
*
|
|
11
|
-
* **为什么 compile 和 execute 必须分开**:合起来就只能「先做再发现不对」,
|
|
12
|
-
* 校验的意义是让错误在花钱/花时间之前被拦下来。
|
|
13
|
-
*
|
|
14
|
-
* 数据流(不新开端口、不加常驻进程):
|
|
15
|
-
* 宿主 l2d 状态 → /api/state 的 l2d 字段 → 独立版轮询取走 → 播完 POST 回执
|
|
16
|
-
* 独立版本来就在 1.2 秒轮询 /api/state,这条通道是白搭的。
|
|
17
|
-
*/
|
|
18
|
-
import { compilePlan } from './l2d-plan.js'
|
|
19
|
-
|
|
20
|
-
const TEXT = (t) => [{ type: 'text', text: t }]
|
|
21
|
-
|
|
22
|
-
/** 计划既接受对象,也接受 JSON 字符串(模型输出 JSON 字符串更稳)。 */
|
|
23
|
-
function parsePlan(raw) {
|
|
24
|
-
if (raw && typeof raw === 'object') return raw
|
|
25
|
-
if (typeof raw === 'string') {
|
|
26
|
-
try { return JSON.parse(raw) } catch (e) {
|
|
27
|
-
return { __parseError: '计划不是合法 JSON:' + (e && e.message ? e.message : e) }
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return { __parseError: '计划必须是对象或 JSON 字符串' }
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const CAPS_TTL_MS = 15000 // 独立版 1.2s 轮询 /api/state,15s 没心跳就当它不在了
|
|
34
|
-
const PENDING_GRACE_MS = 5000
|
|
35
|
-
|
|
36
|
-
/** caps 还新鲜吗(一次性的 caps 不能代表「她还在」)。 */
|
|
37
|
-
function capsFresh(l2d) {
|
|
38
|
-
return !!(l2d.caps && Date.now() - (l2d.caps.at || 0) < CAPS_TTL_MS)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** pending 超过 ms+5s 还没回执 → 释放并记一条失败回执,否则 execute 会永远「上一段还没播完」。 */
|
|
42
|
-
function sweepPending(l2d) {
|
|
43
|
-
const p = l2d.pending
|
|
44
|
-
if (!p) return
|
|
45
|
-
if (Date.now() - (p.at || 0) > (Number(p.ms) || 0) + PENDING_GRACE_MS) {
|
|
46
|
-
l2d.result = { jobId: p.jobId, ok: false, ms: 0, at: Date.now(), timeout: true }
|
|
47
|
-
l2d.pending = null
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** 动作模板:省得模型每次现编 JSON(compile 失败率的主要来源)。 */
|
|
52
|
-
function buildTemplates(caps) {
|
|
53
|
-
const exprs = (caps && Array.isArray(caps.expressions)) ? caps.expressions : []
|
|
54
|
-
const e0 = exprs[0] || ''
|
|
55
|
-
const out = [
|
|
56
|
-
{ name: 'greet', note: '打招呼:轻点头 + 瞥一眼', plan: { version: 1, intent: '打招呼', actions: [
|
|
57
|
-
{ kind: 'nod', count: 1, at: 0, duration: 1.2 },
|
|
58
|
-
{ kind: 'look', direction: 'right', at: 0.35, duration: 1.0 },
|
|
59
|
-
] } },
|
|
60
|
-
{ name: 'think', note: '思考:看左上、停久一点', plan: { version: 1, intent: '思考', actions: [
|
|
61
|
-
{ kind: 'look', direction: 'up', at: 0, duration: 1.8 },
|
|
62
|
-
{ kind: 'nod', count: 1, at: 1.4, duration: 0.8 },
|
|
63
|
-
] } },
|
|
64
|
-
]
|
|
65
|
-
if (e0) {
|
|
66
|
-
out.push({ name: 'surprise', note: '惊讶:换表情 + 一抬头', plan: { version: 1, intent: '惊讶', actions: [
|
|
67
|
-
{ kind: 'expression', name: e0, at: 0, duration: 1.6 },
|
|
68
|
-
{ kind: 'look', direction: 'center', at: 0.1, duration: 1.2 },
|
|
69
|
-
] } })
|
|
70
|
-
}
|
|
71
|
-
return out
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function installL2DTools(toolsSvc, l2d) {
|
|
75
|
-
if (!toolsSvc || typeof toolsSvc.register !== 'function') {
|
|
76
|
-
throw new Error('tools 服务不可用')
|
|
77
|
-
}
|
|
78
|
-
const installed = []
|
|
79
|
-
|
|
80
|
-
const reg = (def) => {
|
|
81
|
-
const dispose = toolsSvc.register(def)
|
|
82
|
-
installed.push(typeof dispose === 'function' ? dispose : null)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/* 1) 能力目录 */
|
|
86
|
-
reg({
|
|
87
|
-
name: 'cyrene_l2d_capabilities',
|
|
88
|
-
description: [
|
|
89
|
-
'读取小昔涟当前模型的真实动作能力:参数名、范围、表情列表。',
|
|
90
|
-
'什么时候用:**编排任何动作之前先调这个**。动作里的参数名和表情名只能从这里取,编不出来就是执行失败。',
|
|
91
|
-
'返回 ok=false 说明独立桌面版没在运行 —— 她在页面上,但没有可驱动的舞台。',
|
|
92
|
-
].join('\n'),
|
|
93
|
-
parameters: { type: 'object', properties: {}, required: [] },
|
|
94
|
-
output: {
|
|
95
|
-
schema: {
|
|
96
|
-
type: 'object',
|
|
97
|
-
properties: {
|
|
98
|
-
ok: { type: 'boolean' },
|
|
99
|
-
model: { type: 'string' },
|
|
100
|
-
params: { type: 'integer' },
|
|
101
|
-
expressions: { type: 'array', items: { type: 'string' } },
|
|
102
|
-
templates: { type: 'array', items: { type: 'object' } },
|
|
103
|
-
hint: { type: 'string' },
|
|
104
|
-
},
|
|
105
|
-
required: ['ok', 'model', 'params', 'expressions', 'templates', 'hint'],
|
|
106
|
-
},
|
|
107
|
-
render: (_a, v) => TEXT(
|
|
108
|
-
v.ok
|
|
109
|
-
? `当前模型 ${v.model}:${v.params} 个参数,${v.expressions.length} 个表情${v.expressions.length ? '(' + v.expressions.join('、') + ')' : ''}。`
|
|
110
|
-
: v.hint
|
|
111
|
-
),
|
|
112
|
-
},
|
|
113
|
-
async execute() {
|
|
114
|
-
const caps = capsFresh(l2d) ? l2d.caps : null
|
|
115
|
-
if (!caps) {
|
|
116
|
-
return {
|
|
117
|
-
ok: false, model: '', params: 0, expressions: [], templates: [],
|
|
118
|
-
hint: '独立桌面版没在运行(15 秒内没有心跳),没有可驱动的舞台。等她在桌面上之后再编排动作。',
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
ok: true,
|
|
123
|
-
model: String(caps.model || ''),
|
|
124
|
-
params: (caps.order && caps.order.length) || Object.keys(caps.params || {}).length,
|
|
125
|
-
expressions: Array.isArray(caps.expressions) ? caps.expressions : [],
|
|
126
|
-
templates: buildTemplates(caps),
|
|
127
|
-
hint: '参数名与表情名只能取自这里;templates 里有现成的『打招呼 / 思考 / 惊讶』可直接改。编排完先用 cyrene_l2d_compile 校验。',
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
/* 2) 校验(不执行) */
|
|
133
|
-
reg({
|
|
134
|
-
name: 'cyrene_l2d_compile',
|
|
135
|
-
description: [
|
|
136
|
-
'校验一份语义动作计划:参数是否存在、范围、时长、通道冲突。**只校验,不执行**。',
|
|
137
|
-
'计划格式:{"version":1,"intent":"…","actions":[{"kind":"look","direction":"right","at":0,"duration":1.6}]}',
|
|
138
|
-
'可用 kind:look(direction: left/right/up/down/center)· nod / shake_head(count 1..4)· hold / param(param + value)· expression(name)。',
|
|
139
|
-
'校验失败就把 error 原样看去改,改完再调一次;不要跳过这一步直接 execute。',
|
|
140
|
-
].join('\n'),
|
|
141
|
-
parameters: {
|
|
142
|
-
type: 'object',
|
|
143
|
-
properties: { plan: { oneOf: [{ type: 'object' }, { type: 'string' }] } },
|
|
144
|
-
required: ['plan'],
|
|
145
|
-
},
|
|
146
|
-
output: {
|
|
147
|
-
schema: {
|
|
148
|
-
type: 'object',
|
|
149
|
-
properties: {
|
|
150
|
-
ok: { type: 'boolean' },
|
|
151
|
-
tracks: { type: 'integer' },
|
|
152
|
-
ms: { type: 'integer' },
|
|
153
|
-
warnings: { type: 'array', items: { type: 'string' } },
|
|
154
|
-
error: { type: 'string' },
|
|
155
|
-
},
|
|
156
|
-
required: ['ok', 'tracks', 'ms', 'warnings', 'error'],
|
|
157
|
-
},
|
|
158
|
-
render: (_a, v) => TEXT(
|
|
159
|
-
v.ok
|
|
160
|
-
? `校验通过:${v.tracks} 条轨道,约 ${v.ms} ms${v.warnings.length ? ';提示:' + v.warnings.join(';') : ''}。`
|
|
161
|
-
: `校验没通过:${v.error}`
|
|
162
|
-
),
|
|
163
|
-
},
|
|
164
|
-
async execute(args) {
|
|
165
|
-
const plan = parsePlan(args && args.plan)
|
|
166
|
-
if (plan.__parseError) return { ok: false, tracks: 0, ms: 0, warnings: [], error: plan.__parseError }
|
|
167
|
-
if (!capsFresh(l2d)) return { ok: false, tracks: 0, ms: 0, warnings: [], error: '独立桌面版没在运行(没有能力目录 / 心跳过期)' }
|
|
168
|
-
const r = compilePlan(plan, l2d.caps)
|
|
169
|
-
return r.ok
|
|
170
|
-
? { ok: true, tracks: r.tracks.length, ms: r.ms, warnings: r.warnings || [], error: '' }
|
|
171
|
-
: { ok: false, tracks: 0, ms: 0, warnings: [], error: r.error }
|
|
172
|
-
},
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
/* 3) 下发 */
|
|
176
|
-
reg({
|
|
177
|
-
name: 'cyrene_l2d_execute',
|
|
178
|
-
description: [
|
|
179
|
-
'把已经通过校验的动作计划下发给她执行,返回 jobId。之后用 cyrene_l2d_state 追踪。',
|
|
180
|
-
'会再校验一遍(防止计划被改动);校验不过就退回,不下发。',
|
|
181
|
-
'同一时刻只允许一个待执行任务 —— 上一段还没播完就再下发,会被拒绝。',
|
|
182
|
-
].join('\n'),
|
|
183
|
-
parameters: {
|
|
184
|
-
type: 'object',
|
|
185
|
-
properties: { plan: { oneOf: [{ type: 'object' }, { type: 'string' }] } },
|
|
186
|
-
required: ['plan'],
|
|
187
|
-
},
|
|
188
|
-
output: {
|
|
189
|
-
schema: {
|
|
190
|
-
type: 'object',
|
|
191
|
-
properties: {
|
|
192
|
-
ok: { type: 'boolean' },
|
|
193
|
-
jobId: { type: 'string' },
|
|
194
|
-
ms: { type: 'integer' },
|
|
195
|
-
error: { type: 'string' },
|
|
196
|
-
},
|
|
197
|
-
required: ['ok', 'jobId', 'ms', 'error'],
|
|
198
|
-
},
|
|
199
|
-
render: (_a, v) => TEXT(
|
|
200
|
-
v.ok ? `已下发(${v.jobId},约 ${v.ms} ms)。她在桌面上动起来之后会写回执。`
|
|
201
|
-
: `没下发:${v.error}`
|
|
202
|
-
),
|
|
203
|
-
},
|
|
204
|
-
async execute(args) {
|
|
205
|
-
const plan = parsePlan(args && args.plan)
|
|
206
|
-
if (plan.__parseError) return { ok: false, jobId: '', ms: 0, error: plan.__parseError }
|
|
207
|
-
sweepPending(l2d)
|
|
208
|
-
if (!capsFresh(l2d)) return { ok: false, jobId: '', ms: 0, error: '独立桌面版没在运行(没有能力目录 / 心跳过期)' }
|
|
209
|
-
if (l2d.pending) return { ok: false, jobId: '', ms: 0, error: '上一段还没播完,等它结束或先 stop' }
|
|
210
|
-
const r = compilePlan(plan, l2d.caps)
|
|
211
|
-
if (!r.ok) return { ok: false, jobId: '', ms: 0, error: r.error }
|
|
212
|
-
l2d.seq = (l2d.seq || 0) + 1
|
|
213
|
-
const jobId = 'j' + Date.now().toString(36) + '-' + l2d.seq
|
|
214
|
-
l2d.pending = { jobId, tracks: r.tracks, ms: r.ms, at: Date.now() }
|
|
215
|
-
return { ok: true, jobId, ms: r.ms, error: '' }
|
|
216
|
-
},
|
|
217
|
-
})
|
|
218
|
-
|
|
219
|
-
/* 4) 回执 */
|
|
220
|
-
reg({
|
|
221
|
-
name: 'cyrene_l2d_state',
|
|
222
|
-
description: [
|
|
223
|
-
'读她的动作状态与上一次的回执。',
|
|
224
|
-
'只有回执里 completed=true 才代表真的播完了;只是「已下发」不算完成 —— 别把下发当成做完。',
|
|
225
|
-
].join('\n'),
|
|
226
|
-
parameters: { type: 'object', properties: {}, required: [] },
|
|
227
|
-
output: {
|
|
228
|
-
schema: {
|
|
229
|
-
type: 'object',
|
|
230
|
-
properties: {
|
|
231
|
-
online: { type: 'boolean' },
|
|
232
|
-
playing: { type: 'boolean' },
|
|
233
|
-
jobId: { type: 'string' },
|
|
234
|
-
completed: { type: 'boolean' },
|
|
235
|
-
note: { type: 'string' },
|
|
236
|
-
},
|
|
237
|
-
required: ['online', 'playing', 'jobId', 'completed', 'note'],
|
|
238
|
-
},
|
|
239
|
-
render: (_a, v) => TEXT(v.note),
|
|
240
|
-
},
|
|
241
|
-
async execute() {
|
|
242
|
-
sweepPending(l2d)
|
|
243
|
-
const online = capsFresh(l2d)
|
|
244
|
-
const p = l2d.pending
|
|
245
|
-
const r = l2d.result
|
|
246
|
-
const note = !online
|
|
247
|
-
? '她不在桌面上(独立版没运行)。'
|
|
248
|
-
: p
|
|
249
|
-
? `正在播 ${p.jobId}(约 ${p.ms} ms)。`
|
|
250
|
-
: r
|
|
251
|
-
? `最近一次 ${r.jobId}:${r.ok ? '播完了' : '失败了'}(${r.ms} ms)。`
|
|
252
|
-
: '待机中,最近没有动作。'
|
|
253
|
-
// jobId 与 completed 必须来自同一件事:playing 时只能报「未完成」,
|
|
254
|
-
// 否则会出现 {jobId: B, completed: true, playing: true} 这种自相矛盾。
|
|
255
|
-
return {
|
|
256
|
-
online,
|
|
257
|
-
playing: !!p,
|
|
258
|
-
jobId: (p && p.jobId) || (r && r.jobId) || '',
|
|
259
|
-
completed: !p && !!(r && r.ok),
|
|
260
|
-
note,
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
})
|
|
264
|
-
|
|
265
|
-
/* 5) 停止 */
|
|
266
|
-
reg({
|
|
267
|
-
name: 'cyrene_l2d_stop',
|
|
268
|
-
description: '让她停止当前动作、平滑回待机。',
|
|
269
|
-
parameters: { type: 'object', properties: {}, required: [] },
|
|
270
|
-
output: {
|
|
271
|
-
schema: {
|
|
272
|
-
type: 'object',
|
|
273
|
-
properties: { ok: { type: 'boolean' }, note: { type: 'string' } },
|
|
274
|
-
required: ['ok', 'note'],
|
|
275
|
-
},
|
|
276
|
-
render: (_a, v) => TEXT(v.note),
|
|
277
|
-
},
|
|
278
|
-
async execute() {
|
|
279
|
-
if (!l2d.pending) return { ok: false, note: '她本来就是待机状态。' }
|
|
280
|
-
l2d.pending = null
|
|
281
|
-
return { ok: true, note: '已停下,回待机。' }
|
|
282
|
-
},
|
|
283
|
-
})
|
|
284
|
-
|
|
285
|
-
return {
|
|
286
|
-
dispose() {
|
|
287
|
-
for (const d of installed) {
|
|
288
|
-
try { d && d() } catch {}
|
|
289
|
-
}
|
|
290
|
-
installed.length = 0
|
|
291
|
-
},
|
|
292
|
-
}
|
|
293
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 小昔涟 · 语义动作协议 v1 · 宿主侧五个工具
|
|
3
|
+
*
|
|
4
|
+
* 借自鲸语 Jingyu 的 agent-tools.json(MIT),工具名与职责一一对应:
|
|
5
|
+
* capabilities → 先读能力目录(模型真实参数/范围/表情)
|
|
6
|
+
* compile → 只校验、不执行(失败就把错误还给模型去改一次)
|
|
7
|
+
* execute → 下发已经校验过的计划,拿 jobId
|
|
8
|
+
* state → 读回执(只有 renderer 真的播完才算 completed)
|
|
9
|
+
* stop → 平滑回待机
|
|
10
|
+
*
|
|
11
|
+
* **为什么 compile 和 execute 必须分开**:合起来就只能「先做再发现不对」,
|
|
12
|
+
* 校验的意义是让错误在花钱/花时间之前被拦下来。
|
|
13
|
+
*
|
|
14
|
+
* 数据流(不新开端口、不加常驻进程):
|
|
15
|
+
* 宿主 l2d 状态 → /api/state 的 l2d 字段 → 独立版轮询取走 → 播完 POST 回执
|
|
16
|
+
* 独立版本来就在 1.2 秒轮询 /api/state,这条通道是白搭的。
|
|
17
|
+
*/
|
|
18
|
+
import { compilePlan } from './l2d-plan.js'
|
|
19
|
+
|
|
20
|
+
const TEXT = (t) => [{ type: 'text', text: t }]
|
|
21
|
+
|
|
22
|
+
/** 计划既接受对象,也接受 JSON 字符串(模型输出 JSON 字符串更稳)。 */
|
|
23
|
+
function parsePlan(raw) {
|
|
24
|
+
if (raw && typeof raw === 'object') return raw
|
|
25
|
+
if (typeof raw === 'string') {
|
|
26
|
+
try { return JSON.parse(raw) } catch (e) {
|
|
27
|
+
return { __parseError: '计划不是合法 JSON:' + (e && e.message ? e.message : e) }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return { __parseError: '计划必须是对象或 JSON 字符串' }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const CAPS_TTL_MS = 15000 // 独立版 1.2s 轮询 /api/state,15s 没心跳就当它不在了
|
|
34
|
+
const PENDING_GRACE_MS = 5000
|
|
35
|
+
|
|
36
|
+
/** caps 还新鲜吗(一次性的 caps 不能代表「她还在」)。 */
|
|
37
|
+
function capsFresh(l2d) {
|
|
38
|
+
return !!(l2d.caps && Date.now() - (l2d.caps.at || 0) < CAPS_TTL_MS)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** pending 超过 ms+5s 还没回执 → 释放并记一条失败回执,否则 execute 会永远「上一段还没播完」。 */
|
|
42
|
+
function sweepPending(l2d) {
|
|
43
|
+
const p = l2d.pending
|
|
44
|
+
if (!p) return
|
|
45
|
+
if (Date.now() - (p.at || 0) > (Number(p.ms) || 0) + PENDING_GRACE_MS) {
|
|
46
|
+
l2d.result = { jobId: p.jobId, ok: false, ms: 0, at: Date.now(), timeout: true }
|
|
47
|
+
l2d.pending = null
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** 动作模板:省得模型每次现编 JSON(compile 失败率的主要来源)。 */
|
|
52
|
+
function buildTemplates(caps) {
|
|
53
|
+
const exprs = (caps && Array.isArray(caps.expressions)) ? caps.expressions : []
|
|
54
|
+
const e0 = exprs[0] || ''
|
|
55
|
+
const out = [
|
|
56
|
+
{ name: 'greet', note: '打招呼:轻点头 + 瞥一眼', plan: { version: 1, intent: '打招呼', actions: [
|
|
57
|
+
{ kind: 'nod', count: 1, at: 0, duration: 1.2 },
|
|
58
|
+
{ kind: 'look', direction: 'right', at: 0.35, duration: 1.0 },
|
|
59
|
+
] } },
|
|
60
|
+
{ name: 'think', note: '思考:看左上、停久一点', plan: { version: 1, intent: '思考', actions: [
|
|
61
|
+
{ kind: 'look', direction: 'up', at: 0, duration: 1.8 },
|
|
62
|
+
{ kind: 'nod', count: 1, at: 1.4, duration: 0.8 },
|
|
63
|
+
] } },
|
|
64
|
+
]
|
|
65
|
+
if (e0) {
|
|
66
|
+
out.push({ name: 'surprise', note: '惊讶:换表情 + 一抬头', plan: { version: 1, intent: '惊讶', actions: [
|
|
67
|
+
{ kind: 'expression', name: e0, at: 0, duration: 1.6 },
|
|
68
|
+
{ kind: 'look', direction: 'center', at: 0.1, duration: 1.2 },
|
|
69
|
+
] } })
|
|
70
|
+
}
|
|
71
|
+
return out
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function installL2DTools(toolsSvc, l2d) {
|
|
75
|
+
if (!toolsSvc || typeof toolsSvc.register !== 'function') {
|
|
76
|
+
throw new Error('tools 服务不可用')
|
|
77
|
+
}
|
|
78
|
+
const installed = []
|
|
79
|
+
|
|
80
|
+
const reg = (def) => {
|
|
81
|
+
const dispose = toolsSvc.register(def)
|
|
82
|
+
installed.push(typeof dispose === 'function' ? dispose : null)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* 1) 能力目录 */
|
|
86
|
+
reg({
|
|
87
|
+
name: 'cyrene_l2d_capabilities',
|
|
88
|
+
description: [
|
|
89
|
+
'读取小昔涟当前模型的真实动作能力:参数名、范围、表情列表。',
|
|
90
|
+
'什么时候用:**编排任何动作之前先调这个**。动作里的参数名和表情名只能从这里取,编不出来就是执行失败。',
|
|
91
|
+
'返回 ok=false 说明独立桌面版没在运行 —— 她在页面上,但没有可驱动的舞台。',
|
|
92
|
+
].join('\n'),
|
|
93
|
+
parameters: { type: 'object', properties: {}, required: [] },
|
|
94
|
+
output: {
|
|
95
|
+
schema: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
properties: {
|
|
98
|
+
ok: { type: 'boolean' },
|
|
99
|
+
model: { type: 'string' },
|
|
100
|
+
params: { type: 'integer' },
|
|
101
|
+
expressions: { type: 'array', items: { type: 'string' } },
|
|
102
|
+
templates: { type: 'array', items: { type: 'object' } },
|
|
103
|
+
hint: { type: 'string' },
|
|
104
|
+
},
|
|
105
|
+
required: ['ok', 'model', 'params', 'expressions', 'templates', 'hint'],
|
|
106
|
+
},
|
|
107
|
+
render: (_a, v) => TEXT(
|
|
108
|
+
v.ok
|
|
109
|
+
? `当前模型 ${v.model}:${v.params} 个参数,${v.expressions.length} 个表情${v.expressions.length ? '(' + v.expressions.join('、') + ')' : ''}。`
|
|
110
|
+
: v.hint
|
|
111
|
+
),
|
|
112
|
+
},
|
|
113
|
+
async execute() {
|
|
114
|
+
const caps = capsFresh(l2d) ? l2d.caps : null
|
|
115
|
+
if (!caps) {
|
|
116
|
+
return {
|
|
117
|
+
ok: false, model: '', params: 0, expressions: [], templates: [],
|
|
118
|
+
hint: '独立桌面版没在运行(15 秒内没有心跳),没有可驱动的舞台。等她在桌面上之后再编排动作。',
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
ok: true,
|
|
123
|
+
model: String(caps.model || ''),
|
|
124
|
+
params: (caps.order && caps.order.length) || Object.keys(caps.params || {}).length,
|
|
125
|
+
expressions: Array.isArray(caps.expressions) ? caps.expressions : [],
|
|
126
|
+
templates: buildTemplates(caps),
|
|
127
|
+
hint: '参数名与表情名只能取自这里;templates 里有现成的『打招呼 / 思考 / 惊讶』可直接改。编排完先用 cyrene_l2d_compile 校验。',
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
/* 2) 校验(不执行) */
|
|
133
|
+
reg({
|
|
134
|
+
name: 'cyrene_l2d_compile',
|
|
135
|
+
description: [
|
|
136
|
+
'校验一份语义动作计划:参数是否存在、范围、时长、通道冲突。**只校验,不执行**。',
|
|
137
|
+
'计划格式:{"version":1,"intent":"…","actions":[{"kind":"look","direction":"right","at":0,"duration":1.6}]}',
|
|
138
|
+
'可用 kind:look(direction: left/right/up/down/center)· nod / shake_head(count 1..4)· hold / param(param + value)· expression(name)。',
|
|
139
|
+
'校验失败就把 error 原样看去改,改完再调一次;不要跳过这一步直接 execute。',
|
|
140
|
+
].join('\n'),
|
|
141
|
+
parameters: {
|
|
142
|
+
type: 'object',
|
|
143
|
+
properties: { plan: { oneOf: [{ type: 'object' }, { type: 'string' }] } },
|
|
144
|
+
required: ['plan'],
|
|
145
|
+
},
|
|
146
|
+
output: {
|
|
147
|
+
schema: {
|
|
148
|
+
type: 'object',
|
|
149
|
+
properties: {
|
|
150
|
+
ok: { type: 'boolean' },
|
|
151
|
+
tracks: { type: 'integer' },
|
|
152
|
+
ms: { type: 'integer' },
|
|
153
|
+
warnings: { type: 'array', items: { type: 'string' } },
|
|
154
|
+
error: { type: 'string' },
|
|
155
|
+
},
|
|
156
|
+
required: ['ok', 'tracks', 'ms', 'warnings', 'error'],
|
|
157
|
+
},
|
|
158
|
+
render: (_a, v) => TEXT(
|
|
159
|
+
v.ok
|
|
160
|
+
? `校验通过:${v.tracks} 条轨道,约 ${v.ms} ms${v.warnings.length ? ';提示:' + v.warnings.join(';') : ''}。`
|
|
161
|
+
: `校验没通过:${v.error}`
|
|
162
|
+
),
|
|
163
|
+
},
|
|
164
|
+
async execute(args) {
|
|
165
|
+
const plan = parsePlan(args && args.plan)
|
|
166
|
+
if (plan.__parseError) return { ok: false, tracks: 0, ms: 0, warnings: [], error: plan.__parseError }
|
|
167
|
+
if (!capsFresh(l2d)) return { ok: false, tracks: 0, ms: 0, warnings: [], error: '独立桌面版没在运行(没有能力目录 / 心跳过期)' }
|
|
168
|
+
const r = compilePlan(plan, l2d.caps)
|
|
169
|
+
return r.ok
|
|
170
|
+
? { ok: true, tracks: r.tracks.length, ms: r.ms, warnings: r.warnings || [], error: '' }
|
|
171
|
+
: { ok: false, tracks: 0, ms: 0, warnings: [], error: r.error }
|
|
172
|
+
},
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
/* 3) 下发 */
|
|
176
|
+
reg({
|
|
177
|
+
name: 'cyrene_l2d_execute',
|
|
178
|
+
description: [
|
|
179
|
+
'把已经通过校验的动作计划下发给她执行,返回 jobId。之后用 cyrene_l2d_state 追踪。',
|
|
180
|
+
'会再校验一遍(防止计划被改动);校验不过就退回,不下发。',
|
|
181
|
+
'同一时刻只允许一个待执行任务 —— 上一段还没播完就再下发,会被拒绝。',
|
|
182
|
+
].join('\n'),
|
|
183
|
+
parameters: {
|
|
184
|
+
type: 'object',
|
|
185
|
+
properties: { plan: { oneOf: [{ type: 'object' }, { type: 'string' }] } },
|
|
186
|
+
required: ['plan'],
|
|
187
|
+
},
|
|
188
|
+
output: {
|
|
189
|
+
schema: {
|
|
190
|
+
type: 'object',
|
|
191
|
+
properties: {
|
|
192
|
+
ok: { type: 'boolean' },
|
|
193
|
+
jobId: { type: 'string' },
|
|
194
|
+
ms: { type: 'integer' },
|
|
195
|
+
error: { type: 'string' },
|
|
196
|
+
},
|
|
197
|
+
required: ['ok', 'jobId', 'ms', 'error'],
|
|
198
|
+
},
|
|
199
|
+
render: (_a, v) => TEXT(
|
|
200
|
+
v.ok ? `已下发(${v.jobId},约 ${v.ms} ms)。她在桌面上动起来之后会写回执。`
|
|
201
|
+
: `没下发:${v.error}`
|
|
202
|
+
),
|
|
203
|
+
},
|
|
204
|
+
async execute(args) {
|
|
205
|
+
const plan = parsePlan(args && args.plan)
|
|
206
|
+
if (plan.__parseError) return { ok: false, jobId: '', ms: 0, error: plan.__parseError }
|
|
207
|
+
sweepPending(l2d)
|
|
208
|
+
if (!capsFresh(l2d)) return { ok: false, jobId: '', ms: 0, error: '独立桌面版没在运行(没有能力目录 / 心跳过期)' }
|
|
209
|
+
if (l2d.pending) return { ok: false, jobId: '', ms: 0, error: '上一段还没播完,等它结束或先 stop' }
|
|
210
|
+
const r = compilePlan(plan, l2d.caps)
|
|
211
|
+
if (!r.ok) return { ok: false, jobId: '', ms: 0, error: r.error }
|
|
212
|
+
l2d.seq = (l2d.seq || 0) + 1
|
|
213
|
+
const jobId = 'j' + Date.now().toString(36) + '-' + l2d.seq
|
|
214
|
+
l2d.pending = { jobId, tracks: r.tracks, ms: r.ms, at: Date.now() }
|
|
215
|
+
return { ok: true, jobId, ms: r.ms, error: '' }
|
|
216
|
+
},
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
/* 4) 回执 */
|
|
220
|
+
reg({
|
|
221
|
+
name: 'cyrene_l2d_state',
|
|
222
|
+
description: [
|
|
223
|
+
'读她的动作状态与上一次的回执。',
|
|
224
|
+
'只有回执里 completed=true 才代表真的播完了;只是「已下发」不算完成 —— 别把下发当成做完。',
|
|
225
|
+
].join('\n'),
|
|
226
|
+
parameters: { type: 'object', properties: {}, required: [] },
|
|
227
|
+
output: {
|
|
228
|
+
schema: {
|
|
229
|
+
type: 'object',
|
|
230
|
+
properties: {
|
|
231
|
+
online: { type: 'boolean' },
|
|
232
|
+
playing: { type: 'boolean' },
|
|
233
|
+
jobId: { type: 'string' },
|
|
234
|
+
completed: { type: 'boolean' },
|
|
235
|
+
note: { type: 'string' },
|
|
236
|
+
},
|
|
237
|
+
required: ['online', 'playing', 'jobId', 'completed', 'note'],
|
|
238
|
+
},
|
|
239
|
+
render: (_a, v) => TEXT(v.note),
|
|
240
|
+
},
|
|
241
|
+
async execute() {
|
|
242
|
+
sweepPending(l2d)
|
|
243
|
+
const online = capsFresh(l2d)
|
|
244
|
+
const p = l2d.pending
|
|
245
|
+
const r = l2d.result
|
|
246
|
+
const note = !online
|
|
247
|
+
? '她不在桌面上(独立版没运行)。'
|
|
248
|
+
: p
|
|
249
|
+
? `正在播 ${p.jobId}(约 ${p.ms} ms)。`
|
|
250
|
+
: r
|
|
251
|
+
? `最近一次 ${r.jobId}:${r.ok ? '播完了' : '失败了'}(${r.ms} ms)。`
|
|
252
|
+
: '待机中,最近没有动作。'
|
|
253
|
+
// jobId 与 completed 必须来自同一件事:playing 时只能报「未完成」,
|
|
254
|
+
// 否则会出现 {jobId: B, completed: true, playing: true} 这种自相矛盾。
|
|
255
|
+
return {
|
|
256
|
+
online,
|
|
257
|
+
playing: !!p,
|
|
258
|
+
jobId: (p && p.jobId) || (r && r.jobId) || '',
|
|
259
|
+
completed: !p && !!(r && r.ok),
|
|
260
|
+
note,
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
/* 5) 停止 */
|
|
266
|
+
reg({
|
|
267
|
+
name: 'cyrene_l2d_stop',
|
|
268
|
+
description: '让她停止当前动作、平滑回待机。',
|
|
269
|
+
parameters: { type: 'object', properties: {}, required: [] },
|
|
270
|
+
output: {
|
|
271
|
+
schema: {
|
|
272
|
+
type: 'object',
|
|
273
|
+
properties: { ok: { type: 'boolean' }, note: { type: 'string' } },
|
|
274
|
+
required: ['ok', 'note'],
|
|
275
|
+
},
|
|
276
|
+
render: (_a, v) => TEXT(v.note),
|
|
277
|
+
},
|
|
278
|
+
async execute() {
|
|
279
|
+
if (!l2d.pending) return { ok: false, note: '她本来就是待机状态。' }
|
|
280
|
+
l2d.pending = null
|
|
281
|
+
return { ok: true, note: '已停下,回待机。' }
|
|
282
|
+
},
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
return {
|
|
286
|
+
dispose() {
|
|
287
|
+
for (const d of installed) {
|
|
288
|
+
try { d && d() } catch {}
|
|
289
|
+
}
|
|
290
|
+
installed.length = 0
|
|
291
|
+
},
|
|
292
|
+
}
|
|
293
|
+
}
|