MCPcopy Create free account
hub / github.com/astercloud/aster / List

Method List

pkg/a2a/store.go:88–102  ·  view source on GitHub ↗

List 列出 Agent 的所有任务

(agentID string)

Source from the content-addressed store, hash-verified

86
87// List 列出 Agent 的所有任务
88func (s *InMemoryTaskStore) List(agentID string) ([]*Task, error) {
89 s.mu.RLock()
90 defer s.mu.RUnlock()
91
92 prefix := agentID + "-"
93 tasks := make([]*Task, 0)
94
95 for key, task := range s.tasks {
96 if len(key) > len(prefix) && key[:len(prefix)] == prefix {
97 tasks = append(tasks, copyTask(task))
98 }
99 }
100
101 return tasks, nil
102}
103
104// AddCancellation 添加取消信号
105func (s *InMemoryTaskStore) AddCancellation(taskID string) {

Callers 2

Calls 1

copyTaskFunction · 0.85

Tested by 2