Documentation
¶
Overview ¶
Package infrastructure adapts the plugingen domain port onto OpenAI-compatible chat-completion APIs. Prompt construction grounds the model on the distilled plugin contract; response validation stays in the domain's envelope parser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRepairPrompt ¶
func BuildRepairPrompt(brief plugingendomain.Brief, projectFiles map[string]string, problems []string) string
BuildRepairPrompt feeds validation findings back to the model.
func BuildSystemPrompt ¶
func BuildSystemPrompt(sources plugingendomain.PluginSources) string
BuildSystemPrompt assembles the plugin generation system prompt from the distilled contract plus the edition's grounding sources.
func BuildUserPrompt ¶
func BuildUserPrompt(brief plugingendomain.Brief) string
BuildUserPrompt assembles the user prompt from the brief.
Types ¶
type OpenAIPluginService ¶
type OpenAIPluginService struct {
// contains filtered or unexported fields
}
OpenAIPluginService implements plugingendomain.PluginGenerationService over any OpenAI-compatible chat-completion API.
func NewOpenAIPluginService ¶
func NewOpenAIPluginService(apiKey, baseURL, model string) *OpenAIPluginService
NewOpenAIPluginService builds the OpenAI-compatible plugin generation service. baseURL is optional ("" = provider default); model names the chat model.
func (*OpenAIPluginService) GenerateProject ¶
func (s *OpenAIPluginService) GenerateProject( ctx context.Context, brief plugingendomain.Brief, sources plugingendomain.PluginSources, ) (plugingendomain.Project, error)
GenerateProject asks the model for the JSON envelope and validates it via the domain parser. Files stay verbatim so validation and the repair loop see the model's original output. A response that is not valid JSON gets one immediate re-ask through the repair prompt — malformed output is the most common real failure mode, and without this the service-level repair loop (which only runs on parsed projects) would never engage.
func (*OpenAIPluginService) RepairProject ¶
func (s *OpenAIPluginService) RepairProject( ctx context.Context, brief plugingendomain.Brief, sources plugingendomain.PluginSources, project plugingendomain.Project, problems []string, ) (plugingendomain.Project, error)
RepairProject feeds validation problems back to the model (the caller bounds the attempts). The system prompt matches the generation one so the contract stays identical across repairs.
type TinyGoBuilder ¶
type TinyGoBuilder struct {
// contains filtered or unexported fields
}
TinyGoBuilder implements plugingendomain.Builder by compiling the project with TinyGo (WASI target), load-checking the result in wazero, and installing the .wasm plus the synthesized capability manifest into the host's plugins directory.
func NewTinyGoBuilder ¶
func NewTinyGoBuilder(tinygoPath, pluginsDir string, buildTimeout time.Duration, devMode bool, run runFunc) *TinyGoBuilder
NewTinyGoBuilder builds a server-side WASM builder. tinygoPath names the TinyGo binary ("" resolves to PATH lookup); pluginsDir is the host's plugins directory; buildTimeout caps one compile (<=0 selects the default); devMode reports no restart (the watcher hot-reloads instead). The run seam defaults to a real subprocess; tests stub it.
func (*TinyGoBuilder) Build ¶
func (b *TinyGoBuilder) Build(ctx context.Context, project plugingendomain.Project) (plugingendomain.BuildResult, error)
Build compiles the project, load-checks the result, and installs the manifest plus the .wasm into the host's plugins directory. The manifest installs first: a DEV_MODE watcher reloads on .wasm changes, so a wasm-first order could hot-load a plugin whose manifest (and grants) is not installed yet. An existing installed plugin refuses with ErrPluginInstalled; a compile or load failure wraps ErrBuildFailed with the signaling tail.