diff --git a/session/agent.go b/session/agent.go index 02872c0..65e9e20 100644 --- a/session/agent.go +++ b/session/agent.go @@ -31,6 +31,7 @@ type Agent struct { state string // "idle", "thinking", "calling: " reply string // last assistant response cwd string // working directory for tool execution + uname string // agent principal (numeric UID for 9P identity) fifo Fifo // prompt queue toolCallCount atomic.Int64 pendingInject atomic.Pointer[string] diff --git a/session/commands.go b/session/commands.go index 5e8cb1e..dad9bb9 100644 --- a/session/commands.go +++ b/session/commands.go @@ -175,7 +175,7 @@ func (a *Session) handleCommand(ctx context.Context, input string) bool { return } d := a.r.newDispatcher() - env := []string{"OLLIE_SESSION_ID=" + a.id, "OLLIE_UNAME=" + a.uname} + env := []string{"OLLIE_SESSION_ID=" + a.id, "OLLIE_UNAME=" + a.r.uname} env = append(env, a.r.promptEnvExtra...) rt := BuildRuntime(cfg, d, a.r.cwd, env, a.r.baseLayers...) if rt.CfgBackend != "" { diff --git a/session/session.go b/session/session.go index 673cd13..9aaf518 100644 --- a/session/session.go +++ b/session/session.go @@ -310,13 +310,11 @@ type Config struct { type Session struct { // Session-level state id string - uname string bus *pubsub.Bus envMu sync.RWMutex env map[string]string plan []byte prevPrompt string - peers map[string]bool // Agent r *Agent @@ -367,8 +365,8 @@ func (a *Session) pushSessionEnv() { if srv, ok := a.r.runtime.Dispatcher.GetServer("execute"); ok { if es, ok := srv.(tools.EnvSetter); ok { es.SetEnv("OLLIE_SESSION_ID", a.id) - if a.uname != "" { - es.SetEnv("OLLIE_UNAME", a.uname) + if a.r.uname != "" { + es.SetEnv("OLLIE_UNAME", a.r.uname) } } } @@ -459,7 +457,7 @@ func New(cfg Config) *Session { a := &Session{ id: cfg.SessionID, - uname: cfg.Uname, + bus: pubsub.NewBus(), env: make(map[string]string), r: &Agent{