Internal

internal/adapters/providers

Package providers adapts external model providers to scafld review dossiers.

import "github.com/nilstate/scafld/v2/internal/adapters/providers"

Package providers adapts external model providers to scafld review dossiers.

Variables

ErrProviderFailed wraps provider transport and execution failures.

Source: internal/adapters/providers/provider.go:20

var ErrProviderFailed = errors.New("provider failed")

Functions

func ClaudeArgs(binary string, model string, sessionID string, schemaJSON string) []string

Source: internal/adapters/providers/provider.go:287

ClaudeArgs builds the argv for restricted Claude review execution.

func ClaudeEventName(line string) string

Source: internal/adapters/providers/provider.go:438

ClaudeEventName extracts a liveness event name from one Claude stream frame.

func CodexArgs(binary string, root string, outputPath string, model string, schemaPath string) []string

Source: internal/adapters/providers/provider.go:317

CodexArgs builds the argv for read-only Codex review execution.

func ReviewDossierSchemaJSON() string

Source: internal/adapters/providers/schema.go:17

ReviewDossierSchemaJSON returns the provider-facing review dossier schema.

Codex/OpenAI structured outputs require every object property to be listed in required, even when the property is semantically optional. Optional fields are therefore represented as nullable required fields. Provenance fields such as provider, model, session_id, and event_summary are filled by scafld after the provider returns and are intentionally not part of this schema.

func Select(opts Selection) (interface { Invoke(context.Context, review.Request) (review.Dossier, error) }, error)

Source: internal/adapters/providers/provider.go:45

Select returns the configured review provider implementation.

Types

type ClaudeProvider

Source: internal/adapters/providers/provider.go:172

ClaudeProvider invokes Claude in restricted stream-json review mode.

type ClaudeProvider struct {
	Binary      string
	Model       string
	SessionID   string
	SchemaJSON  string
	CWD         string
	Env         []string
	Runner      Runner
	Timeout     time.Duration
	IdleTimeout time.Duration
}
Fields
  • Binary string
  • Model string
  • SessionID string
  • SchemaJSON string
  • CWD string
  • Env []string
  • Runner Runner
  • Timeout time.Duration
  • IdleTimeout time.Duration

func Invoke(ctx context.Context, req review.Request) (review.Dossier, error)

Source: internal/adapters/providers/provider.go:185

Invoke sends the review prompt to Claude and parses the resulting dossier.

type CodexProvider

Source: internal/adapters/providers/provider.go:220

CodexProvider invokes Codex in read-only ephemeral review mode.

type CodexProvider struct {
	Binary      string
	Model       string
	SchemaPath  string
	OutputPath  string
	CWD         string
	Env         []string
	Runner      Runner
	Timeout     time.Duration
	IdleTimeout time.Duration
}
Fields
  • Binary string
  • Model string
  • SchemaPath string
  • OutputPath string
  • CWD string
  • Env []string
  • Runner Runner
  • Timeout time.Duration
  • IdleTimeout time.Duration

func Invoke(ctx context.Context, req review.Request) (review.Dossier, error)

Source: internal/adapters/providers/provider.go:233

Invoke sends the review prompt to Codex and parses the resulting dossier.

type CommandProvider

Source: internal/adapters/providers/provider.go:123

CommandProvider invokes an operator-supplied review command.

type CommandProvider struct {
	Command     string
	CWD         string
	Env         []string
	Runner      Runner
	Timeout     time.Duration
	IdleTimeout time.Duration
}
Fields
  • Command string
  • CWD string
  • Env []string
  • Runner Runner
  • Timeout time.Duration
  • IdleTimeout time.Duration

func Invoke(ctx context.Context, req review.Request) (review.Dossier, error)

Source: internal/adapters/providers/provider.go:133

Invoke sends the review prompt to the command and parses stdout as a dossier.

type LocalProvider

Source: internal/adapters/providers/provider.go:101

LocalProvider emits deterministic local review dossiers for development smoke tests.

type LocalProvider struct {
	Messages []string
}
Fields
  • Messages []string

func Invoke(ctx context.Context, req review.Request) (review.Dossier, error)

Source: internal/adapters/providers/provider.go:106

Invoke returns a dossier from configured local messages.

type Runner

Source: internal/adapters/providers/provider.go:23

Runner is the process execution port required by external providers.

type Runner interface {
	Run(context.Context, execution.Request) (execution.Result, error)
}
Methods
  • Run func(context.Context, execution.Request) (execution.Result, error)

type Selection

Source: internal/adapters/providers/provider.go:28

Selection contains provider choice, model, timeout, and runner configuration.

type Selection struct {
	Provider       string
	Command        string
	Binary         string
	Model          string
	CodexModel     string
	ClaudeModel    string
	CodexBinary    string
	ClaudeBinary   string
	CWD            string
	Runner         Runner
	Timeout        time.Duration
	Idle           time.Duration
	FallbackPolicy string
}
Fields
  • Provider string
  • Command string
  • Binary string
  • Model string
  • CodexModel string
  • ClaudeModel string
  • CodexBinary string
  • ClaudeBinary string
  • CWD string
  • Runner Runner
  • Timeout time.Duration
  • Idle time.Duration
  • FallbackPolicy string