Documentation
¶
Overview ¶
Package textgen is the official AI text module: the Enhancer and the Translator over OpenAI-compatible APIs.
Index ¶
- Constants
- type Module
- func (m *Module) AdminManifest() kernel.AdminExtensionManifest
- func (m *Module) Handler() *api.TextGenHandler
- func (m *Module) Init(_ kernel.Kernel) error
- func (m *Module) Name() string
- func (m *Module) Optional() []string
- func (m *Module) RefreshThemeStyles(baseCSS, styleCSS string)
- func (m *Module) Requires() []string
- func (m *Module) Service() textgendomain.TextGenerationService
- func (m *Module) Shutdown() error
- func (m *Module) Version() string
- type Option
Constants ¶
const Name = "textgen"
Name is the registry key for this module.
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 textgen kernel module.
func New ¶
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 TipTap toolbar buttons render 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.TextGenHandler
Handler exposes the text generation handler for core mounting. Core mounts it explicitly (rather than via RouteProvider) because the surface is gated by the textGenEnabled feature flag, which a single RegisterRoutes call cannot express.
func (*Module) Init ¶
Init wires the module. The handler is already built by New; Init only validates presence.
func (*Module) Optional ¶
Optional lists soft dependencies. Media context enriches HTML prompts and the site-ssr theme bakes design tokens into them; absent either, enhance/translate still work.
func (*Module) RefreshThemeStyles ¶ added in v1.5.0
RefreshThemeStyles forwards the active theme's styles to the refresher the composition root attached (nil-safe: without one the call is a no-op).
func (*Module) Requires ¶
Requires lists hard dependencies. Text generation degrades gracefully without media context or theme design tokens, so nothing is required.
func (*Module) Service ¶
func (m *Module) Service() textgendomain.TextGenerationService
Service exposes the adopted text generation service. It stays valid for the module's lifetime.
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 WithLogger ¶
WithLogger attaches the module logger. Without one handler failures are dropped (discard sink).
func WithMediaLister ¶
func WithMediaLister(lister api.MediaLister) Option
WithMediaLister attaches the media library for AI context injection. The media domain service satisfies it structurally; without one the handler generates without media context (the legacy behavior when media is absent).
func WithService ¶
func WithService(service textgendomain.TextGenerationService) Option
WithService adopts the text generation service (composition root, nil when unconfigured). The handler is only mounted when a service exists.
func WithThemeRefresher ¶ added in v1.5.0
WithThemeRefresher attaches the callback the edition invokes after a theme reload so AI HTML generation follows the new brand without a restart. The callback receives the active theme's minified base.css and style.css.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for text generation.
|
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for text generation. |
|
Package textgen is the AI text module's domain layer: the text-generation port, its result value types, and the parser that validates the model's JSON envelope.
|
Package textgen is the AI text module's domain layer: the text-generation port, its result value types, and the parser that validates the model's JSON envelope. |
|
Package infrastructure adapts the text module's domain port onto OpenAI-compatible chat-completion APIs.
|
Package infrastructure adapts the text module's domain port onto OpenAI-compatible chat-completion APIs. |
|
Package testutil provides the kernel fixture module tests run against.
|
Package testutil provides the kernel fixture module tests run against. |