session: store remote target, expose in cfg read

The remote= field is now visible when reading s/{id}/cfg,
and stored on the Session struct for future persistence.
This commit is contained in:
Levi Neely 2026-07-19 19:10:02 +02:00
parent 4f8e0c2768
commit fce23afd28
2 changed files with 3 additions and 0 deletions

View File

@ -38,6 +38,7 @@ type Session struct {
plan []byte plan []byte
prevPrompt []byte // last submitted prompt; overwritten on each new submission prevPrompt []byte // last submitted prompt; overwritten on each new submission
peers map[string]bool // peer session IDs (bidirectional links) peers map[string]bool // peer session IDs (bidirectional links)
remote string // SSH target for remote execution (empty = local)
// Cached model list (expensive API call; refreshed every 24h). // Cached model list (expensive API call; refreshed every 24h).
modelsMu sync.Mutex modelsMu sync.Mutex
@ -1043,6 +1044,7 @@ func (s *Manager) CreateSession(args []string) (string, error) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
sess := NewSession(sessID, core, ctx, cancel) sess := NewSession(sessID, core, ctx, cancel)
sessPtr = sess sessPtr = sess
sess.remote = remoteTarget
s.mu.Lock() s.mu.Lock()
sess.uname = uname sess.uname = uname

View File

@ -272,6 +272,7 @@ func (h *sessionHelper) cfgContent() string {
fmt.Fprintf(&sb, "model=%s\n", h.sess.Core.ModelName()) fmt.Fprintf(&sb, "model=%s\n", h.sess.Core.ModelName())
fmt.Fprintf(&sb, "agent=%s\n", h.sess.Core.AgentName()) fmt.Fprintf(&sb, "agent=%s\n", h.sess.Core.AgentName())
fmt.Fprintf(&sb, "cwd=%s\n", h.sess.Core.CWD()) fmt.Fprintf(&sb, "cwd=%s\n", h.sess.Core.CWD())
fmt.Fprintf(&sb, "remote=%s\n", h.sess.remote)
fmt.Fprintf(&sb, "maxTokens=%d\n", p.MaxTokens) fmt.Fprintf(&sb, "maxTokens=%d\n", p.MaxTokens)
fmt.Fprintf(&sb, "maxCompletionTokens=%d\n", p.MaxCompletionTokens) fmt.Fprintf(&sb, "maxCompletionTokens=%d\n", p.MaxCompletionTokens)
if p.Temperature != nil { if p.Temperature != nil {