session: pass PromptEnvExtra to AgentCoreConfig
This commit is contained in:
parent
03a29b0877
commit
bba14ddcde
|
|
@ -790,18 +790,20 @@ func (s *Manager) restoreSession(ps *agent.PersistedSession) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
var sessPtr *Session
|
var sessPtr *Session
|
||||||
|
promptEnv := agent.PromptEnv(cwd)
|
||||||
core := agent.NewAgentCore(agent.AgentCoreConfig{
|
core := agent.NewAgentCore(agent.AgentCoreConfig{
|
||||||
Backend: be,
|
Backend: be,
|
||||||
AgentName: agentName,
|
AgentName: agentName,
|
||||||
AgentsDir: s.cfg.AgentsDir,
|
AgentsDir: s.cfg.AgentsDir,
|
||||||
SessionsDir: s.cfg.SessionsDir,
|
SessionsDir: s.cfg.SessionsDir,
|
||||||
SessionID: sessID,
|
SessionID: sessID,
|
||||||
Uname: uname,
|
Uname: uname,
|
||||||
CWD: cwd,
|
CWD: cwd,
|
||||||
Session: restoredSession,
|
Session: restoredSession,
|
||||||
Runtime: rt,
|
Runtime: rt,
|
||||||
NewDispatcher: newDisp,
|
NewDispatcher: newDisp,
|
||||||
Log: s.cfg.Sink.NewLogger("core"),
|
PromptEnvExtra: promptEnv,
|
||||||
|
Log: s.cfg.Sink.NewLogger("core"),
|
||||||
ReadPlanStep: func() string {
|
ReadPlanStep: func() string {
|
||||||
if sessPtr == nil {
|
if sessPtr == nil {
|
||||||
return ""
|
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 {
|
if len(remoteEnv) > 0 {
|
||||||
env = append(env, remoteEnv...)
|
promptEnv = remoteEnv
|
||||||
} else {
|
} 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)
|
rt := agent.BuildRuntime(cfg, newDisp(), cwd, env)
|
||||||
|
|
||||||
// sessPtr is set after NewSession; the ReadPlanStep closure captures it.
|
// sessPtr is set after NewSession; the ReadPlanStep closure captures it.
|
||||||
core = agent.NewAgentCore(agent.AgentCoreConfig{
|
core = agent.NewAgentCore(agent.AgentCoreConfig{
|
||||||
Backend: be,
|
Backend: be,
|
||||||
AgentName: agentName,
|
AgentName: agentName,
|
||||||
AgentsDir: s.cfg.AgentsDir,
|
AgentsDir: s.cfg.AgentsDir,
|
||||||
SessionsDir: s.cfg.SessionsDir,
|
SessionsDir: s.cfg.SessionsDir,
|
||||||
SessionID: sessID,
|
SessionID: sessID,
|
||||||
Uname: uname,
|
Uname: uname,
|
||||||
CWD: cwd,
|
CWD: cwd,
|
||||||
Runtime: rt,
|
Runtime: rt,
|
||||||
NewDispatcher: newDisp,
|
NewDispatcher: newDisp,
|
||||||
Log: s.cfg.Sink.NewLogger("core"),
|
PromptEnvExtra: promptEnv,
|
||||||
|
Log: s.cfg.Sink.NewLogger("core"),
|
||||||
ReadPlanStep: func() string {
|
ReadPlanStep: func() string {
|
||||||
if sessPtr == nil {
|
if sessPtr == nil {
|
||||||
return ""
|
return ""
|
||||||
|
|
|
||||||
Reference in New Issue