feat(voice): 提升桌面端语音交互与本地任务执行支持

This commit is contained in:
Blizzard
2026-07-24 16:40:25 +08:00
parent e9a8b9b4c6
commit aba88193d8
33 changed files with 1909 additions and 102 deletions
@@ -71,6 +71,22 @@ func (b *Bus) CallTool(ctx context.Context, subject string, call *contract.ToolC
return b.inner.CallTool(ctx, subject, call)
}
// ServeTool 以队列组订阅一族工具主题并按调用分发(平台工具族:gateway 自己当工具提供方,
// 见 JARVIS_BRAIN_DESIGN.md §2.1)。返回 drain 供优雅停机。
func (b *Bus) ServeTool(subject, queue string, h sharedbus.ToolHandler) (func(context.Context), error) {
return b.inner.ServeTool(subject, queue, h)
}
// PublishVoiceEvent 给某用户的语音会话发事件(JARVIS 动作/主动播报;无会话则静默丢弃)。
func (b *Bus) PublishVoiceEvent(uid string, ev *contract.VoiceEvent) error {
return b.inner.PublishVoiceEvent(uid, ev)
}
// SubscribeVoiceEvent 订阅某用户的语音事件(语音 WS 会话生命周期内挂载)。
func (b *Bus) SubscribeVoiceEvent(uid string, onEvent func(*contract.VoiceEvent)) (func() error, error) {
return b.inner.SubscribeVoiceEvent(uid, onEvent)
}
// Ping 同步探测某节点健康(如 dispatcher 心跳主题)。无人应答 / 超时即返回错误(视为下线)。
func (b *Bus) Ping(ctx context.Context, subject string) ([]byte, error) {
return b.inner.Ping(ctx, subject)