@istarry/spoon-companion 0.8.0 → 0.8.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/lib/asr.js CHANGED
@@ -149,11 +149,14 @@ export function markCallSession(id, on) {
149
149
  else callSessions.delete(key)
150
150
  }
151
151
 
152
- /** 这个会话现在算不算在通话:全局开关 / 这个会话被标过 / 最近真的在送音频 */
152
+ /**
153
+ * 这个会话现在算不算在通话。
154
+ * **只认客户端那把开关** —— 点了通话才算,点挂断就不算。
155
+ * 音频活动不参与判断:录音可能在页面一打开就在跑,拿它当证据会把普通聊天误判成通话。
156
+ */
153
157
  export function isCallActive(sessionId) {
154
158
  if (callGlobal) return true
155
- if (sessionId && callSessions.has(String(sessionId))) return true
156
- return isVoiceActive()
159
+ return Boolean(sessionId && callSessions.has(String(sessionId)))
157
160
  }
158
161
 
159
162
  export function feed(pcm, rate = 16000) {
package/lib/voice.js CHANGED
@@ -483,6 +483,7 @@ function apply(ctx) {
483
483
  order: 200,
484
484
  text: () => {
485
485
  const cfg = readConfig();
486
+ if (cfg.enabled === false) return "";
486
487
  if (cfg.engine !== "mimo") return "";
487
488
  if (!callProbe()) return "";
488
489
  return mimoSpeechGuidance(cfg.mimoStyle);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@istarry/spoon-companion",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "让对话角色有自己的内心和声音:心情情绪随时间和对话自己演,回复一条一条发出来,能念出声(DeepSeek / 小米 MiMo),也能听得见——点麦克风说话,本地识别后直接发送。四块都能单独关。",
5
5
  "type": "module",
6
6
  "main": "plugin.js",
package/plugin.js CHANGED
@@ -21,7 +21,7 @@
21
21
  import { createHash, randomUUID } from 'node:crypto'
22
22
  import * as voicePlugin from './lib/voice.js'
23
23
  import { applyAsrRoutes } from './lib/asr-route.js'
24
- import { isVoiceActive, isCallActive, markCallSession, setCallGlobal } from './lib/asr.js'
24
+ import { isCallActive, markCallSession, setCallGlobal } from './lib/asr.js'
25
25
  import { appendFileSync, readFileSync } from 'node:fs'
26
26
  import { homedir } from 'node:os'
27
27
  import { join } from 'node:path'
@@ -504,21 +504,15 @@ export function apply(ctx, config = {}) {
504
504
 
505
505
  /**
506
506
  * 这个会话现在在不在通话里。
507
- * 三条任意一条成立就算:真的在送音频 / 客户端报了全局开关 / 这个会话被单独标过。
507
+ * **只认客户端那把开关** —— 点了通话才算。不拿"有没有在送音频"当证据:
508
+ * 录音可能在页面一打开就在跑,拿它判断会把普通打字聊天误判成通话。
508
509
  */
509
510
  const inCallOf = (context) => {
510
511
  try {
511
512
  if ((settings.callMode ?? {}).enabled === false) return false
512
513
  const session = sessionOf(context)
513
514
  if (!session) return false
514
- const id = String(session.id ?? '')
515
- let voiceActive = false
516
- try {
517
- voiceActive = isVoiceActive()
518
- } catch {
519
- voiceActive = false
520
- }
521
- return voiceActive || callGlobal || Boolean(id && callSessions.has(id))
515
+ return isCallActive(String(session.id ?? ''))
522
516
  } catch {
523
517
  return false
524
518
  }