Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions agent/harness/todo/todo.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,7 @@ func (p *Provider) GetRemainingItems(opts ...agent.Option) []Item {
mu.Lock()
defer mu.Unlock()
st := p.loadState(opts)
var remaining []Item
for _, item := range st.Items {
if !item.IsComplete {
remaining = append(remaining, item)
}
}
return remaining
return remainingItems(st.Items)
}

func (p *Provider) loadState(opts []agent.Option) *state {
Expand Down Expand Up @@ -313,13 +307,7 @@ func (p *Provider) createTools(opts []agent.Option) []tool.FuncTool {
mu.Lock()
defer mu.Unlock()
st := p.loadState(opts)
var remaining []Item
for _, item := range st.Items {
if !item.IsComplete {
remaining = append(remaining, item)
}
}
return remaining, nil
return remainingItems(st.Items), nil
},
)

Expand All @@ -340,6 +328,16 @@ func (p *Provider) createTools(opts []agent.Option) []tool.FuncTool {
return []tool.FuncTool{addTool, completeTool, removeTool, getRemainingTool, getAllTool}
}

func remainingItems(items []Item) []Item {
var remaining []Item
for _, item := range items {
if !item.IsComplete {
remaining = append(remaining, item)
}
}
return remaining
}

func formatTodoListMessage(items []Item) string {
if len(items) == 0 {
return "### Current todo list\n- none yet"
Expand Down