Inbox consideration
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"g.fc.run/misc/byre/internal/git"
|
||||
"g.fc.run/misc/byre/internal/mcp"
|
||||
"g.fc.run/misc/byre/internal/store"
|
||||
"g.fc.run/misc/byre/internal/todo"
|
||||
)
|
||||
|
||||
func (m *Manager) leadTools(l *live) []mcp.Tool {
|
||||
@@ -33,7 +34,8 @@ func (m *Manager) leadTools(l *live) []mcp.Tool {
|
||||
|
||||
return []mcp.Tool{
|
||||
tool("list_tasks",
|
||||
"List every project and its active tasks: id, title, worktree path, the agent's state and model, and open inbox items.",
|
||||
"List every project and its active tasks (id, title, worktree path, the agent's state and model, and open inbox items), "+
|
||||
"and the titles of its TODO.md items on the default branch that no active task was started from.",
|
||||
`{"type": "object", "properties": {}}`,
|
||||
func(ctx context.Context, user api.User, raw json.RawMessage) (string, error) {
|
||||
return m.listTasksText(ctx)
|
||||
@@ -518,11 +520,15 @@ func (m *Manager) listTasksText(ctx context.Context) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
listed := false
|
||||
started := map[string]bool{}
|
||||
for _, t := range tasks {
|
||||
if t.Status != api.TaskStatusActive {
|
||||
continue
|
||||
}
|
||||
listed = true
|
||||
if t.TodoItem != nil {
|
||||
started[*t.TodoItem] = true
|
||||
}
|
||||
agent := "no agent"
|
||||
sess, found, err := m.liveSession(ctx, t.Id)
|
||||
if err != nil {
|
||||
@@ -557,6 +563,24 @@ func (m *Manager) listTasksText(ctx context.Context) (string, error) {
|
||||
if !listed {
|
||||
b.WriteString("- no active tasks\n")
|
||||
}
|
||||
src, found, err := git.ReadFile(p.RepoPath, p.DefaultBranch, todo.File)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
titles := []string{}
|
||||
for _, item := range todo.Parse(src) {
|
||||
if !started[item.Title] {
|
||||
titles = append(titles, item.Title)
|
||||
}
|
||||
}
|
||||
if len(titles) == 0 {
|
||||
fmt.Fprintf(b, "%s items not started: none\n", todo.File)
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(b, "%s items not started: %s\n", todo.File, strings.Join(titles, "; "))
|
||||
}
|
||||
return b.String(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user