Documentation
¶
Index ¶
- Constants
- Variables
- func CatalogExecutionFingerprint(parts ...string) string
- func CostSourceValues() []string
- func CostStatusValues() []string
- func HasFreshTransportBinding(model Model, now time.Time) bool
- func IsValidEffort(value string) bool
- func NormalizeExtensionSourceSlug(extensionName string) (string, error)
- func NormalizeReleaseDate(value string) (*string, error)
- func ReasoningEffortValues() []string
- func ReasoningSourceValues() []string
- func RedactString(value string) string
- func RequiresLiveTransportBinding(runtimeProvider, modelID string) bool
- func SourceKindExtensionID(extensionName string) (string, error)
- func SourceKindProviderLiveID(providerID string) string
- func ValidateModelOptionSelection(selection ModelOptionSelection) error
- func ValidateSourceID(sourceID string) error
- func ValidateSourceIdentity(sourceID string, kind SourceKind) error
- type ACPModelProbe
- type ACPModelProbeRequest
- type AppServerCodexModelProbe
- type AvailabilityState
- type CatalogExecutionContext
- type CatalogService
- func (s *CatalogService) CommitRefreshPlan(ctx context.Context, plan *RefreshPlan) error
- func (s *CatalogService) ListModels(ctx context.Context, opts ListOptions) ([]Model, error)
- func (s *CatalogService) ListSourceStatus(ctx context.Context, opts StatusOptions) ([]SourceStatus, error)
- func (s *CatalogService) NewRefreshPlan() (*RefreshPlan, error)
- func (s *CatalogService) Refresh(ctx context.Context, opts RefreshOptions) ([]SourceStatus, error)
- func (s *CatalogService) SetDefaultExecutionContext(value CatalogExecutionContext) error
- func (s *CatalogService) UpdateMergeOptions(options MergeOptions)
- type CatalogView
- type CodexModelMetadata
- type CodexModelProbe
- type CostResult
- type CostSource
- type CostStatus
- type DiscoveryCommandExecutor
- type DiscoveryCommandRequest
- type DiscoveryCommandResult
- type EnvSecretResolver
- type ExecDiscoveryCommandExecutor
- type ExecutionScope
- type InvalidReasoningEffortError
- type InvalidViewError
- type ListOptions
- type LiveProviderSource
- func (s *LiveProviderSource) BootstrapOnList() bool
- func (s *LiveProviderSource) CatalogExecutionFingerprint() (string, error)
- func (s *LiveProviderSource) CloneWithProvider(provider compozyconfig.ProviderConfig) (*LiveProviderSource, bool, error)
- func (s *LiveProviderSource) DiscoveryTimeout() time.Duration
- func (s *LiveProviderSource) ID() string
- func (s *LiveProviderSource) Kind() SourceKind
- func (s *LiveProviderSource) ListModels(ctx context.Context, opts ListOptions) ([]ModelRow, error)
- func (s *LiveProviderSource) Priority() int
- func (s *LiveProviderSource) ProviderIDs() []string
- func (s *LiveProviderSource) ReplaceProvider(provider compozyconfig.ProviderConfig) bool
- func (s *LiveProviderSource) RetainContextPartitions() bool
- func (s *LiveProviderSource) TTL() time.Duration
- type LiveProviderSourcesConfig
- type MergeOptions
- type Model
- type ModelOptionDescriptor
- type ModelOptionKind
- type ModelOptionSelection
- type ModelOptionValue
- type ModelRow
- type ModelTransportBinding
- type ModelsDevSource
- func (s *ModelsDevSource) ID() string
- func (s *ModelsDevSource) Kind() SourceKind
- func (s *ModelsDevSource) ListModels(ctx context.Context, opts ListOptions) ([]ModelRow, error)
- func (s *ModelsDevSource) Priority() int
- func (s *ModelsDevSource) ProviderIDs() []string
- func (s *ModelsDevSource) TTL() time.Duration
- func (s *ModelsDevSource) Timeout() time.Duration
- type ModelsDevSourceOption
- type ProviderConfigSource
- func (s *ProviderConfigSource) ID() string
- func (s *ProviderConfigSource) Kind() SourceKind
- func (s *ProviderConfigSource) ListModels(_ context.Context, opts ListOptions) ([]ModelRow, error)
- func (s *ProviderConfigSource) Priority() int
- func (s *ProviderConfigSource) ProviderIDs() []string
- func (s *ProviderConfigSource) ReplaceProviders(providers map[string]compozyconfig.ProviderConfig)
- type ProviderSecretResolver
- type ReasoningEffort
- type ReasoningProfile
- type ReasoningSource
- type RefreshOptions
- type RefreshPlan
- type RefreshState
- type Service
- type SessionACPModelProbe
- type Source
- type SourceKind
- type SourceProviderKey
- type SourceRef
- type SourceRowsReplacement
- type SourceStatus
- type StaleFallbackError
- type StatusOptions
- type Store
- type TokenBuckets
Constants ¶
const ( // DefaultLiveDiscoveryTimeout allows cold ACP subprocess initialization. DefaultLiveDiscoveryTimeout = 60 * time.Second // DefaultLiveDiscoveryTTL is the refresh interval for dynamic provider and extension discovery. DefaultLiveDiscoveryTTL = 5 * time.Minute )
const ( // ReasoningEffortNone disables model reasoning explicitly. ReasoningEffortNone = reasoning.EffortNone // ReasoningEffortMinimal is the smallest non-zero reasoning level. ReasoningEffortMinimal = reasoning.EffortMinimal // ReasoningEffortLow is the low reasoning level. ReasoningEffortLow = reasoning.EffortLow // ReasoningEffortMedium is the medium reasoning level. ReasoningEffortMedium = reasoning.EffortMedium // ReasoningEffortHigh is the high reasoning level. ReasoningEffortHigh = reasoning.EffortHigh // ReasoningEffortXHigh is the extra-high reasoning level. ReasoningEffortXHigh = reasoning.EffortXHigh // ReasoningEffortMax requests the provider's maximum supported reasoning level. ReasoningEffortMax = reasoning.EffortMax // ReasoningEffortUltra requests the provider's ultra reasoning level when advertised. ReasoningEffortUltra = reasoning.EffortUltra )
const ( // SourceIDBuiltin is Compozy's offline bootstrap catalog source. SourceIDBuiltin = "builtin" // SourceIDConfig is the operator-authored provider config source. SourceIDConfig = "config" // SourceIDModelsDev is the models.dev catalog source. SourceIDModelsDev = "models_dev" )
const ( // PriorityConfig lets explicit operator config win source conflicts. PriorityConfig = 120 // PriorityProviderLive ranks live provider data above extension rows. PriorityProviderLive = 110 // PriorityExtension ranks extension-provided rows above catalog enrichment. PriorityExtension = 100 // PriorityModelsDev ranks models.dev as catalog enrichment. PriorityModelsDev = 50 // PriorityBuiltin ranks offline bootstrap rows last. PriorityBuiltin = 10 )
Variables ¶
var ( // ErrAllSourcesFailed reports that refresh could not produce usable rows. ErrAllSourcesFailed = errors.New("model catalog: all usable sources failed") // ErrSourceDisabled reports that a source is intentionally disabled. ErrSourceDisabled = errors.New("model catalog: source disabled") // ErrSourceNotRegistered reports that a requested source id is not registered. ErrSourceNotRegistered = errors.New("model catalog: source not registered") )
Functions ¶
func CatalogExecutionFingerprint ¶
CatalogExecutionFingerprint hashes non-secret execution inputs without persisting their contents.
func CostSourceValues ¶
func CostSourceValues() []string
CostSourceValues returns the closed public cost-source enum.
func CostStatusValues ¶
func CostStatusValues() []string
CostStatusValues returns the closed public cost-status enum.
func HasFreshTransportBinding ¶
HasFreshTransportBinding applies the admission cache's ten-minute reuse window.
func IsValidEffort ¶
IsValidEffort reports whether value is a well-formed explicit effort identifier. Empty is deliberately invalid here: it is the separate provider-default sentinel.
func NormalizeExtensionSourceSlug ¶
NormalizeExtensionSourceSlug converts an extension name into the dynamic source-id slug.
func NormalizeReleaseDate ¶
NormalizeReleaseDate validates and normalizes YYYY-MM or YYYY-MM-DD metadata.
func ReasoningEffortValues ¶
func ReasoningEffortValues() []string
ReasoningEffortValues returns the canonical explicit effort vocabulary in display order.
func ReasoningSourceValues ¶
func ReasoningSourceValues() []string
ReasoningSourceValues returns the canonical reasoning provenance vocabulary.
func RedactString ¶
RedactString removes secret-shaped values from catalog errors.
func RequiresLiveTransportBinding ¶
RequiresLiveTransportBinding keeps catalog selection aligned with session admission.
func SourceKindExtensionID ¶
SourceKindExtensionID returns the stable source id for an extension model source.
func SourceKindProviderLiveID ¶
SourceKindProviderLiveID returns the stable source id for a live provider source.
func ValidateModelOptionSelection ¶
func ValidateModelOptionSelection(selection ModelOptionSelection) error
ValidateModelOptionSelection enforces the typed selection invariant.
func ValidateSourceID ¶
ValidateSourceID checks a stable catalog source identity.
func ValidateSourceIdentity ¶
func ValidateSourceIdentity(sourceID string, kind SourceKind) error
ValidateSourceIdentity checks that a source id and kind describe the same source family.
Types ¶
type ACPModelProbe ¶
type ACPModelProbe interface {
InspectModels(context.Context, ACPModelProbeRequest) (acp.SessionModelInspection, error)
}
ACPModelProbe reads model options advertised by a short-lived ACP session.
type ACPModelProbeRequest ¶
type ACPModelProbeRequest struct {
ProviderID string
Command string
Cwd string
Env []string
Timeout time.Duration
}
ACPModelProbeRequest captures one provider ACP discovery invocation.
type AppServerCodexModelProbe ¶
type AppServerCodexModelProbe struct{}
AppServerCodexModelProbe uses a short-lived app server without creating a thread.
func (AppServerCodexModelProbe) InspectCodexModels ¶
func (AppServerCodexModelProbe) InspectCodexModels( ctx context.Context, req DiscoveryCommandRequest, ) (_ []CodexModelMetadata, err error)
InspectCodexModels reads every page and joins the managed subprocess on every exit.
type AvailabilityState ¶
type AvailabilityState string
AvailabilityState identifies how reliable the merged availability signal is.
const ( // AvailabilityStateAvailableLive means a fresh live source reports availability. AvailabilityStateAvailableLive AvailabilityState = "available_live" // AvailabilityStateAvailableStale means a stale live source reports availability. AvailabilityStateAvailableStale AvailabilityState = "available_stale" AvailabilityStateUnavailableLive AvailabilityState = "unavailable_live" AvailabilityStateUnavailableStale AvailabilityState = "unavailable_stale" // AvailabilityStateUnknown means no live or extension source reported availability. AvailabilityStateUnknown AvailabilityState = "unknown" )
type CatalogExecutionContext ¶
type CatalogExecutionContext struct {
Scope ExecutionScope
ProfileID string
WorkspaceID string
CommandFingerprint string
}
CatalogExecutionContext isolates catalog observations produced by one runtime environment. CommandFingerprint is required for non-global contexts before persistence.
func GlobalCatalogExecutionContext ¶
func GlobalCatalogExecutionContext() CatalogExecutionContext
GlobalCatalogExecutionContext returns the sole context for provider-independent sources.
func NormalizeCatalogExecutionScope ¶
func NormalizeCatalogExecutionScope(value CatalogExecutionContext) (CatalogExecutionContext, error)
NormalizeCatalogExecutionScope validates an execution scope before source-specific fingerprinting.
func NormalizePersistedExecutionContext ¶
func NormalizePersistedExecutionContext(value CatalogExecutionContext) (CatalogExecutionContext, error)
NormalizePersistedExecutionContext validates a source context that is ready for persistence.
func (CatalogExecutionContext) ID ¶
func (c CatalogExecutionContext) ID() (string, error)
ID returns a stable, non-sensitive database key for the normalized context.
func (CatalogExecutionContext) WithCommandFingerprint ¶
func (c CatalogExecutionContext) WithCommandFingerprint(fingerprint string) (CatalogExecutionContext, error)
WithCommandFingerprint binds a source fingerprint to a profile or workspace scope.
type CatalogService ¶
type CatalogService struct {
// contains filtered or unexported fields
}
CatalogService refreshes sources and projects stored model catalog rows.
func NewService ¶
func NewService(store Store, sources []Source, mergeOptions MergeOptions) (*CatalogService, error)
NewService creates a model catalog service from a store and source list.
func (*CatalogService) CommitRefreshPlan ¶
func (s *CatalogService) CommitRefreshPlan(ctx context.Context, plan *RefreshPlan) error
CommitRefreshPlan atomically publishes every staged source replacement.
func (*CatalogService) ListModels ¶
func (s *CatalogService) ListModels(ctx context.Context, opts ListOptions) ([]Model, error)
ListModels returns the merged catalog projection.
func (*CatalogService) ListSourceStatus ¶
func (s *CatalogService) ListSourceStatus(ctx context.Context, opts StatusOptions) ([]SourceStatus, error)
ListSourceStatus returns provider-scoped source health rows.
func (*CatalogService) NewRefreshPlan ¶
func (s *CatalogService) NewRefreshPlan() (*RefreshPlan, error)
NewRefreshPlan creates an isolated, read-through refresh generation.
func (*CatalogService) Refresh ¶
func (s *CatalogService) Refresh(ctx context.Context, opts RefreshOptions) ([]SourceStatus, error)
Refresh updates registered sources and returns their latest statuses.
func (*CatalogService) SetDefaultExecutionContext ¶
func (s *CatalogService) SetDefaultExecutionContext(value CatalogExecutionContext) error
SetDefaultExecutionContext defines the profile or workspace scope used when an internal caller omits an explicit catalog execution context.
func (*CatalogService) UpdateMergeOptions ¶
func (s *CatalogService) UpdateMergeOptions(options MergeOptions)
UpdateMergeOptions replaces provider capability inputs for subsequent projections.
type CatalogView ¶
type CatalogView string
CatalogView identifies the public catalog projection to return.
const ( // CatalogViewCurated returns the default operator-facing model set. CatalogViewCurated CatalogView = "curated" // CatalogViewAll returns every current model, including hidden and deprecated rows. CatalogViewAll CatalogView = "all" )
type CodexModelMetadata ¶
type CodexModelMetadata struct {
ID string `json:"id"`
Model string `json:"model"`
DisplayName string `json:"displayName"`
Hidden bool `json:"hidden"`
IsDefault bool `json:"isDefault"`
SupportedReasoningEfforts []struct {
ReasoningEffort string `json:"reasoningEffort"`
} `json:"supportedReasoningEfforts"`
DefaultReasoningEffort string `json:"defaultReasoningEffort"`
}
CodexModelMetadata is the capability subset of the Codex model/list response.
type CodexModelProbe ¶
type CodexModelProbe interface {
InspectCodexModels(context.Context, DiscoveryCommandRequest) ([]CodexModelMetadata, error)
}
CodexModelProbe reads account-scoped model capabilities from the native Codex CLI.
type CostResult ¶
type CostResult struct {
Amount float64
Currency string
Status CostStatus
Source CostSource
}
CostResult is one truthful monetary projection for a usage update.
func EstimateCost ¶
func EstimateCost(model *Model, usage TokenBuckets) (CostResult, bool)
EstimateCost joins usage with independent merged catalog rates for every token bucket.
type CostSource ¶
type CostSource string
CostSource identifies the authority behind a cost result.
const ( CostSourceAgentReported CostSource = "agent_reported" CostSourceCatalogConfig CostSource = "catalog_config" CostSourceModelsDev CostSource = "models_dev" CostSourceBuiltin CostSource = "builtin" CostSourceNone CostSource = "none" )
type CostStatus ¶
type CostStatus string
CostStatus identifies how Compozy obtained a cost result.
const ( CostStatusActual CostStatus = "actual" CostStatusEstimated CostStatus = "estimated" CostStatusIncluded CostStatus = "included" CostStatusUnknown CostStatus = "unknown" )
type DiscoveryCommandExecutor ¶
type DiscoveryCommandExecutor interface {
RunDiscoveryCommand(ctx context.Context, req DiscoveryCommandRequest) (DiscoveryCommandResult, error)
}
DiscoveryCommandExecutor runs a provider discovery command.
type DiscoveryCommandRequest ¶
type DiscoveryCommandRequest struct {
ProviderID string
Command string
Args []string
Dir string
Env []string
Timeout time.Duration
}
DiscoveryCommandRequest describes one timeout-bound discovery subprocess.
type DiscoveryCommandResult ¶
DiscoveryCommandResult captures safe subprocess output for parsing.
type EnvSecretResolver ¶
EnvSecretResolver resolves env: secret refs from an environment lookup.
func (EnvSecretResolver) ResolveRef ¶
ResolveRef resolves one env-backed provider credential ref.
type ExecDiscoveryCommandExecutor ¶
type ExecDiscoveryCommandExecutor struct{}
ExecDiscoveryCommandExecutor runs discovery commands as subprocesses.
func (ExecDiscoveryCommandExecutor) RunDiscoveryCommand ¶
func (ExecDiscoveryCommandExecutor) RunDiscoveryCommand( ctx context.Context, req DiscoveryCommandRequest, ) (_ DiscoveryCommandResult, err error)
RunDiscoveryCommand runs one subprocess with the caller-supplied deadline.
type ExecutionScope ¶
type ExecutionScope string
ExecutionScope identifies the owner boundary for persisted catalog observations.
const ( // ExecutionScopeGlobal owns provider-independent catalog data. ExecutionScopeGlobal ExecutionScope = "global" // ExecutionScopeProfile owns observations derived from one provider profile. ExecutionScopeProfile ExecutionScope = "profile" // ExecutionScopeWorkspace owns observations derived from one workspace runtime. ExecutionScopeWorkspace ExecutionScope = "workspace" )
type InvalidReasoningEffortError ¶
type InvalidReasoningEffortError struct {
ProviderID string
ModelID string
Field string
Effort string
}
InvalidReasoningEffortError reports a non-canonical effort at a catalog source boundary.
func (*InvalidReasoningEffortError) Error ¶
func (e *InvalidReasoningEffortError) Error() string
type InvalidViewError ¶
type InvalidViewError struct {
View string
}
InvalidViewError reports an unsupported public catalog view.
func (*InvalidViewError) Error ¶
func (e *InvalidViewError) Error() string
type ListOptions ¶
type ListOptions struct {
ProviderID string
SourceID string
ExecutionContext CatalogExecutionContext
// SourceContexts owns the resolved execution scope for each selected source ID.
SourceContexts map[string]CatalogExecutionContext
View CatalogView
Refresh bool
SkipRefreshIfEmpty bool
IncludeAll bool
IncludeStale bool
Now time.Time
}
ListOptions filters persisted catalog source rows.
type LiveProviderSource ¶
type LiveProviderSource struct {
// contains filtered or unexported fields
}
LiveProviderSource performs provider model discovery for one provider.
func NewLiveProviderSource ¶
func NewLiveProviderSource( providerID string, provider compozyconfig.ProviderConfig, cfg *LiveProviderSourcesConfig, ) (*LiveProviderSource, error)
NewLiveProviderSource creates one provider_live source.
func (*LiveProviderSource) BootstrapOnList ¶
func (s *LiveProviderSource) BootstrapOnList() bool
BootstrapOnList reports whether the source should discover once before its first catalog projection.
func (*LiveProviderSource) CatalogExecutionFingerprint ¶
func (s *LiveProviderSource) CatalogExecutionFingerprint() (string, error)
CatalogExecutionFingerprint identifies the effective live discovery invocation without storing secrets.
func (*LiveProviderSource) CloneWithProvider ¶
func (s *LiveProviderSource) CloneWithProvider( provider compozyconfig.ProviderConfig, ) (*LiveProviderSource, bool, error)
CloneWithProvider copies a live source with a staged provider configuration.
func (*LiveProviderSource) DiscoveryTimeout ¶
func (s *LiveProviderSource) DiscoveryTimeout() time.Duration
DiscoveryTimeout returns the configured deadline for this provider's live probe.
func (*LiveProviderSource) ID ¶
func (s *LiveProviderSource) ID() string
ID returns the provider_live source id.
func (*LiveProviderSource) Kind ¶
func (s *LiveProviderSource) Kind() SourceKind
Kind returns provider_live.
func (*LiveProviderSource) ListModels ¶
func (s *LiveProviderSource) ListModels(ctx context.Context, opts ListOptions) ([]ModelRow, error)
ListModels discovers live provider models. ACP-capable native providers use the model options advertised by the same bridge command used for launch.
func (*LiveProviderSource) Priority ¶
func (s *LiveProviderSource) Priority() int
Priority returns the provider_live merge priority.
func (*LiveProviderSource) ProviderIDs ¶
func (s *LiveProviderSource) ProviderIDs() []string
ProviderIDs returns the single CompozyOS provider id this source owns.
func (*LiveProviderSource) ReplaceProvider ¶
func (s *LiveProviderSource) ReplaceProvider(provider compozyconfig.ProviderConfig) bool
ReplaceProvider atomically applies the provider config used by subsequent discovery calls.
func (*LiveProviderSource) RetainContextPartitions ¶
func (s *LiveProviderSource) RetainContextPartitions() bool
RetainContextPartitions keeps invocation-local history for adapters that forbid stale transfer.
func (*LiveProviderSource) TTL ¶
func (s *LiveProviderSource) TTL() time.Duration
TTL returns the interval after which a catalog read should revalidate this live source in the background.
type LiveProviderSourcesConfig ¶
type LiveProviderSourcesConfig struct {
Providers map[string]compozyconfig.ProviderConfig
HomePaths compozyconfig.HomePaths
BaseEnv []string
SecretResolver ProviderSecretResolver
HTTPClient *http.Client
CommandExecutor DiscoveryCommandExecutor
ACPProbe ACPModelProbe
CodexProbe CodexModelProbe
DefaultTimeout time.Duration
RefreshTTL time.Duration
WorkingDir string
}
LiveProviderSourcesConfig configures built-in provider live discovery sources.
type MergeOptions ¶
MergeOptions supplies provider capabilities needed to keep catalog claims truthful.
type Model ¶
type Model struct {
ProviderID string
ModelID string
DisplayName string
Sources []SourceRef
Available *bool
AvailabilityState AvailabilityState
Stale bool
RefreshedAt time.Time
ContextWindow *int64
MaxInputTokens *int64
MaxOutputTokens *int64
SupportsTools *bool
SupportsReasoning *bool
ReasoningEfforts []ReasoningEffort
DefaultReasoningEffort *ReasoningEffort
ConfigOptions []ModelOptionDescriptor
TransportBindings []ModelTransportBinding
CostInputPerMillion *float64
CostOutputPerMillion *float64
CostCacheReadPerMillion *float64
CostCacheWritePerMillion *float64
CostReasoningPerMillion *float64
CostInputSource SourceKind
CostOutputSource SourceKind
CostCacheReadSource SourceKind
CostCacheWriteSource SourceKind
CostReasoningSource SourceKind
ExplicitlyCurated bool
Curated bool
Deprecated bool
Hidden bool
Featured bool
ReleaseDate *string
ReasoningSource ReasoningSource
ReasoningKnown bool
ReasoningApply string
LastError string
}
Model is the deterministic merged projection for one provider/model key.
func MergeRows ¶
func MergeRows(rows []ModelRow, opts MergeOptions) []Model
MergeRows computes deterministic model projections from source rows.
type ModelOptionDescriptor ¶
type ModelOptionDescriptor struct {
ID string
Label string
Description string
Category string
Kind ModelOptionKind
CurrentValueID string
CurrentBool *bool
Values []ModelOptionValue
}
ModelOptionDescriptor describes one provider model option and its current value.
func CloneModelOptionDescriptors ¶
func CloneModelOptionDescriptors(options []ModelOptionDescriptor) []ModelOptionDescriptor
CloneModelOptionDescriptors returns an ownership-safe copy of model option descriptors.
type ModelOptionKind ¶
type ModelOptionKind string
ModelOptionKind identifies the shape of a provider model option.
const ( // ModelOptionKindSelect identifies an option with one selected value. ModelOptionKindSelect ModelOptionKind = "select" // ModelOptionKindBoolean identifies an option with a true or false value. ModelOptionKindBoolean ModelOptionKind = "boolean" )
type ModelOptionSelection ¶
ModelOptionSelection captures one typed option value associated with a model binding.
func CloneModelOptionSelections ¶
func CloneModelOptionSelections(selections []ModelOptionSelection) []ModelOptionSelection
CloneModelOptionSelections returns an ownership-safe copy of model option selections.
type ModelOptionValue ¶
type ModelOptionValue struct {
ValueID string
Label string
Description string
GroupID string
GroupLabel string
Order int
}
ModelOptionValue describes one value advertised by a selectable model option.
type ModelRow ¶
type ModelRow struct {
ProviderID string
ModelID string
DisplayName string
SourceID string
SourceKind SourceKind
Priority int
Available *bool
Stale bool
RefreshedAt time.Time
ExpiresAt time.Time
ContextWindow *int64
MaxInputTokens *int64
MaxOutputTokens *int64
SupportsTools *bool
SupportsReasoning *bool
ReasoningEfforts []ReasoningEffort
DefaultReasoningEffort *ReasoningEffort
ConfigOptions []ModelOptionDescriptor
TransportBindings []ModelTransportBinding
CostInputPerMillion *float64
CostOutputPerMillion *float64
CostCacheReadPerMillion *float64
CostCacheWritePerMillion *float64
CostReasoningPerMillion *float64
ExplicitlyCurated bool
Deprecated *bool
Hidden *bool
Featured *bool
ReleaseDate *string
LastError string
}
ModelRow is one provider/model record contributed by one catalog source.
type ModelTransportBinding ¶
type ModelTransportBinding struct {
TransportModelID string
Label string
ReasoningEffort *ReasoningEffort
Fast *bool
Thinking *bool
OptionSelections []ModelOptionSelection
// ConfigOptions is the complete inspected snapshot for this transport, not a union.
// Nil means unobserved; an empty non-nil slice means observed with no adjustable options.
ConfigOptions []ModelOptionDescriptor
}
ModelTransportBinding maps one logical model configuration to its provider-owned identifier.
func PreferredTransportBinding ¶
func PreferredTransportBinding(bindings []ModelTransportBinding) (ModelTransportBinding, bool)
PreferredTransportBinding uses the same stable route for catalog presentation and session launch. Provider defaults sort last; explicit configured transport IDs remain separate logical rows.
type ModelsDevSource ¶
type ModelsDevSource struct {
// contains filtered or unexported fields
}
ModelsDevSource fetches catalog enrichment from models.dev.
func NewModelsDevSource ¶
func NewModelsDevSource( providers map[string]compozyconfig.ProviderConfig, cfg compozyconfig.ModelsDevSourceConfig, options ...ModelsDevSourceOption, ) (*ModelsDevSource, error)
NewModelsDevSource creates a configured models.dev source.
func (*ModelsDevSource) ID ¶
func (s *ModelsDevSource) ID() string
func (*ModelsDevSource) Kind ¶
func (s *ModelsDevSource) Kind() SourceKind
func (*ModelsDevSource) ListModels ¶
func (s *ModelsDevSource) ListModels(ctx context.Context, opts ListOptions) ([]ModelRow, error)
func (*ModelsDevSource) Priority ¶
func (s *ModelsDevSource) Priority() int
func (*ModelsDevSource) ProviderIDs ¶
func (s *ModelsDevSource) ProviderIDs() []string
func (*ModelsDevSource) TTL ¶
func (s *ModelsDevSource) TTL() time.Duration
func (*ModelsDevSource) Timeout ¶
func (s *ModelsDevSource) Timeout() time.Duration
Timeout returns the explicit HTTP timeout used by the source.
type ModelsDevSourceOption ¶
type ModelsDevSourceOption func(*ModelsDevSource)
ModelsDevSourceOption customizes models.dev source construction.
func WithModelsDevHTTPClient ¶
func WithModelsDevHTTPClient(client *http.Client) ModelsDevSourceOption
WithModelsDevHTTPClient injects the explicit-timeout HTTP client used for models.dev fetches.
type ProviderConfigSource ¶
type ProviderConfigSource struct {
// contains filtered or unexported fields
}
ProviderConfigSource projects one replaceable provider-config snapshot.
func NewConfigSource ¶
func NewConfigSource(providers map[string]compozyconfig.ProviderConfig) *ProviderConfigSource
NewConfigSource creates the operator config model source.
func (*ProviderConfigSource) ID ¶
func (s *ProviderConfigSource) ID() string
func (*ProviderConfigSource) Kind ¶
func (s *ProviderConfigSource) Kind() SourceKind
func (*ProviderConfigSource) ListModels ¶
func (s *ProviderConfigSource) ListModels( _ context.Context, opts ListOptions, ) ([]ModelRow, error)
func (*ProviderConfigSource) Priority ¶
func (s *ProviderConfigSource) Priority() int
func (*ProviderConfigSource) ProviderIDs ¶
func (s *ProviderConfigSource) ProviderIDs() []string
func (*ProviderConfigSource) ReplaceProviders ¶
func (s *ProviderConfigSource) ReplaceProviders(providers map[string]compozyconfig.ProviderConfig)
ReplaceProviders atomically replaces the source snapshot used by subsequent refreshes.
type ProviderSecretResolver ¶
type ProviderSecretResolver interface {
ResolveRef(ctx context.Context, ref string) (string, error)
}
ProviderSecretResolver resolves provider credential refs for live discovery.
type ReasoningEffort ¶
ReasoningEffort identifies one provider-advertised model reasoning level.
type ReasoningProfile ¶
type ReasoningProfile struct {
Supported bool
Efforts []ReasoningEffort
Default ReasoningEffort
Source ReasoningSource
}
ReasoningProfile is one model's effective reasoning capability.
type ReasoningSource ¶
type ReasoningSource string
ReasoningSource identifies where a selectable reasoning profile came from.
const ( // ReasoningSourceACP identifies an active ACP session observation. ReasoningSourceACP ReasoningSource = "acp" // ReasoningSourceCatalog identifies static or provider-discovery catalog data. ReasoningSourceCatalog ReasoningSource = "catalog" )
type RefreshOptions ¶
type RefreshOptions struct {
ProviderID string
SourceID string
ExecutionContext CatalogExecutionContext
PreviousExecutionContext CatalogExecutionContext
SourceContexts map[string]CatalogExecutionContext
Force bool
RequestID string
Now time.Time
}
RefreshOptions controls a model catalog refresh request.
type RefreshPlan ¶
type RefreshPlan struct {
// contains filtered or unexported fields
}
RefreshPlan buffers source replacements until a whole catalog generation is ready.
func (*RefreshPlan) Refresh ¶
func (p *RefreshPlan) Refresh( ctx context.Context, source Source, opts RefreshOptions, ) ([]SourceStatus, error)
Refresh stages one source refresh without publishing it to the durable store.
func (*RefreshPlan) SetLiveSources ¶
func (p *RefreshPlan) SetLiveSources(live []*LiveProviderSource) error
SetLiveSources stages the complete live source registry with its durable generation.
type RefreshState ¶
type RefreshState string
RefreshState identifies one source refresh lifecycle state.
const ( // RefreshStateIdle indicates a source has no active refresh state. RefreshStateIdle RefreshState = "idle" // RefreshStateRefreshing indicates a source refresh is currently running. RefreshStateRefreshing RefreshState = "refreshing" // RefreshStateSucceeded indicates the last source refresh succeeded. RefreshStateSucceeded RefreshState = "succeeded" // RefreshStateFailed indicates the last source refresh failed. RefreshStateFailed RefreshState = "failed" // RefreshStateDisabled indicates a configured source is disabled. RefreshStateDisabled RefreshState = "disabled" )
type Service ¶
type Service interface {
ListModels(ctx context.Context, opts ListOptions) ([]Model, error)
Refresh(ctx context.Context, opts RefreshOptions) ([]SourceStatus, error)
ListSourceStatus(ctx context.Context, opts StatusOptions) ([]SourceStatus, error)
}
Service exposes merged model catalog projections.
type SessionACPModelProbe ¶
type SessionACPModelProbe struct{}
SessionACPModelProbe reads advertised model options through ACP.
func (SessionACPModelProbe) InspectModels ¶
func (SessionACPModelProbe) InspectModels( ctx context.Context, req ACPModelProbeRequest, ) (acp.SessionModelInspection, error)
InspectModels selects each model in a disposable ACP session to read its options.
type Source ¶
type Source interface {
ID() string
Kind() SourceKind
Priority() int
ListModels(ctx context.Context, opts ListOptions) ([]ModelRow, error)
}
Source produces model rows for one catalog source.
func NewBuiltinSource ¶
func NewBuiltinSource() Source
NewBuiltinSource creates the offline bootstrap source from Compozy built-ins.
func NewLiveProviderSources ¶
func NewLiveProviderSources(cfg *LiveProviderSourcesConfig) ([]Source, error)
NewLiveProviderSources creates provider_live sources for known provider adapters.
type SourceKind ¶
type SourceKind string
SourceKind identifies the provenance family for a catalog source row.
const ( // SourceKindBuiltin identifies Compozy's offline bootstrap catalog. SourceKindBuiltin SourceKind = "builtin" // SourceKindConfig identifies operator-authored provider model config. SourceKindConfig SourceKind = "config" // SourceKindModelsDev identifies enrichment from models.dev. SourceKindModelsDev SourceKind = "models_dev" // SourceKindProviderLive identifies live provider discovery. SourceKindProviderLive SourceKind = "provider_live" // SourceKindExtension identifies extension-provided model source rows. SourceKindExtension SourceKind = "extension" // SourceKindACPSession identifies session-scoped ACP observations. SourceKindACPSession SourceKind = "acp_session" )
type SourceProviderKey ¶
SourceProviderKey identifies one source/provider pair that owns stored rows.
type SourceRef ¶
type SourceRef struct {
SourceID string
SourceKind SourceKind
Priority int
RefreshedAt time.Time
Stale bool
LastError string
}
SourceRef identifies one source participating in a merged catalog projection.
type SourceRowsReplacement ¶
type SourceRowsReplacement struct {
// RemoveSource deletes the live source for this provider across all execution contexts.
RemoveSource bool
ExecutionContext CatalogExecutionContext
SourceID string
ProviderID string
Rows []ModelRow
Status SourceStatus
}
SourceRowsReplacement is one provider-scoped source publication.
type SourceStatus ¶
type SourceStatus struct {
SourceID string
SourceKind SourceKind
ProviderID string
Priority int
LastRefresh time.Time
NextRefresh time.Time
LastSuccess time.Time
LastError string
RefreshState RefreshState
RowCount int
Stale bool
// RetainContextPartitions is a write-time policy, not persisted source health.
RetainContextPartitions bool `json:"-"`
}
SourceStatus reports provider-scoped source health and row counts.
func (SourceStatus) FailureReason ¶
func (s SourceStatus) FailureReason() string
FailureReason classifies persisted diagnostics without changing their storage format.
type StaleFallbackError ¶
StaleFallbackError reports a refresh failure that returned stale fallback rows.
func (*StaleFallbackError) Error ¶
func (e *StaleFallbackError) Error() string
func (*StaleFallbackError) Unwrap ¶
func (e *StaleFallbackError) Unwrap() error
type StatusOptions ¶
type StatusOptions struct {
ProviderID string
ExecutionContext CatalogExecutionContext
SourceContexts map[string]CatalogExecutionContext
}
StatusOptions filters source health by provider and execution context.
type Store ¶
type Store interface {
ReplaceSourceRows(
ctx context.Context,
executionContext CatalogExecutionContext,
sourceID string,
providerID string,
rows []ModelRow,
status SourceStatus,
) error
// ReplaceSourceRowsBatch publishes every replacement atomically.
ReplaceSourceRowsBatch(ctx context.Context, replacements []SourceRowsReplacement) error
ListRows(ctx context.Context, opts ListOptions) ([]ModelRow, error)
// ListRowOwners returns the distinct source/provider pairs of rows matching opts without hydrating rows.
ListRowOwners(ctx context.Context, opts ListOptions) ([]SourceProviderKey, error)
ListSourceStatus(ctx context.Context, opts StatusOptions) ([]SourceStatus, error)
}
Store persists source rows and provider-scoped source status.
Source Files
¶
- binding_availability.go
- bindings.go
- claude_model_rows.go
- curation.go
- errors.go
- execution_context.go
- live_model_rows.go
- live_model_rows_cursor.go
- live_model_rows_opencode.go
- live_model_rows_opencode_v2.go
- live_sources.go
- live_sources_acp.go
- live_sources_adapters.go
- live_sources_codex.go
- live_sources_command.go
- live_sources_http.go
- live_sources_opencode.go
- merge.go
- modelsdev.go
- option_merge.go
- options.go
- pricing.go
- reasoning.go
- reasoning_merge.go
- redact.go
- service.go
- service_bootstrap.go
- service_execution_context.go
- service_gate.go
- service_helpers.go
- service_refresh.go
- service_refresh_fallback.go
- service_refresh_freshness.go
- service_refresh_plan.go
- source_id.go
- sources.go
- types.go