infrastructure

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 14 Imported by: 1 module, 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.

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

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

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

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.

Jump to

Keyboard shortcuts

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