@inupedia/spotlight-vue 0.8.5 → 0.8.6

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.
@@ -1,340 +1,317 @@
1
- import { defineComponent as me, computed as R, ref as c, watch as Z, nextTick as W, onMounted as be, onUnmounted as we, openBlock as ee, createElementBlock as ye, Fragment as Se, createVNode as Le, unref as U, createBlock as ke, createCommentVNode as Te } from "vue";
2
- import { buildFastLive2dBriefing as Ee, summarizeLive2dBriefing as Ce } from "../avatar/speech/live2dBriefingSummarizer.js";
3
- import { isGenericHostExecutionReply as te } from "../avatar/speech/live2dAnswerSpeechPolicy.js";
4
- import { LIVE2D_ANSWER_STEP_ID as Ae } from "../avatar/speech/live2dStreamSpeech.js";
5
- import { waitForAudioNaturalEnd as Pe } from "../avatar/speech/live2dTtsPlayback.js";
6
- import { hasSpotlightSpeechConfig as ne, SpotlightSpeechService as Ve } from "../avatar/speech/spotlightSpeech.js";
7
- import { storeToRefs as xe } from "pinia";
8
- import { useSpotlightStore as Be } from "../store/spotlightStore.js";
9
- import { useSpotlightAvatarConfig as Ke } from "../avatar/config.js";
10
- import Re from "./SpotlightRoot.vue.js";
11
- import _e from "./Live2dPanel.vue.js";
12
- import { useLive2dOverlayStore as He } from "../store/live2dOverlayStore.js";
13
- import { useLive2dSpeechStore as Fe } from "../store/live2dSpeechStore.js";
14
- import { useLive2dVoiceChannelStore as Ie } from "../store/live2dVoiceChannelStore.js";
15
- import { devWarn as Oe } from "../utils/devConsole.js";
16
- const ie = "Backquote", Ue = "`", tt = /* @__PURE__ */ me({
1
+ import { defineComponent as me, computed as P, ref as u, watch as ge, onMounted as be, onUnmounted as we, openBlock as N, createElementBlock as G, Fragment as ye, createVNode as Se, unref as _, createBlock as Le, createElementVNode as $, createCommentVNode as ke, nextTick as j } from "vue";
2
+ import { waitForAudioNaturalEnd as Te } from "../avatar/speech/live2dTtsPlayback.js";
3
+ import { SpotlightSpeechService as Ce, hasSpotlightSpeechConfig as Ee } from "../avatar/speech/spotlightSpeech.js";
4
+ import { storeToRefs as Ve } from "pinia";
5
+ import { useSpotlightStore as Ae } from "../store/spotlightStore.js";
6
+ import { useSpotlightAvatarConfig as Pe } from "../avatar/config.js";
7
+ import Ke from "./SpotlightRoot.vue.js";
8
+ import xe from "./Live2dPanel.vue.js";
9
+ import { useLive2dOverlayStore as Be } from "../store/live2dOverlayStore.js";
10
+ import { useLive2dSpeechStore as He } from "../store/live2dSpeechStore.js";
11
+ import { useLive2dVoiceChannelStore as Re } from "../store/live2dVoiceChannelStore.js";
12
+ import { devWarn as _e } from "../utils/devConsole.js";
13
+ const Y = "Backquote", Fe = "`", Ye = /* @__PURE__ */ me({
17
14
  __name: "SpotlightShell",
18
15
  props: {
19
16
  avatarEnabled: { type: Boolean, default: !1 }
20
17
  },
21
- setup(z) {
22
- const T = z, _ = Ke(), re = R(
23
- () => _.deckKicker?.trim() || "SPOTLIGHT"
24
- ), H = R(
25
- () => _.greetingText?.trim() || "您好,我是 Spotlight 助手"
26
- ), n = Be(), F = He(), { visible: d } = xe(F), l = Fe(), p = Ie(), b = new Ve(), E = c(null), o = c(!1), y = c(!1), C = c(!1), V = c(null), x = c(null), I = c(null), A = c(null), P = c(0), G = c(0), s = c(!1), $ = R(
18
+ setup(F) {
19
+ const k = F, K = Pe(), Q = P(
20
+ () => K.deckKicker?.trim() || "SPOTLIGHT"
21
+ ), x = P(
22
+ () => K.greetingText?.trim() || "您好,我是 Spotlight 助手"
23
+ ), n = Ae(), T = Be(), { visible: v } = Ve(T), o = He(), s = Re(), p = new Ce(), w = u(null), l = u(!1), h = u(!1), y = u(!1), C = u(null), E = u(null), B = u(null), f = u(null), m = u(0), g = u(!1), D = P(
27
24
  () => Math.max(
28
25
  0,
29
- _.briefingKeepLastMs ?? 0
26
+ K.briefingKeepLastMs ?? 0
30
27
  )
31
28
  );
32
- let S = null;
33
- const w = c(!1), ae = R(() => n.showThinkingBar ? !T.avatarEnabled || !d.value || n.pipelinePhase === "running" || s.value ? !0 : n.pipelinePhase === "done" : !1), le = R(() => {
29
+ let b = null;
30
+ const d = u(!1);
31
+ let H = Promise.resolve(), O = 0;
32
+ const J = P(() => n.showThinkingBar ? !k.avatarEnabled || !v.value || n.pipelinePhase === "running" || g.value ? !0 : n.pipelinePhase === "done" : !1), X = P(() => {
34
33
  const e = n.agentSteps.length === 1 && n.agentSteps[0]?.label === "回答";
35
- return n.pipelinePhase === "running" || e || s.value;
34
+ return n.pipelinePhase === "running" || e || g.value;
36
35
  });
37
- function oe() {
38
- s.value = !1, d.value && (n.showThinkingBar = !1);
36
+ function Z() {
37
+ g.value = !1, v.value && (n.showThinkingBar = !1);
39
38
  }
40
- function j() {
41
- E.value != null && (window.clearTimeout(E.value), E.value = null);
39
+ function I() {
40
+ w.value != null && (window.clearTimeout(w.value), w.value = null);
42
41
  }
43
- function M() {
44
- j(), V.value && (V.value.abort(), V.value = null), y.value = !1, C.value = !1, o.value = !1, w.value = !1, p.reset(), b.cancel();
42
+ function U() {
43
+ I(), C.value && (C.value.abort(), C.value = null), h.value = !1, y.value = !1, l.value = !1, d.value = !1, s.reset(), p.cancel();
45
44
  }
46
- function g() {
47
- S && (S.abort(), S = null), A.value && (A.value.abort(), A.value = null), B(), l.reset(), import("../avatar/spine/live2dApp.js").then(
45
+ function S() {
46
+ b && (b.abort(), b = null), f.value && (f.value.abort(), f.value = null), V(), o.reset(), import("../avatar/spine/live2dApp.js").then(
48
47
  (e) => e.stopLive2dLipSync()
49
48
  );
50
49
  }
51
- function q(e, t) {
52
- return e <= 0 ? Promise.resolve() : new Promise((i, r) => {
53
- const a = window.setTimeout(() => {
54
- t?.removeEventListener("abort", h), i();
55
- }, e), h = () => {
56
- window.clearTimeout(a), r(new DOMException("Aborted", "AbortError"));
50
+ function ee(e, t) {
51
+ return e <= 0 ? Promise.resolve() : new Promise((i, a) => {
52
+ const r = window.setTimeout(() => {
53
+ t?.removeEventListener("abort", L), i();
54
+ }, e), L = () => {
55
+ window.clearTimeout(r), a(new DOMException("Aborted", "AbortError"));
57
56
  };
58
57
  if (t?.aborted) {
59
- h();
58
+ L();
60
59
  return;
61
60
  }
62
- t?.addEventListener("abort", h, { once: !0 });
61
+ t?.addEventListener("abort", L, { once: !0 });
63
62
  });
64
63
  }
65
- async function se() {
66
- if (!d.value || n.pipelinePhase === "running") return;
67
- g(), P.value += 1;
68
- const e = P.value, t = new AbortController();
69
- if (S = t, !ne()) {
70
- S = null, await W(), (await import("../avatar/spine/live2dApp.js")).playLive2dHello(), l.start(H.value, { instant: !0 }), l.reset();
64
+ async function te() {
65
+ if (!v.value || n.pipelinePhase === "running") return;
66
+ S(), m.value += 1;
67
+ const e = m.value, t = new AbortController();
68
+ if (b = t, !Ee()) {
69
+ b = null, await j(), (await import("../avatar/spine/live2dApp.js")).playLive2dHello(), o.start(x.value, { instant: !0 }), o.reset();
71
70
  return;
72
71
  }
73
- const i = b.synthesize(
74
- H.value,
72
+ const i = p.synthesize(
73
+ x.value,
75
74
  t.signal
76
75
  );
77
- if (await W(), await new Promise((r) => {
78
- requestAnimationFrame(() => r());
79
- }), !!f(t, e))
76
+ if (await j(), await new Promise((a) => {
77
+ requestAnimationFrame(() => a());
78
+ }), !!c(t, e))
80
79
  try {
81
- const { blob: r } = await i;
82
- if (!f(t, e)) return;
83
- await Q(
84
- H.value,
85
- r,
80
+ const { blob: a } = await i;
81
+ if (!c(t, e)) return;
82
+ await W(
83
+ x.value,
84
+ a,
86
85
  t,
87
86
  e,
88
87
  { instantText: !0, playHelloWithSpeech: !0 }
89
88
  );
90
- } catch (r) {
89
+ } catch (a) {
91
90
  if (t.signal.aborted) return;
92
- const a = r instanceof Error ? r.message : "数字人招呼语音失败,请稍后重试。";
93
- Oe("[live2d-greeting]", a), f(t, e) && ((await import("../avatar/spine/live2dApp.js")).playLive2dHello(), l.start(H.value, { instant: !0 }), l.reset());
91
+ const r = a instanceof Error ? a.message : "数字人招呼语音失败,请稍后重试。";
92
+ _e("[live2d-greeting]", r), c(t, e) && ((await import("../avatar/spine/live2dApp.js")).playLive2dHello(), o.start(x.value, { instant: !0 }), o.reset());
94
93
  } finally {
95
- S === t && (S = null);
94
+ b === t && (b = null);
96
95
  }
97
96
  }
98
- function B() {
99
- x.value && (x.value.pause(), x.value.src = "", x.value = null), I.value && (URL.revokeObjectURL(I.value), I.value = null);
97
+ function V() {
98
+ E.value && (E.value.pause(), E.value.src = "", E.value = null), B.value && (URL.revokeObjectURL(B.value), B.value = null);
100
99
  }
101
- function Y() {
102
- return (n.agentSteps.find((t) => t.id === Ae) ?? n.agentSteps.find((t) => t.label === "回答") ?? n.agentSteps.find((t) => t.label === "执行工具与回答") ?? n.agentSteps.find((t) => t.label === "知识问答"))?.content ?? "";
100
+ function ne() {
101
+ S(), m.value += 1;
102
+ const e = new AbortController();
103
+ f.value = e, H = Promise.resolve(), O = 0, g.value = !0;
103
104
  }
104
- async function ue() {
105
- const e = Y().trim();
106
- if (!e || !d.value || te(e)) {
107
- s.value = !1;
108
- return;
109
- }
110
- g();
111
- const t = P.value, i = new AbortController();
112
- A.value = i;
113
- try {
114
- let a = Ee(e).sentences;
115
- if (!a.length) {
116
- s.value = !1;
117
- return;
118
- }
119
- let h = null, K = !1;
120
- const L = Ce(e, i.signal).then((u) => {
121
- u.sentences.length > 0 && (h = u.sentences);
122
- }).catch(() => {
123
- });
124
- let m = -1, k = null;
125
- const O = (u) => {
126
- u < 0 || u >= a.length || m === u && k || (m = u, k = b.synthesize(a[u].text, i.signal).then((N) => N.blob));
127
- };
128
- let v = 0;
129
- for (; v < a.length; ) {
130
- if (!f(i, t)) return;
131
- if (!K && h && (a = h, K = !0, m = -1, k = null, v >= a.length))
132
- break;
133
- const u = a[v];
134
- O(v);
135
- const N = m === v && k ? await k : (await b.synthesize(u.text, i.signal)).blob;
136
- if (!f(i, t)) return;
137
- O(v + 1), v === 0 && oe(), await Q(u.text, N, i, t, {
105
+ function ie(e) {
106
+ const t = f.value;
107
+ if (!t || t.signal.aborted || !e.text.trim()) return;
108
+ const i = m.value, a = p.synthesize(e.text, t.signal).then(
109
+ (r) => ({ blob: r.blob, error: null }),
110
+ (r) => ({ blob: null, error: r })
111
+ );
112
+ O += 1, H = H.then(async () => {
113
+ const r = await a;
114
+ if (r.error) throw r.error;
115
+ r.blob && c(t, i) && (e.index === 0 && Z(), await W(
116
+ e.text,
117
+ r.blob,
118
+ t,
119
+ i,
120
+ {
138
121
  instantText: !0,
139
- hasFollowingClip: v + 1 < a.length
140
- });
141
- const X = u.pauseMs ?? 0;
142
- if (X > 0 && f(i, t))
143
- try {
144
- await q(X, i.signal);
145
- } catch {
146
- return;
147
- }
148
- v += 1;
149
- }
150
- await L;
151
- } catch (r) {
152
- if (i.signal.aborted) return;
153
- g();
154
- const a = r instanceof Error ? r.message : "数字人语音播放失败,请稍后重试。";
155
- n.error = a;
156
- } finally {
157
- if (s.value = !1, B(), (await import("../avatar/spine/live2dApp.js")).stopLive2dLipSync(), f(i, t)) {
158
- if ($.value > 0)
159
- try {
160
- await q($.value, i.signal);
161
- } catch {
162
- }
163
- f(i, t) && l.reset();
164
- }
165
- A.value === i && (A.value = null);
122
+ hasFollowingClip: !0
123
+ }
124
+ ));
125
+ }).catch((r) => {
126
+ t.signal.aborted || (n.error = r instanceof Error ? r.message : "数字人语音播放失败,请稍后重试。");
127
+ });
128
+ }
129
+ async function re() {
130
+ const e = f.value;
131
+ if (!e) return;
132
+ const t = m.value;
133
+ if (await H, g.value = !1, V(), (await import("../avatar/spine/live2dApp.js")).stopLive2dLipSync(), c(e, t)) {
134
+ if (D.value > 0 && O > 0)
135
+ try {
136
+ await ee(D.value, e.signal);
137
+ } catch {
138
+ }
139
+ c(e, t) && o.reset();
166
140
  }
141
+ f.value === e && (f.value = null);
167
142
  }
168
- function f(e, t) {
169
- return !e.signal.aborted && P.value === t;
143
+ function c(e, t) {
144
+ return !e.signal.aborted && m.value === t;
170
145
  }
171
- async function Q(e, t, i, r, a) {
172
- if (!f(i, r)) return;
173
- const h = a?.hasFollowingClip ?? !1;
174
- B();
175
- const K = URL.createObjectURL(t);
176
- I.value = K;
177
- const L = new Audio(K);
178
- L.volume = 1, x.value = L;
179
- const m = await import("../avatar/spine/live2dApp.js"), { buildWavEnvelopeFromBlob: k } = await import("../avatar/spine/spineLipSync.js"), O = a?.lipSyncEnvelope ?? await k(t);
180
- if (f(i, r)) {
181
- a?.playHelloWithSpeech && m.playLive2dHello(), m.bindLive2dLipSyncToAudio(L, O), l.start(e, { instant: a?.instantText ?? !0 });
146
+ async function W(e, t, i, a, r) {
147
+ if (!c(i, a)) return;
148
+ const L = r?.hasFollowingClip ?? !1;
149
+ V();
150
+ const z = URL.createObjectURL(t);
151
+ B.value = z;
152
+ const A = new Audio(z);
153
+ A.volume = 1, E.value = A;
154
+ const R = await import("../avatar/spine/live2dApp.js"), { buildWavEnvelopeFromBlob: de } = await import("../avatar/spine/spineLipSync.js"), pe = r?.lipSyncEnvelope ?? await de(t);
155
+ if (c(i, a)) {
156
+ r?.playHelloWithSpeech && R.playLive2dHello(), R.bindLive2dLipSyncToAudio(A, pe), o.start(e, { instant: r?.instantText ?? !0 });
182
157
  try {
183
- await L.play();
184
- } catch (v) {
185
- throw m.stopLive2dLipSync(), B(), v;
158
+ await A.play();
159
+ } catch (he) {
160
+ throw R.stopLive2dLipSync(), V(), he;
186
161
  }
187
- if (await Pe(L, i.signal), m.stopLive2dLipSync(), B(), !!f(i, r)) {
188
- if (h) {
189
- l.finish();
162
+ if (await Te(A, i.signal), R.stopLive2dLipSync(), V(), !!c(i, a)) {
163
+ if (L) {
164
+ o.finish();
190
165
  return;
191
166
  }
192
- l.reset();
167
+ o.reset();
193
168
  }
194
169
  }
195
170
  }
196
- function D() {
197
- return T.avatarEnabled ? d.value && !n.visible && !n.loading && !C.value && !y.value : !1;
171
+ function M() {
172
+ return k.avatarEnabled ? v.value && !n.visible && !n.loading && !y.value && !h.value : !1;
198
173
  }
199
- async function J() {
200
- if (y.value) return;
201
- const e = w.value;
202
- o.value = !1, e && p.setTranscribing(!0), y.value = !0;
174
+ async function q() {
175
+ if (h.value) return;
176
+ const e = d.value;
177
+ l.value = !1, e && s.setTranscribing(!0), h.value = !0;
203
178
  const t = new AbortController();
204
- V.value = t;
179
+ C.value = t;
205
180
  try {
206
- const { text: i } = await b.stopAndTranscribe(t.signal), r = i.trim();
181
+ const { text: i } = await p.stopAndTranscribe(t.signal), a = i.trim();
207
182
  if (e) {
208
- if (w.value = !1, !r) return;
209
- n.prompt = r, await n.submit();
183
+ if (d.value = !1, s.setTranscribing(!1), !a) return;
184
+ n.prompt = a, ne();
185
+ try {
186
+ await n.submit({
187
+ interactionMode: "voice",
188
+ onVoiceSentence: ie
189
+ });
190
+ } finally {
191
+ await re();
192
+ }
210
193
  return;
211
194
  }
212
- const a = n.prompt.trim();
213
- n.prompt = a ? `${a} ${i}` : i;
195
+ const r = n.prompt.trim();
196
+ n.prompt = r ? `${r} ${i}` : i;
214
197
  } catch (i) {
215
198
  if (t.signal.aborted) return;
216
- const r = i instanceof Error ? i.message : "语音识别失败,请重试。";
217
- n.error = r;
199
+ const a = i instanceof Error ? i.message : "语音识别失败,请重试。";
200
+ n.error = a;
218
201
  } finally {
219
- V.value = null, y.value = !1, o.value = !1, w.value = !1, p.reset();
202
+ C.value = null, h.value = !1, l.value = !1, d.value = !1, s.reset();
220
203
  }
221
204
  }
222
- function ce(e) {
205
+ function ae(e) {
223
206
  if (e.repeat || e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return;
224
- const t = D();
225
- !n.visible && !t || n.visible && n.loading || (e.preventDefault(), !(E.value != null || o.value) && (E.value = window.setTimeout(async () => {
226
- E.value = null;
227
- const i = D();
207
+ const t = M();
208
+ !n.visible && !t || n.visible && n.loading || (e.preventDefault(), !(w.value != null || l.value) && (w.value = window.setTimeout(async () => {
209
+ w.value = null;
210
+ const i = M();
228
211
  if (!(!n.visible && !i) && !(n.visible && n.loading))
229
212
  try {
230
- await b.startRecording(), o.value = !0, w.value = i, i ? p.setRecording(!0) : p.reset(), n.error = "";
231
- } catch (r) {
232
- const a = r instanceof Error ? r.message : "无法启动语音录制。";
233
- n.error = a, o.value = !1, w.value = !1, p.reset();
213
+ await p.startRecording(), l.value = !0, d.value = i, i ? s.setRecording(!0) : s.reset(), n.error = "";
214
+ } catch (a) {
215
+ const r = a instanceof Error ? a.message : "无法启动语音录制。";
216
+ n.error = r, l.value = !1, d.value = !1, s.reset();
234
217
  }
235
218
  }, 450)));
236
219
  }
237
- async function fe() {
238
- if (!(!D() || C.value)) {
239
- C.value = !0;
220
+ async function oe() {
221
+ if (!(!M() || y.value)) {
222
+ y.value = !0;
240
223
  try {
241
- if (g(), await b.startRecording(), !d.value) {
242
- b.cancel();
224
+ if (S(), await p.startRecording(), !v.value) {
225
+ p.cancel();
243
226
  return;
244
227
  }
245
- o.value = !0, w.value = !0, p.setRecording(!0), n.error = "";
228
+ l.value = !0, d.value = !0, s.setRecording(!0), n.error = "";
246
229
  } catch (e) {
247
230
  const t = e instanceof Error ? e.message : "无法启动语音录制。";
248
- n.error = t, o.value = !1, w.value = !1, p.reset();
231
+ n.error = t, l.value = !1, d.value = !1, s.reset();
249
232
  } finally {
250
- C.value = !1;
233
+ y.value = !1;
251
234
  }
252
235
  }
253
236
  }
254
- function ve() {
255
- o.value && J();
237
+ function le() {
238
+ l.value && q();
256
239
  }
257
- function de(e) {
258
- if (e.code !== ie || !n.visible && !o.value) return;
240
+ function se(e) {
241
+ if (e.code !== Y || !n.visible && !l.value) return;
259
242
  e.preventDefault();
260
- const t = o.value;
261
- j(), t && J();
243
+ const t = l.value;
244
+ I(), t && q();
262
245
  }
263
- function pe(e) {
264
- if (e.code === ie) {
265
- ce(e);
246
+ function ue(e) {
247
+ if (e.code === Y) {
248
+ ae(e);
266
249
  return;
267
250
  }
268
251
  const t = e.key.toLowerCase(), i = e.metaKey || e.ctrlKey;
269
- T.avatarEnabled && i && t === "l" && (e.preventDefault(), F.toggle());
252
+ k.avatarEnabled && i && t === "l" && (e.preventDefault(), T.toggle());
270
253
  }
271
- function he() {
272
- s.value = !1, P.value += 1, g(), l.reset(), n.showThinkingBar ? n.closeThinking() : n.visible && n.close();
254
+ function ce() {
255
+ T.show();
273
256
  }
274
- function ge(e) {
257
+ function ve() {
258
+ g.value = !1, m.value += 1, S(), o.reset(), n.showThinkingBar ? n.closeThinking() : n.visible && n.close();
259
+ }
260
+ function fe(e) {
275
261
  if (!e) {
276
- M(), d.value && n.prepareLive2dVoiceChannel();
262
+ U(), v.value && n.prepareLive2dVoiceChannel();
277
263
  return;
278
264
  }
279
265
  }
280
- return Z(d, (e) => {
281
- if (T.avatarEnabled) {
266
+ return ge(v, (e) => {
267
+ if (k.avatarEnabled) {
282
268
  if (!e) {
283
- s.value = !1, M(), g(), l.reset(), p.reset();
269
+ g.value = !1, U(), S(), o.reset(), s.reset();
284
270
  return;
285
271
  }
286
- n.visible || n.prepareLive2dVoiceChannel(), se();
287
- }
288
- }), Z(
289
- () => [n.pipelinePhase, n.pipelineRunId, d.value],
290
- ([e, t, i]) => {
291
- if (T.avatarEnabled) {
292
- if (e === "running") {
293
- s.value = !1, g();
294
- return;
295
- }
296
- if (e !== "done") {
297
- (e === "error" || e === "cancelled") && (s.value = !1, g());
298
- return;
299
- }
300
- i && (t <= G.value || (G.value = t, W(() => {
301
- const r = Y().trim();
302
- if (!r || te(r) || !ne()) {
303
- s.value = !1;
304
- return;
305
- }
306
- s.value = !0, P.value += 1, ue();
307
- })));
308
- }
272
+ n.visible || n.prepareLive2dVoiceChannel(), te();
309
273
  }
310
- ), be(() => {
311
- T.avatarEnabled && _.initiallyVisible && F.show();
274
+ }), be(() => {
275
+ k.avatarEnabled && K.initiallyVisible && T.show();
312
276
  }), we(() => {
313
- M(), g(), l.reset(), p.reset();
314
- }), (e, t) => (ee(), ye(Se, null, [
315
- Le(Re, {
316
- "deck-kicker": re.value,
317
- "voice-hold-active": o.value,
318
- "speech-pending": y.value,
319
- "voice-key-label": Ue,
320
- "show-thinking": ae.value,
321
- "thinking-centered": le.value,
322
- "on-escape": he,
323
- "on-keydown": pe,
324
- "on-keyup": de,
325
- onVisibleChange: ge
277
+ U(), S(), o.reset(), s.reset();
278
+ }), (e, t) => (N(), G(ye, null, [
279
+ Se(Ke, {
280
+ "deck-kicker": Q.value,
281
+ "voice-hold-active": l.value,
282
+ "speech-pending": h.value,
283
+ "voice-key-label": Fe,
284
+ "show-thinking": J.value,
285
+ "thinking-centered": X.value,
286
+ "on-escape": ve,
287
+ "on-keydown": ue,
288
+ "on-keyup": se,
289
+ onVisibleChange: fe
326
290
  }, null, 8, ["deck-kicker", "voice-hold-active", "speech-pending", "show-thinking", "thinking-centered"]),
327
- z.avatarEnabled && U(d) ? (ee(), ke(_e, {
291
+ F.avatarEnabled && _(v) ? (N(), Le(xe, {
328
292
  key: 0,
329
- "voice-disabled": U(n).loading || y.value || C.value,
330
- "voice-error": U(n).error,
331
- onVoiceStart: fe,
332
- onVoiceStop: ve,
333
- onClose: U(F).hide
334
- }, null, 8, ["voice-disabled", "voice-error", "onClose"])) : Te("", !0)
293
+ "voice-disabled": _(n).loading || h.value || y.value,
294
+ "voice-error": _(n).error,
295
+ onVoiceStart: oe,
296
+ onVoiceStop: le,
297
+ onClose: _(T).hide
298
+ }, null, 8, ["voice-disabled", "voice-error", "onClose"])) : F.avatarEnabled ? (N(), G("button", {
299
+ key: 1,
300
+ type: "button",
301
+ class: "spotlight-avatar-reopen",
302
+ "aria-label": "再次打开数字人小滴",
303
+ title: "再次打开小滴(Ctrl/Command + L)",
304
+ onClick: ce
305
+ }, [...t[0] || (t[0] = [
306
+ $("span", {
307
+ class: "spotlight-avatar-reopen__drop",
308
+ "aria-hidden": "true"
309
+ }, null, -1),
310
+ $("span", { class: "spotlight-avatar-reopen__label" }, "小滴", -1)
311
+ ])])) : ke("", !0)
335
312
  ], 64));
336
313
  }
337
314
  });
338
315
  export {
339
- tt as default
316
+ Ye as default
340
317
  };
package/dist/plugin.js CHANGED
@@ -58,7 +58,7 @@ const K = {
58
58
  clientInfo: {
59
59
  name: "spotlight-vue",
60
60
  title: "Spotlight Vue",
61
- version: "0.8.5"
61
+ version: "0.8.6"
62
62
  },
63
63
  toolManifest: () => m({
64
64
  projectId: t.projectId,
@@ -3,6 +3,14 @@ import type { HandlerApi } from "../store/pipeline/types.js";
3
3
  import type { SpotlightExecutionEvent } from "../store/runtime/types.js";
4
4
  import { executeRemoteHostTool } from "./hostToolRunner.js";
5
5
  import type { SpotlightPipelineRunOutcome } from "./types.js";
6
+ export interface SpotlightPipelineRunOptions {
7
+ forceMemoryRefresh?: boolean;
8
+ interactionMode?: "text" | "voice";
9
+ onVoiceSentence?: (sentence: {
10
+ index: number;
11
+ text: string;
12
+ }) => void;
13
+ }
6
14
  type RemoteRunEvent = SpotlightExecutionEvent | {
7
15
  type: "host_action_request";
8
16
  at: number;
@@ -102,9 +110,7 @@ export declare function applyRemoteEvent(api: HandlerApi, event: RemoteRunEvent,
102
110
  /** Render only stable Thread / Turn / Item events; LangGraph phases stay server-side. */
103
111
  export declare function applyLifecycleEvent(api: HandlerApi, event: SpotlightTurnEvent, lookup?: ToolLaneLookup): Promise<void>;
104
112
  export declare function warmupSpotlightRemoteContext(signal?: AbortSignal): Promise<void>;
105
- export declare function runRemoteSpotlightPipeline(userQuestion: string, api: HandlerApi, options?: {
106
- forceMemoryRefresh?: boolean;
107
- }): Promise<SpotlightPipelineRunOutcome>;
113
+ export declare function runRemoteSpotlightPipeline(userQuestion: string, api: HandlerApi, options?: SpotlightPipelineRunOptions): Promise<SpotlightPipelineRunOutcome>;
108
114
  export declare function cancelRemoteSpotlightRun(runId: string): Promise<void>;
109
115
  export declare function cancelRemoteSpotlightRunForSignal(signal?: AbortSignal): void;
110
116
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"runPipeline.d.ts","sourceRoot":"","sources":["../../src/remote/runPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,kBAAk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