Files
chatkit/dist/react/index.js
T
CatoandClaude 8452fb12ab VoiceMode: talking with a chat, and a microphone that cannot be opened twice (0.30.0) (#89)
Cat Bot has to be a complete equivalent of Grok Bot, which has a voice mode.
The chat could take dictation and read an answer aloud, but not hold a
spoken conversation.

- VoiceMode (the screen), useVoiceMode (the loop), voiceModeReducer (the
  rules, pure): listening -> thinking -> speaking -> listening. One big
  button ends the person's turn (a pause ends it by itself where the
  browser's recogniser runs) and cuts in while the answer is read. The app
  passes onTurn(text) => Promise<answer> and, if it has one, a studio
  speaker.
- The microphone and the voice follow the phase and nothing else
  (voiceModeWants): never both open, neither open when the call is off. Two
  empty takes, a failed transcription or an answer that never comes each end
  the call in words, with "Talk again".
- Fix, useDictation: a second start() before the browser had handed the
  microphone over opened a second microphone and orphaned the first, whose
  track stayed live with nothing left to stop it. One request at a time now,
  and a take cancelled while the microphone was still opening closes it
  where it arrives. Found by this change's browser test.
- Its styles are their own section and styles/voice.css, so the embedded
  chat sheet stays inside its 11 KB budget.

test/voice-mode.test.js (8) and test/browser-voice.mjs (a real browser, a
fake-device microphone, every opened track counted). pnpm run verify passes.


Claude-Session: https://claude.ai/code/session_019MDtmt4p1jMfJnbJtpeNhi

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-13 08:18:12 +01:00

30 lines
1.9 KiB
JavaScript

/**
* @bitbaum/chatkit/react — the chat every product uses.
*
* import { Composer, ChatThread, ChatStarters } from "@bitbaum/chatkit/react";
* import "@bitbaum/chatkit/styles.css";
*
* Behaviour is fixed here and identical everywhere; the look follows the
* app's tokens through `--ck-*` variables (see styles.css).
*/
export { Composer, DEFAULT_COMPOSER_LABELS } from "./Composer.js";
export { ChatThread, ChatMessage, ChatReplies, ChatStarters, starterParts, ThinkingRow, formatThinkingDuration, DEFAULT_THREAD_LABELS, } from "./Thread.js";
export { DictationField, DEFAULT_DICTATION_FIELD_LABELS } from "./DictationField.js";
export { CommentThread, CommentRefused, commentFailure, DEFAULT_COMMENT_THREAD_LABELS, } from "./CommentThread.js";
export { ChatScreen } from "./Screen.js";
export { Markdown, SourcesRow, defaultRenderLink, defaultRenderCitation } from "./Markdown.js";
export { AnswerActions, DEFAULT_ANSWER_ACTIONS_LABELS } from "./AnswerActions.js";
export { useSpeech } from "./use-speech.js";
export { useVoiceMode } from "./use-voice-mode.js";
export { VoiceMode, DEFAULT_VOICE_MODE_LABELS } from "./VoiceMode.js";
export { Sheet, prefersSheet } from "./Sheet.js";
export { useDictation } from "./use-dictation.js";
export { AttachMenu, DEFAULT_ATTACH_MENU_LABELS } from "./AttachMenu.js";
export { useAttachments, readAttachmentFile, readAttachmentFiles } from "./use-attachments.js";
export { useClipboard, useStickToBottom, useViewportHeight, useAutoGrow } from "./hooks.js";
export { RichAnswerBlock, ChartTableFigure } from "./RichBlock.js";
export { RichRenderersContext, useRichRenderers } from "./renderers.js";
export { ChatApp, DEFAULT_CHAT_APP_LABELS, takeDeepLink } from "./ChatApp.js";
export { ChatHistory } from "./ChatHistory.js";
export { useChatApp, isTemporaryId, ChatTurnError, chatTurnFailure } from "./use-chat-app.js";
//# sourceMappingURL=index.js.map