Commit 39b68dd
authored
fix(stage-ui): robust spark:command result + TTS session isolation (#1949)
## Summary
Two small, generic robustness fixes, split out of the Minecraft desktop
integration (#1916) so they can land independently of that rework — as
suggested in @shinohara-rin's review:
> The generic fixes in this PR, like the TTS session cleanup and
`spark:command` result handling, seem separable and worth keeping in a
smaller PR.
Both are in shared `stage-ui` runtime code and contain **no
Minecraft-specific logic**.
## What's included
- **`spark:command` result handling**
(`tools/character/orchestrator/spark-command.ts`):
`command.destinations` may be `undefined` — the channel sender
(`stores/llm.ts` `sendSparkCommand`) deletes it to broadcast to all
authenticated peers. The success message's `.join()` therefore surfaced
`Cannot read properties of undefined (reading 'join')` back to the LLM
even though the send had already succeeded. Guard it and report a
broadcast instead.
- **TTS session isolation** (`components/scenes/Stage.vue`
`openTtsSession`): a completing/erroring session now only clears the
module-level `currentSession` if it **is** that session. The previous
code cleared it whenever any `stream-` session completed, which becomes
unsafe once sessions exist that are not assigned to `currentSession`
(e.g. one-off read-aloud sessions) — one of those finishing would null a
still-active chat session and drop the rest of the reply.
## How tested
```bash
pnpm -F @proj-airi/stage-ui exec vitest run src/tools/character/orchestrator/spark-command.test.ts # 9 passed (+1 new)
pnpm -F @proj-airi/stage-ui typecheck # 0 errors
pnpm exec eslint <changed files> # 0 problems
```
- Regression test for the broadcast-destinations result message.
## Context
This is the first, low-risk slice of reworking the Minecraft↔desktop
integration around the neutral Context Flow architecture (per the #1916
review). The Minecraft relay/read-aloud behavior will be reintroduced
through a Minecraft-owned adapter in a follow-up.
---------1 parent 4ff491a commit 39b68dd
4 files changed
Lines changed: 61 additions & 12 deletions
File tree
- packages/stage-ui/src
- components/scenes
- libs/speech
- tools/character/orchestrator
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
688 | 688 | | |
689 | 689 | | |
690 | 690 | | |
691 | | - | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
692 | 702 | | |
693 | 703 | | |
694 | 704 | | |
| |||
706 | 716 | | |
707 | 717 | | |
708 | 718 | | |
709 | | - | |
710 | | - | |
| 719 | + | |
711 | 720 | | |
712 | 721 | | |
713 | | - | |
714 | | - | |
| 722 | + | |
715 | 723 | | |
716 | 724 | | |
717 | 725 | | |
| 726 | + | |
718 | 727 | | |
719 | 728 | | |
720 | 729 | | |
| |||
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
296 | 306 | | |
297 | 307 | | |
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
303 | 327 | | |
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
| |||
0 commit comments