Add Promptkit configuration and inspection seams

This commit is contained in:
2026-07-31 04:27:36 +00:00
parent 6064af2295
commit 9a17a8de93
15 changed files with 584 additions and 2 deletions

View File

@@ -65,6 +65,9 @@ func Validate(cfg Config) error {
if cfg.Scriptorium.Timeout <= 0 {
return fmt.Errorf("scriptorium.timeout must be greater than zero")
}
if err := validatePromptkit(cfg.Promptkit); err != nil {
return err
}
if cfg.Workspace.Root == "" {
return fmt.Errorf("workspace.root is required")
}
@@ -85,6 +88,25 @@ func Validate(cfg Config) error {
return nil
}
func validatePromptkit(cfg PromptkitConfig) error {
if cfg.ProfileFile != "" && cfg.ProfileDir != "" {
return fmt.Errorf("promptkit.profile_file and promptkit.profile_dir cannot both be configured")
}
if cfg.Timeout <= 0 {
return fmt.Errorf("promptkit.timeout must be greater than zero")
}
if cfg.Local.Endpoint != "" {
parsed, err := url.Parse(cfg.Local.Endpoint)
if err != nil || parsed.Scheme == "" || parsed.Host == "" {
return fmt.Errorf("promptkit.local.endpoint must be an absolute URL when configured")
}
}
if cfg.Local.ConcurrencyLimit < 0 {
return fmt.Errorf("promptkit.local.concurrency_limit must be zero or greater")
}
return nil
}
func validateDistributorNotify(cfg DistributorNotifyConfig) error {
if !cfg.Enabled {
return nil