diff --git a/cmd/supervisor/main.go b/cmd/supervisor/main.go index da41e8f..915a01b 100644 --- a/cmd/supervisor/main.go +++ b/cmd/supervisor/main.go @@ -92,14 +92,17 @@ func main() { litellmExec := iexec.NewLiteLLM(cfg.LiteLLMBaseURL, cfg.LiteLLMAPIKey, 0) verifier := iexec.NewVerifier("", models.Verifier(), 0) - buildOrch := func(skill string) *iexec.Orchestrator { - rawChain := models.ChainFor(skill, "") - chain := make([]iexec.ChainEntry, len(rawChain)) - for i, m := range rawChain { - chain[i] = iexec.EntryFor(m) + buildOrch := func(skill string) func(ctx context.Context, req iexec.Request) (iexec.Result, error) { + return func(ctx context.Context, req iexec.Request) (iexec.Result, error) { + rawChain := models.ChainFor(skill, req.Model) + chain := make([]iexec.ChainEntry, len(rawChain)) + for i, m := range rawChain { + chain[i] = iexec.EntryFor(m) + } + attempts := make([]iexec.AttemptRecord, 0, len(chain)) + orch := iexec.NewOrchestrator(chain, litellmExec.Run, claudeExec.Run, verifier, models.LlamaSwapURL(), &attempts) + return orch.Run(ctx, req) } - attempts := make([]iexec.AttemptRecord, 0, len(chain)) - return iexec.NewOrchestrator(chain, litellmExec.Run, claudeExec.Run, verifier, models.LlamaSwapURL(), &attempts) } tierFn := func(ctx context.Context) tier.Info { @@ -111,7 +114,7 @@ func main() { SystemPrompt: string(systemPrompt), SkillPrompt: string(tddPrompt), DefaultModel: models.ChainFor("tdd", "")[0], - ExecutorFn: buildOrch("tdd").Run, + ExecutorFn: buildOrch("tdd"), SessionsDir: cfg.SessionsDir, })) reg.Register(brain.New(brain.Config{ @@ -127,31 +130,31 @@ func main() { SkillPrompt: string(retroPrompt), DefaultModel: models.ChainFor("retrospective", "")[0], SessionsDir: cfg.SessionsDir, - ExecutorFn: buildOrch("retrospective").Run, + ExecutorFn: buildOrch("retrospective"), })) reg.Register(review.New(review.Config{ SkillPrompt: string(reviewPrompt), DefaultModel: models.ChainFor("review", "")[0], - ExecutorFn: buildOrch("review").Run, + ExecutorFn: buildOrch("review"), SessionsDir: cfg.SessionsDir, })) reg.Register(skilldebug.New(skilldebug.Config{ SkillPrompt: string(debugPrompt), DefaultModel: models.ChainFor("debug", "")[0], - ExecutorFn: buildOrch("debug").Run, + ExecutorFn: buildOrch("debug"), SessionsDir: cfg.SessionsDir, })) reg.Register(spec.New(spec.Config{ SkillPrompt: string(specPrompt), DefaultModel: models.ChainFor("spec", "")[0], - ExecutorFn: buildOrch("spec").Run, + ExecutorFn: buildOrch("spec"), SessionsDir: cfg.SessionsDir, })) reg.Register(trainer.New(trainer.Config{ ReaderPrompt: string(trainerReaderPrompt), WriterPrompt: string(trainerWriterPrompt), DefaultModel: models.ChainFor("trainer", "")[0], - ExecutorFn: buildOrch("trainer").Run, + ExecutorFn: buildOrch("trainer"), SessionsDir: cfg.SessionsDir, BrainDir: cfg.BrainDir, }))