speech

package module
v1.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 4 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

modules/speech

Official Lesstruct module: voice dictation — speech-to-text transcription over Meta Model API (Muse Voice Transcribe) or any OpenAI-compatible endpoint, enhanced into TipTap content by the text generation service.

Layout (module template)

module.go            # kernel.Module (single registry-facing file)
api/                 # browser handler (legacy envelope) + mocks
domain/              # SpeechToTextService, Transcription, WAV validator
infrastructure/      # Meta + OpenAI-compatible provider adapters
admin/               # admin-shell manifest (empty: Dictate button renders data-driven)
testutil/            # kernel fixture for module tests

Handlers

The browser-realm api.SpeechHandler serves Transcribe with the legacy error:null envelope. It validates the upload (mono 16-bit PCM WAV at 16/24 kHz, 10 MB max), transcribes it through the adopted provider, and enhances the transcript into TipTap content with SEO metadata through the adopted transcription enhancer (the textgen service). The Dictate button renders data-driven from the /api/health feature flags, so the module declares no admin extensions. Core mounts the handler explicitly through the structural SpeechSurface interface in routes.go (the speechEnabled feature flag gates mounting — it composes speech-to-text and text generation, since the transcript is enhanced into content), so routes stay module-agnostic and paths never drift.

Documentation

Overview

Package speech is the official voice-dictation module: speech-to-text transcription over Meta Model API or any OpenAI-compatible endpoint, enhanced into TipTap content by the text generation service.

Index

Constants

View Source
const Name = "speech"

Name is the registry key for this module.

View Source
const Version = "0.1.0"

Version is the module version reported via Module.Version.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module is the speech kernel module.

func New

func New(opts ...Option) *Module

New builds the module, adopting the composition root's wiring. The handler is built once here so routes serve the same instance.

func (*Module) AdminManifest

func (m *Module) AdminManifest() kernel.AdminExtensionManifest

AdminManifest declares this module's admin-shell extensions. The Dictate button renders data-driven from the /api/health feature flags, so the module declares no menu entries, settings sections, or editor extensions.

func (*Module) Handler

func (m *Module) Handler() *api.SpeechHandler

Handler exposes the speech handler for core mounting. Core mounts it explicitly (rather than via RouteProvider) because the surface is gated by the speechEnabled feature flag, which a single RegisterRoutes call cannot express.

func (*Module) Init

func (m *Module) Init(_ kernel.Kernel) error

Init wires the module. The handler is already built by New; Init only validates presence.

func (*Module) Name

func (m *Module) Name() string

Name returns the registry key.

func (*Module) Optional

func (m *Module) Optional() []string

Optional lists soft dependencies. The text generation service is adopted directly (not via the registry), so no module coordination is needed.

func (*Module) Requires

func (m *Module) Requires() []string

Requires lists hard dependencies. Dictation degrades to unmounted when the providers are unconfigured, so nothing is required.

func (*Module) Service

Service exposes the adopted transcription service. It stays valid for the module's lifetime.

func (*Module) Shutdown

func (m *Module) Shutdown() error

Shutdown releases module resources. There are none beyond memory.

func (*Module) Version

func (m *Module) Version() string

Version returns the module version.

type Option

type Option func(*Module)

Option configures a Module. The composition root supplies every option; direct construction without options yields a standalone module that serves nothing (the handler built over nil dependencies must not be invoked).

func WithEnhancer

func WithEnhancer(enhancer api.TranscriptionEnhancer) Option

WithEnhancer adopts the transcription enhancer (the text generation service from the composition root, nil when unconfigured). Without one the handler cannot shape transcripts into content.

func WithLogger

func WithLogger(logger kernel.Logger) Option

WithLogger attaches the module logger. Without one handler failures are dropped (discard sink).

func WithTranscriber

func WithTranscriber(service speechdomain.SpeechToTextService) Option

WithTranscriber adopts the speech-to-text service (composition root, nil when unconfigured). The handler is only mounted when a transcriber exists.

Directories

Path Synopsis
Package admin owns this module's admin-shell extensions: the declarative UI the single admin SPA renders for voice dictation.
Package admin owns this module's admin-shell extensions: the declarative UI the single admin SPA renders for voice dictation.
api
Package speech is the voice-dictation module's domain layer: the speech-to-text port, its result value types, and the WAV validator that keeps unbilled garbage audio from reaching the provider.
Package speech is the voice-dictation module's domain layer: the speech-to-text port, its result value types, and the WAV validator that keeps unbilled garbage audio from reaching the provider.
Package infrastructure adapts the speech module's domain port onto speech-to-text provider APIs.
Package infrastructure adapts the speech module's domain port onto speech-to-text provider APIs.
Package testutil provides the kernel fixture module tests run against.
Package testutil provides the kernel fixture module tests run against.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL