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:
parent
4028085914
commit
4643c4fca5
|
|
@ -31,7 +31,7 @@ type Agent struct {
|
||||||
state string // "idle", "thinking", "calling: <tool>"
|
state string // "idle", "thinking", "calling: <tool>"
|
||||||
reply string // last assistant response
|
reply string // last assistant response
|
||||||
cwd string // working directory for tool execution
|
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
|
fifo Fifo // prompt queue
|
||||||
toolCallCount atomic.Int64
|
toolCallCount atomic.Int64
|
||||||
pendingInject atomic.Pointer[string]
|
pendingInject atomic.Pointer[string]
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ func (a *Session) handleCommand(ctx context.Context, input string) bool {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
d := a.r.newDispatcher()
|
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...)
|
env = append(env, a.r.promptEnvExtra...)
|
||||||
rt := BuildRuntime(cfg, d, a.r.cwd, env, a.r.baseLayers...)
|
rt := BuildRuntime(cfg, d, a.r.cwd, env, a.r.baseLayers...)
|
||||||
if rt.CfgBackend != "" {
|
if rt.CfgBackend != "" {
|
||||||
|
|
|
||||||
|
|
@ -365,8 +365,8 @@ func (a *Session) pushSessionEnv() {
|
||||||
if srv, ok := a.r.runtime.Dispatcher.GetServer("execute"); ok {
|
if srv, ok := a.r.runtime.Dispatcher.GetServer("execute"); ok {
|
||||||
if es, ok := srv.(tools.EnvSetter); ok {
|
if es, ok := srv.(tools.EnvSetter); ok {
|
||||||
es.SetEnv("OLLIE_SESSION_ID", a.id)
|
es.SetEnv("OLLIE_SESSION_ID", a.id)
|
||||||
if a.r.uname != "" {
|
if a.r.id != "" {
|
||||||
es.SetEnv("OLLIE_UNAME", a.r.uname)
|
es.SetEnv("OLLIE_UNAME", a.r.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -464,6 +464,7 @@ func New(cfg Config) *Session {
|
||||||
history: cfg.History,
|
history: cfg.History,
|
||||||
runtime: rt,
|
runtime: rt,
|
||||||
cwd: paths.ExpandHome(cfg.CWD),
|
cwd: paths.ExpandHome(cfg.CWD),
|
||||||
|
id: cfg.Uname,
|
||||||
agentName: cfg.AgentName,
|
agentName: cfg.AgentName,
|
||||||
agentsDir: cfg.AgentsDir,
|
agentsDir: cfg.AgentsDir,
|
||||||
promptEnvExtra: cfg.PromptEnvExtra,
|
promptEnvExtra: cfg.PromptEnvExtra,
|
||||||
|
|
|
||||||
Reference in New Issue