session: pass PromptEnvExtra to AgentCoreConfig

This commit is contained in:
Levi Neely 2026-07-19 20:37:37 +02:00
parent 03a29b0877
commit bba14ddcde
1 changed files with 29 additions and 24 deletions

View File

@ -790,18 +790,20 @@ func (s *Manager) restoreSession(ps *agent.PersistedSession) error {
}
var sessPtr *Session
promptEnv := agent.PromptEnv(cwd)
core := agent.NewAgentCore(agent.AgentCoreConfig{
Backend: be,
AgentName: agentName,
AgentsDir: s.cfg.AgentsDir,
SessionsDir: s.cfg.SessionsDir,
SessionID: sessID,
Uname: uname,
CWD: cwd,
Session: restoredSession,
Runtime: rt,
NewDispatcher: newDisp,
Log: s.cfg.Sink.NewLogger("core"),
Backend: be,
AgentName: agentName,
AgentsDir: s.cfg.AgentsDir,
SessionsDir: s.cfg.SessionsDir,
SessionID: sessID,
Uname: uname,
CWD: cwd,
Session: restoredSession,
Runtime: rt,
NewDispatcher: newDisp,
PromptEnvExtra: promptEnv,
Log: s.cfg.Sink.NewLogger("core"),
ReadPlanStep: func() string {
if sessPtr == nil {
return ""
@ -1037,26 +1039,29 @@ func (s *Manager) CreateSession(args []string) (string, error) {
})
}
env := []string{"OLLIE_SESSION_ID=" + sessID, "OLLIE_UNAME=" + uname, "OLLIE=" + MountPathFor(uname)}
var promptEnv []string
if len(remoteEnv) > 0 {
env = append(env, remoteEnv...)
promptEnv = remoteEnv
} else {
env = append(env, agent.PromptEnv(cwd)...)
promptEnv = agent.PromptEnv(cwd)
}
env := []string{"OLLIE_SESSION_ID=" + sessID, "OLLIE_UNAME=" + uname, "OLLIE=" + MountPathFor(uname)}
env = append(env, promptEnv...)
rt := agent.BuildRuntime(cfg, newDisp(), cwd, env)
// sessPtr is set after NewSession; the ReadPlanStep closure captures it.
core = agent.NewAgentCore(agent.AgentCoreConfig{
Backend: be,
AgentName: agentName,
AgentsDir: s.cfg.AgentsDir,
SessionsDir: s.cfg.SessionsDir,
SessionID: sessID,
Uname: uname,
CWD: cwd,
Runtime: rt,
NewDispatcher: newDisp,
Log: s.cfg.Sink.NewLogger("core"),
Backend: be,
AgentName: agentName,
AgentsDir: s.cfg.AgentsDir,
SessionsDir: s.cfg.SessionsDir,
SessionID: sessID,
Uname: uname,
CWD: cwd,
Runtime: rt,
NewDispatcher: newDisp,
PromptEnvExtra: promptEnv,
Log: s.cfg.Sink.NewLogger("core"),
ReadPlanStep: func() string {
if sessPtr == nil {
return ""