session: rename Agent.uname → Agent.id

The agent's identity field is its id, not a Unix username.
Config.Uname preserved as public API (renamed with 9P recraft).
This commit is contained in:
Levi Neely 2026-07-29 20:27:23 +02:00
parent 4028085914
commit 4643c4fca5
3 changed files with 5 additions and 4 deletions

View File

@ -31,7 +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)
id string // agent identity (unique principal)
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.r.uname}
env := []string{"OLLIE_SESSION_ID=" + a.id, "OLLIE_UNAME=" + a.r.id}
env = append(env, a.r.promptEnvExtra...)
rt := BuildRuntime(cfg, d, a.r.cwd, env, a.r.baseLayers...)
if rt.CfgBackend != "" {

View File

@ -365,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.r.uname != "" {
es.SetEnv("OLLIE_UNAME", a.r.uname)
if a.r.id != "" {
es.SetEnv("OLLIE_UNAME", a.r.id)
}
}
}
@ -464,6 +464,7 @@ func New(cfg Config) *Session {
history: cfg.History,
runtime: rt,
cwd: paths.ExpandHome(cfg.CWD),
id: cfg.Uname,
agentName: cfg.AgentName,
agentsDir: cfg.AgentsDir,
promptEnvExtra: cfg.PromptEnvExtra,