session: pass PromptEnv to all BuildRuntime calls
Both restore and create paths now include PRIME_* env vars. Remote path uses HostInfo; local path uses PromptEnv(cwd).
This commit is contained in:
parent
28232fd833
commit
03a29b0877
|
|
@ -780,7 +780,9 @@ func (s *Manager) restoreSession(ps *agent.PersistedSession) error {
|
|||
newDisp := tools.NewDispatcherFunc(map[string]func() tools.Server{
|
||||
"execute": execute.Decl(cwd, execOpts...),
|
||||
})
|
||||
rt := agent.BuildRuntime(cfg, newDisp(), cwd, []string{"OLLIE_SESSION_ID=" + sessID, "OLLIE_UNAME=" + uname, "OLLIE=" + MountPathFor(uname)})
|
||||
env := []string{"OLLIE_SESSION_ID=" + sessID, "OLLIE_UNAME=" + uname, "OLLIE=" + MountPathFor(uname)}
|
||||
env = append(env, agent.PromptEnv(cwd)...)
|
||||
rt := agent.BuildRuntime(cfg, newDisp(), cwd, env)
|
||||
|
||||
restoredSession := agent.RestoreSession(ps.Messages)
|
||||
if ps.TaskState != nil {
|
||||
|
|
@ -1025,6 +1027,7 @@ func (s *Manager) CreateSession(args []string) (string, error) {
|
|||
"execute": func() tools.Server { return rsrv },
|
||||
})
|
||||
remoteEnv = []string{
|
||||
"PRIME_CWD=" + cwd,
|
||||
"PRIME_PLATFORM=" + rsrv.Info.Platform,
|
||||
"PRIME_IS_GIT_REPO=" + fmt.Sprintf("%v", rsrv.Info.IsGitRepo),
|
||||
}
|
||||
|
|
@ -1035,7 +1038,11 @@ func (s *Manager) CreateSession(args []string) (string, error) {
|
|||
}
|
||||
|
||||
env := []string{"OLLIE_SESSION_ID=" + sessID, "OLLIE_UNAME=" + uname, "OLLIE=" + MountPathFor(uname)}
|
||||
env = append(env, remoteEnv...)
|
||||
if len(remoteEnv) > 0 {
|
||||
env = append(env, remoteEnv...)
|
||||
} else {
|
||||
env = append(env, agent.PromptEnv(cwd)...)
|
||||
}
|
||||
rt := agent.BuildRuntime(cfg, newDisp(), cwd, env)
|
||||
|
||||
// sessPtr is set after NewSession; the ReadPlanStep closure captures it.
|
||||
|
|
|
|||
Reference in New Issue