session: move uname to Agent, remove peers from core

- uname is the agent's principal/UID, not a session property
- peers removed entirely from core: the concept needs redesign for
  multi-agent. The 9P layer retains its own inter-session routing
  at the Manager level.

Core Session now holds only: id, bus, env, plan, prevPrompt.
Agent holds all execution + identity state.
This commit is contained in:
Levi Neely 2026-07-29 20:25:28 +02:00
parent 7592f810a9
commit 4028085914
3 changed files with 5 additions and 6 deletions

View File

@ -31,6 +31,7 @@ type Agent struct {
state string // "idle", "thinking", "calling: <tool>"
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]

View File

@ -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 != "" {

View File

@ -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{