feed: export Feed field, remove wrapper methods, use direct access everywhere

This commit is contained in:
Levi Neely 2026-08-13 20:09:28 +02:00
parent 1537e35685
commit e2695d6f50
2 changed files with 6 additions and 12 deletions

View File

@ -40,7 +40,7 @@ type Agent struct {
cwd string // working directory for tool execution
id string // agent identity (unique principal)
fifo Fifo // prompt queue
feed Feed // streaming input gate (change-detecting)
Feed Feed // streaming input gate (change-detecting)
toolCallCount atomic.Int64
pendingInject atomic.Pointer[string]
submitMu sync.Mutex // serializes Submit calls (commands + turns)
@ -250,7 +250,7 @@ func (ag *Agent) WaitChange(ctx context.Context, field, current string) (string,
case WatchState:
val = ag.State()
case WatchFeed:
val = ag.feed.Hash()
val = ag.Feed.Hash()
if val == "" {
val = current // no data yet — block
}
@ -676,16 +676,10 @@ func (ag *Agent) PopQueue() (string, bool) {
// FeedWrite stores data in the feed and signals waiters.
func (ag *Agent) FeedWrite(data []byte) {
ag.feed.Set(data)
ag.Feed.Set(data)
ag.notifyChange()
}
// FeedGet returns the current feed data.
func (ag *Agent) FeedGet() []byte { return ag.feed.Get() }
// FeedHash returns the current feed content hash.
func (ag *Agent) FeedHash() string { return ag.feed.Hash() }
// StartFeedConsumer spawns a goroutine that blocks on feed changes and
// submits new data as prompts. Exits when ctx is cancelled.
func (ag *Agent) StartFeedConsumer(ctx context.Context) {
@ -696,8 +690,8 @@ func (ag *Agent) StartFeedConsumer(ctx context.Context) {
if !ok {
return
}
data := ag.feed.Get()
base = ag.feed.Hash()
data := ag.Feed.Get()
base = ag.Feed.Hash()
if len(data) == 0 {
continue
}

View File

@ -412,7 +412,7 @@ func buildAgentChildren(a *agent.Agent, s *session.Session) []virtfs.FsNodeDecl
if !ok {
return nil, base, merged.Err()
}
return a.FeedGet(), a.FeedHash(), nil
return a.Feed.Get(), a.Feed.Hash(), nil
}),
),
virtfs.FileNode("chat", 0444,