| 1 | package control |
| 2 | |
| 3 | import "reasonix/internal/agent" |
| 4 | |
| 5 | // modelSelection is the connection this controller runs as one value: the ref |
| 6 | // and the identity of the connection it was resolved against always change |
| 7 | // together, and a restart must restore both or neither. |
| 8 | type modelSelection struct { |
| 9 | ref string |
| 10 | identity string |
| 11 | } |
| 12 | |
| 13 | // ValidateSessionModel checks saved identity before any lease or transcript |
| 14 | // transition. Explicit model changes deliberately build a new runtime instead. |
| 15 | func (c *Controller) ValidateSessionModel(path string) error { |
| 16 | if c.resolveSessionModel == nil { |
| 17 | return nil |
| 18 | } |
| 19 | model, identity, ok := agent.LoadSessionModelSelection(path) |
| 20 | if !ok { |
| 21 | return nil |
| 22 | } |
| 23 | _, err := c.resolveSessionModel(model, identity) |
| 24 | return err |
| 25 | } |
| 26 |