Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/added-18393-meetings-tts-quorum-020.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Meetings: hive ships Quorum v0.2.0 and passes it a text-to-speech service for Discord speech (`meetings.tts_url`, a write-only **TTS token** in Settings, Meetings, and the persona's voice as `QUORUM_TTS_VOICE` and `voice_id` on every join); hive never speaks in a Discord meeting whose voice is off (#18393).
14 changes: 12 additions & 2 deletions dashboard/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
"Meetings"
],
"summary": "Get meetings settings",
"description": "meetings.enabled, the Vexa gateway URL, whether the Vexa tenant key, Discord bot token and transcription service token are set (never their values), and the effective values of the other meetings keys. Owner only.",
"description": "meetings.enabled, the Vexa gateway URL, whether the Vexa tenant key, Discord bot token, transcription service token and TTS service token are set (never their values), and the effective values of the other meetings keys. Owner only.",
"responses": {
"200": {
"description": "Settings",
Expand Down Expand Up @@ -328,6 +328,9 @@
"transcribe_token_set": {
"type": "boolean"
},
"tts_token_set": {
"type": "boolean"
},
"restart_required": {
"type": "boolean"
},
Expand Down Expand Up @@ -355,7 +358,7 @@
"Meetings"
],
"summary": "Update meetings settings",
"description": "Sets meetings.enabled and meetings.vexa.url in hive.yaml and writes the Vexa tenant key, Discord bot token and transcription service token to keystore-sealed secret files (an empty string clears one). Takes effect after a restart. Owner only.",
"description": "Sets meetings.enabled and meetings.vexa.url in hive.yaml and writes the Vexa tenant key, Discord bot token, transcription service token and TTS service token to keystore-sealed secret files (an empty string clears one). Takes effect after a restart. Owner only.",
"requestBody": {
"required": true,
"content": {
Expand All @@ -378,6 +381,10 @@
"transcribe_token": {
"type": "string",
"description": "Transcription service token Quorum posts Discord audio with (write-only)"
},
"tts_token": {
"type": "string",
"description": "TTS service token Quorum speaks Discord replies with (write-only)"
}
}
}
Expand Down Expand Up @@ -407,6 +414,9 @@
"transcribe_token_set": {
"type": "boolean"
},
"tts_token_set": {
"type": "boolean"
},
"restart_required": {
"type": "boolean"
}
Expand Down
4 changes: 2 additions & 2 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,8 @@ RUN ARCH="${TARGETARCH:-$(dpkg --print-architecture)}" && \
# Bump note: see src/docs/cli-pins.md (quorum row); update QUORUM_VERSION and
# QUORUM_SHA256 together from the release's quorum.mjs.sha256, and
# QUORUM_DAVEY_VERSION from quorum's package-lock.json.
ARG QUORUM_VERSION=v0.1.0
ARG QUORUM_SHA256=917aee456e5c87a6b531f1c7c09040fa60d04a39609a1c2755cfdd20d63d7c95
ARG QUORUM_VERSION=v0.2.0
ARG QUORUM_SHA256=9233653115baffcd884c3181a0bf7714145ca858e84abb1d2411a4f255e75e03
ARG QUORUM_DAVEY_VERSION=0.1.12
RUN if [ -n "${QUORUM_VERSION}" ]; then \
test -n "${QUORUM_SHA256}" || { echo "QUORUM_SHA256 is required with QUORUM_VERSION" >&2; exit 1; } && \
Expand Down
14 changes: 12 additions & 2 deletions src/cmd/hive/meetingswire.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var newQuorumSupervisor = func(opts quorumproc.Options) (quorumSupervisor, error

// meetingsQuorumOptions builds the Quorum child options from the meetings
// config, resolving the Vexa tenant key, the optional Discord bot token and
// the optional transcription service token from the keystore. A secret that cannot be read is logged and left unset:
// the optional transcription and TTS service tokens from the keystore. A secret that cannot be read is logged and left unset:
// Quorum then answers platform_unavailable for that platform instead of the
// hive failing to boot.
func meetingsQuorumOptions(ctx context.Context, m config.MeetingsConfig, logger *slog.Logger) quorumproc.Options {
Expand All @@ -51,6 +51,10 @@ func meetingsQuorumOptions(ctx context.Context, m config.MeetingsConfig, logger
if err != nil && logger != nil {
logger.Warn("[meetings] transcription service token unreadable; Discord audio is not transcribed", "error", err)
}
ttsToken, err := m.TTSToken(ctx)
if err != nil && logger != nil {
logger.Warn("[meetings] TTS service token unreadable; Discord replies are not spoken", "error", err)
}
return quorumproc.Options{
Binary: m.QuorumBinary(),
Listen: m.QuorumListen(),
Expand All @@ -59,7 +63,11 @@ func meetingsQuorumOptions(ctx context.Context, m config.MeetingsConfig, logger
DiscordToken: discordToken,
TranscribeURL: m.TranscribeURLOrEmpty(),
TranscribeToken: transcribeToken,
Logger: logger,
TTSURL: m.TTSURLOrEmpty(),
TTSToken: ttsToken,
// Discord speaks in the persona's voice by default.
TTSVoice: m.Persona.Resolve().Voice,
Logger: logger,
}
}

Expand Down Expand Up @@ -123,6 +131,8 @@ func wireMeetingsManager(cfg *config.Config, sup quorumSupervisor, logger *slog.
BotName: cfg.Meetings.BotNameOrDefault(),
ConsentText: cfg.Meetings.ConsentTextOrDefault(),
LeavePhrases: cfg.Meetings.Persona.Resolve().LeavePhrases,
// meeting.join's voice_id: the persona's voice on every platform.
VoiceID: cfg.Meetings.Persona.Resolve().Voice,
LobbyTimeout: time.Duration(cfg.Meetings.LobbyTimeoutSOrDefault()) * time.Second,
Logger: logger,
// Vexa fixes speaking ability at join time, so with voice-on-address
Expand Down
18 changes: 14 additions & 4 deletions src/cmd/hive/meetingswire_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func TestWireMeetingsStarts(t *testing.T) {
if err := os.WriteFile(txFile, []byte("tx-secret\n"), 0o600); err != nil {
t.Fatal(err)
}
ttsFile := filepath.Join(dir, "tts")
if err := os.WriteFile(ttsFile, []byte("tts-secret\n"), 0o600); err != nil {
t.Fatal(err)
}
fake := &fakeQuorumSup{}
var got quorumproc.Options
withQuorumSupervisor(t, func(o quorumproc.Options) (quorumSupervisor, error) {
Expand All @@ -80,6 +84,8 @@ func TestWireMeetingsStarts(t *testing.T) {
Discord: config.MeetingsDiscordConfig{TokenFile: filepath.Join(dir, "missing")},
TranscribeURL: "http://vexa-transcription.meetings.svc.cluster.local:8000",
TranscribeTokenFile: txFile,
TTSURL: "http://vexa-tts.meetings.svc.cluster.local:8880",
TTSTokenFile: ttsFile,
}}
var logs bytes.Buffer
sup := wireMeetings(context.Background(), cfg, slog.New(slog.NewTextHandler(&logs, nil)))
Expand All @@ -91,8 +97,11 @@ func TestWireMeetingsStarts(t *testing.T) {
got.TranscribeToken != "tx-secret" || got.TranscribeURL != "http://vexa-transcription.meetings.svc.cluster.local:8000" {
t.Fatalf("options %+v", got)
}
if strings.Contains(logs.String(), "tenant") || strings.Contains(logs.String(), "tx-secret") {
t.Fatal("the tenant key and transcription token must never be logged")
if got.TTSToken != "tts-secret" || got.TTSURL != "http://vexa-tts.meetings.svc.cluster.local:8880" || got.TTSVoice != "af_heart" {
t.Fatalf("tts options url=%q voice=%q token set=%v", got.TTSURL, got.TTSVoice, got.TTSToken != "")
}
if strings.Contains(logs.String(), "tenant") || strings.Contains(logs.String(), "tx-secret") || strings.Contains(logs.String(), "tts-secret") {
t.Fatal("the tenant key and service tokens must never be logged")
}
}

Expand Down Expand Up @@ -130,14 +139,15 @@ func TestMeetingsQuorumOptionsUnreadableSecrets(t *testing.T) {
Vexa: config.MeetingsVexaConfig{APIKeyFile: dir},
Discord: config.MeetingsDiscordConfig{TokenFile: dir},
TranscribeTokenFile: dir,
TTSTokenFile: dir,
}
var logs bytes.Buffer
o := meetingsQuorumOptions(context.Background(), m, slog.New(slog.NewTextHandler(&logs, nil)))
if o.VexaAPIKey != "" || o.DiscordToken != "" || o.TranscribeToken != "" {
if o.VexaAPIKey != "" || o.DiscordToken != "" || o.TranscribeToken != "" || o.TTSToken != "" {
t.Fatal("unreadable secrets must be left unset")
}
if !strings.Contains(logs.String(), "Vexa tenant key unreadable") || !strings.Contains(logs.String(), "Discord bot token unreadable") ||
!strings.Contains(logs.String(), "transcription service token unreadable") {
!strings.Contains(logs.String(), "transcription service token unreadable") || !strings.Contains(logs.String(), "TTS service token unreadable") {
t.Fatalf("logs %q", logs.String())
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/docs/api-reference/knowledge.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f
| `POST` | `/api/inbox/recordings/{id}/finalize` | The recorder | End a recording: `{duration_ms?}` (the recorder's count, pauses excluded). The chunks are concatenated in order into `audio.webm` or `audio.mp4`, a pending Knowledge fact (personal layer) is written and the item appears in the Inbox. 200 `{id, state, title, duration_ms, bytes, chunks, transcribes}`; audited as `inbox_recording_finalize` (400 no chunk received, 403, 404, 409 already ended) | `pkg/dashboard/api_inbox_recordings.go:22` |
| `DELETE` | `/api/inbox/recordings/{id}` | The recorder, or an owner | Abort an in-progress recording and delete its chunks; audited as `inbox_recording_abort` (403, 404, 409 already ended) | `pkg/dashboard/api_inbox_recordings.go:23` |
| `GET` | `/api/inbox/recordings/{id}/audio` | Owner or read-write | Play a finished recording from this hive's disk on the dashboard origin: `http.ServeContent` (Range, 206), `Content-Type` audio/webm or audio/mp4, `Cache-Control: no-store`, `Cross-Origin-Resource-Policy: same-origin`. Opening a playback is audited as `inbox_recording_audio` (seeks are not). `GET /api/inbox/hive-recording/{id}/audio/stream` serves the same file (404 unknown or not finished, 410 audio expired after `inbox.recording.retention_days`) | `pkg/dashboard/api_inbox_recordings.go:24` |
| `GET` | `/api/meetings/settings` | Owner only | Meetings settings: `enabled`, `enabled_env_override`, `running`, `vexa_url`, `vexa_key_set`, `discord_token_set`, `transcribe_token_set` (secrets are never returned) and `effective` values of the other `meetings.*` keys ([env vars](../env-vars.md#meetings-quorum)) | `pkg/dashboard/api_meetings.go:123` |
| `POST` | `/api/meetings/settings` | Owner only | Update `meetings.enabled` and `meetings.vexa.url`, and write the Vexa tenant key, Discord bot token and transcription service token to keystore-sealed secret files (`""` clears one): `{enabled?, vexa_url?, vexa_api_key?, discord_token?, transcribe_token?}`. Returns the settings with `restart_required`; 400 on an invalid value. Audited as `meetings_settings` | `pkg/dashboard/api_meetings.go:124` |
| `GET` | `/api/meetings/settings` | Owner only | Meetings settings: `enabled`, `enabled_env_override`, `running`, `vexa_url`, `vexa_key_set`, `discord_token_set`, `transcribe_token_set`, `tts_token_set` (secrets are never returned) and `effective` values of the other `meetings.*` keys ([env vars](../env-vars.md#meetings-quorum)) | `pkg/dashboard/api_meetings.go:123` |
| `POST` | `/api/meetings/settings` | Owner only | Update `meetings.enabled` and `meetings.vexa.url`, and write the Vexa tenant key, Discord bot token, transcription service token and TTS service token to keystore-sealed secret files (`""` clears one): `{enabled?, vexa_url?, vexa_api_key?, discord_token?, transcribe_token?, tts_token?}`. Returns the settings with `restart_required`; 400 on an invalid value. Audited as `meetings_settings` | `pkg/dashboard/api_meetings.go:124` |
| `POST` | `/api/meetings` | Owner only | Send hive to a meeting: `{url}` for Google Meet, Teams or Zoom, or `{platform: "discord", guild_id, channel_id}`, plus `title?` and `voice?`. Returns the meeting record; 400 invalid request, 502 Quorum refused, 503 meetings off. Audited as `meeting_join` | `pkg/dashboard/api_meetings.go:125` |
| `GET` | `/api/meetings` | Owner only | `{meetings: [...]}`, newest first | `pkg/dashboard/api_meetings.go:126` |
| `GET` | `/api/meetings/{id}` | Owner only | `{meeting, transcript, live}`: the record, stored final segments and chat, and the live-loop state (notes, research, asks, budget); 404 unknown | `pkg/dashboard/api_meetings.go:127` |
Expand Down
5 changes: 4 additions & 1 deletion src/docs/env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ Hive as a live meeting participant ([#18284](https://github.com/hivecommons/hive
| `HIVE_MEETINGS_TRANSCRIBE_URL` | No | none | Shared transcription service for Discord audio (passed as `QUORUM_TRANSCRIBE_URL`). Overrides `meetings.transcribe_url`. In-cluster: `http://vexa-transcription.meetings.svc.cluster.local:8000`. |
| `HIVE_MEETINGS_TRANSCRIBE_TOKEN` | No | none | Transcription service token. Secret. Wins over the secret file. Hive passes it to Quorum as `QUORUM_TRANSCRIBE_TOKEN_FILE`; without it Discord audio is not transcribed. |
| `HIVE_MEETINGS_TRANSCRIBE_TOKEN_FILE` | No | `/data/secrets/meetings_transcribe_token` | Keystore-sealed secret file holding the transcription service token. Overrides `meetings.transcribe_token_file`. |
| `HIVE_MEETINGS_TTS_URL` | No | none | Text-to-speech service Quorum speaks Discord replies with (passed as `QUORUM_TTS_URL`). Overrides `meetings.tts_url`. In-cluster on hive-oke: `http://vexa-tts.meetings.svc.cluster.local:8880`. |
| `HIVE_MEETINGS_TTS_TOKEN` | No | none | TTS service token. Secret. Wins over the secret file. Hive passes it to Quorum as `QUORUM_TTS_TOKEN_FILE`, with `QUORUM_TTS_VOICE` set to the persona's voice; without it Discord replies stay in chat. On hive-oke, copied by the operator from Secret `vexa-tts` in namespace `meetings`. |
| `HIVE_MEETINGS_TTS_TOKEN_FILE` | No | `/data/secrets/meetings_tts_token` | Keystore-sealed secret file holding the TTS service token. Overrides `meetings.tts_token_file`. |
| `HIVE_MEETINGS_DELIVERY` | No | `chat` | Default delivery for meeting output. Only `chat` is supported. |
| `HIVE_MEETINGS_VOICE_ON_ADDRESS` | No | `true` | Lets hive speak when addressed by name in a meeting whose voice is enabled; otherwise it answers in chat. |
| `HIVE_MEETINGS_BOT_NAME` | No | the persona's display name (`Betty Bee from the hive`), or `hive (notes)` with the persona off | Display name the meeting bot joins with. |
Expand All @@ -414,7 +417,7 @@ Hive as a live meeting participant ([#18284](https://github.com/hivecommons/hive
| `HIVE_MEETINGS_PERSONA_ALIASES` | No | `betty,betty bee,hive` | Comma-separated names that address the persona at the start or end of a line. |
| `HIVE_MEETINGS_PERSONA_PRONOUNS` | No | `she/her` | Pronouns used in the intro and self-description only. |
| `HIVE_MEETINGS_PERSONA_LANGUAGE` | No | `en-US` | BCP-47 tag; replies use its language and regional conventions. |
| `HIVE_MEETINGS_PERSONA_VOICE` | No | `af_heart` | TTS voice id for spoken replies (Kokoro; stored for spoken replies, not used yet). |
| `HIVE_MEETINGS_PERSONA_VOICE` | No | `af_heart` | TTS voice id for spoken replies (a Kokoro voice id), passed to Quorum as `QUORUM_TTS_VOICE` and as `voice_id` on `meeting.join`. |
| `HIVE_MEETINGS_PERSONA_VOICE_TYPE` | No | `female` | `female`, `male` or `bot`; descriptive only. |
| `HIVE_MEETINGS_PERSONA_ACCENT` | No | `American` | Free text; descriptive only. |
| `HIVE_MEETINGS_PERSONA_INTRO_TEMPLATE` | No | the preset's intro | Intro posted when someone asks the persona to introduce itself. Placeholders `{name}`, `{display_name}`, `{pronouns}`, `{leave}`, `{accent}`, `{voice_type}`, `{language}`. |
Expand Down
13 changes: 12 additions & 1 deletion src/docs/meetings.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Hive attends meetings as a persona: **Betty** ("Betty Bee from the hive", she/he
A persona is a preset (`meetings.persona.preset`, default `betty`) plus any field set explicitly; every field also has an `HIVE_MEETINGS_PERSONA_*` override ([env-vars.md](env-vars.md#meetings-quorum)).

- `language` is a BCP-47 tag (default `en-US`). Betty replies in that language and its regional conventions (American spelling for `en-US`).
- `voice` is the text-to-speech voice id (default `af_heart`, a Kokoro voice) kept for spoken replies, which are not built yet. Kokoro voice ids encode accent and gender: `af_*` is American female, `am_*` American male, `bf_*` and `bm_*` British female and male. A future persona picks a different voice id. A "bot-type" voice would be a different TTS voice or an effect, which is not built yet.
- `voice` is the text-to-speech voice id (default `af_heart`, a Kokoro voice) her spoken replies use: hive passes it to Quorum as `QUORUM_TTS_VOICE` for Discord and as `voice_id` on every `meeting.join`. Kokoro voice ids encode accent and gender: `af_*` is American female, `am_*` American male, `bf_*` and `bm_*` British female and male. A future persona picks a different voice id. A "bot-type" voice would be a different TTS voice or an effect, which is not built yet.
- `voice_type` (`female`, `male` or `bot`, default `female`), `accent` (free text, default `American`) and `pronouns` (default `she/her`) describe the persona in the intro and her self-description only; they do not change behaviour.
- `intro_template` placeholders: `{name}`, `{display_name}`, `{pronouns}`, `{leave}` (the first leave phrase), `{accent}`, `{voice_type}`, `{language}`.
- `searxng_url` is reserved for web search (phase B) and unused for now.
Expand Down Expand Up @@ -135,6 +135,15 @@ Discord audio is transcribed by the shared transcription service, which needs tw

Without the URL and token Discord meetings join but nothing is transcribed. All three (bot token, transcribe URL, transcription token) apply after a restart.

Spoken replies on Discord (Quorum v0.2.0 and later) go through a text-to-speech service, Kokoro's `/v1/audio/speech`, which needs two settings of its own:

- the TTS URL, `meetings.tts_url` (or `HIVE_MEETINGS_TTS_URL`). On hive-oke the `vexa-tts` Service in the `meetings` namespace answers in-cluster at `http://vexa-tts.meetings.svc.cluster.local:8880`;
- the TTS token. Paste it in the **TTS token** field in **Settings, Meetings** (or set `HIVE_MEETINGS_TTS_TOKEN`). Like the transcription token it is write-only: hive stores it keystore-sealed at `meetings.tts_token_file` (`/data/secrets/meetings_tts_token`), the API reports only `tts_token_set`, and at boot hive writes the plaintext to an owner-only file in Quorum's private runtime directory and passes it as `QUORUM_TTS_TOKEN_FILE`. On hive-oke the operator copies the token from the Secret `vexa-tts` in the `meetings` namespace.

Hive also passes `QUORUM_TTS_VOICE` (the persona's voice, `meetings.persona.voice`, default `af_heart`) and sends the same voice as `voice_id` on every `meeting.join`, so Betty sounds the same on Discord and on the Vexa platforms. Without the TTS URL and token, Discord replies stay in chat. Both apply after a restart.

Quorum v0.2.0 ignores `voice: false` on Discord (a Discord bot can always speak), so hive's own policy is the gate: it never calls `say` for a meeting whose voice is off, on any platform, and answers in chat instead.

Discord voice also needs the native `@snazzah/davey` module next to the Quorum bundle; the hive image installs it.

Anyone in the Discord server can ask for hive with `/hive join`. The request shows in **Meetings** as a join request with **Approve** and **Decline**; hive joins only when the owner approves it. (No Discord account is mapped to the hive owner yet, so no request is approved automatically.)
Expand All @@ -153,6 +162,8 @@ Every key has an environment override that wins over `hive.yaml`. The full list
| `meetings.discord.token_file` | `/data/secrets/meetings_discord_token` | Keystore-sealed Discord bot token file. |
| `meetings.transcribe_url` | none | Transcription service for Discord audio. |
| `meetings.transcribe_token_file` | `/data/secrets/meetings_transcribe_token` | Keystore-sealed transcription service token file. |
| `meetings.tts_url` | none | Text-to-speech service for Discord speech (`QUORUM_TTS_URL`). |
| `meetings.tts_token_file` | `/data/secrets/meetings_tts_token` | Keystore-sealed TTS service token file. |
| `meetings.delivery` | `chat` | Where meeting output goes. |
| `meetings.voice_on_address` | `true` | Allow speaking when addressed in a voice-enabled meeting. |
| `meetings.bot_name` | the persona's display name | Bot display name; `hive (notes)` with the persona off. |
Expand Down
Loading
Loading