Commit Graph

11 Commits

Author SHA1 Message Date
Levi Neely 4643c4fca5 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).
2026-07-29 20:27:23 +02:00
Levi Neely 4028085914 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.
2026-07-29 20:25:28 +02:00
Levi Neely 7592f810a9 session: move cwd, fifo, submitMu, toolCallCount, pendingInject to Agent
Agent now owns all execution-related state:
- cwd: the directory the agent operates in
- fifo: prompt queue (prompts target a specific agent)
- submitMu: serializes turns for this agent
- toolCallCount: per-agent tool usage metric
- pendingInject: injection targeting the current agent

Session retains only environment state: identity, bus, env, plan, peers,
persistence. This completes the agent/session state separation.
2026-07-29 20:15:13 +02:00
Levi Neely 8acadaaa30 session: move state/reply to Agent
Agent now owns its execution state (state, reply, stateMu, changeMu,
changeCond). Session delegates State()/Reply()/WaitChange() to Agent.

This is the correct ownership: each agent has independent execution
state. In multi-agent, agents can be idle/thinking independently.
Session remains the coordination layer.
2026-07-29 20:10:42 +02:00
Levi Neely 1b35862f1a session: expose Agent() accessor, add methods to Agent struct
- Session.Agent() returns the active *Agent
- Agent.Name(), Agent.BackendName(), Agent.ModelName() — first-class
- Session proxy methods delegate to Agent

Consumers can now access the agent directly:
  sess.Agent().Name()
  sess.Agent().BackendName()
2026-07-29 19:36:51 +02:00
Levi Neely d9920b42c7 session: merge harness.go into session.go
The Session struct is defined in session.go — named after what it is.
No more 'harness' concept; that was an artifact of the interface+impl
pattern we removed.
2026-07-29 19:29:49 +02:00
Levi Neely 5db3eb5138 session: remove Session interface, export concrete struct
Session is now an exported struct with unexported fields.
Methods ARE the API — no interface declaration in the package.
Consumers that need mockability define their own interface
(implicit satisfaction, standard Go pattern).
2026-07-29 19:25:14 +02:00
Levi Neely 916b31ee89 session: rename exports for clean public API
- Core interface → Session interface
- NewAgentCore → New
- AgentCoreConfig → Config
- Config (agent JSON) → AgentConfig
- types.go → session.go (defines Session interface)
- session.go → history.go (History type, persistence)
2026-07-29 19:17:00 +02:00
Levi Neely 6ee949bd7c rename agent/ → session/, absorb session.Session into harness
The agent/ package is now session/ — because a session is the
top-level concept. The package contains:
- harness: implements Core, the session orchestrator
- Agent: the reasoning entity (history, runtime, tools)
- History: conversation accumulator
- Fifo, loop, compaction, hooks, commands

The old session/ package (which just held extracted fields) is
dissolved back into the harness. One package, clean ownership.
2026-07-29 19:13:26 +02:00
Levi Neely e10319758b session: add plan, prevPrompt, peers to Session
Extend the core session with fields that are genuinely session
concerns currently duplicated in 9p/session:
- Plan (markdown checklist, survives compaction)
- PrevPrompt (last submitted prompt text)
- Peers (bidirectional session links)

The 9p/session layer can delegate to these in a future change.
2026-07-29 18:36:59 +02:00
Levi Neely 457ec2312f session: new package for agent runtime environment
Defines Session (ID, CWD, state, env, bus, FIFO) as the runtime
environment that hosts an agent. This is the foundation for separating
session concerns from agent reasoning concerns.
2026-07-29 18:23:04 +02:00