feat: offer agents in the add picker and dashboard
The interactive add lists a source's agents next to its skills, tagged `agent`; Pick and Store.Available return both. Same-named agents get their file path in the manifest, like skills. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
df8d11d8cb
commit
1402e0ee07
6 files changed
+198
-59
No files matched your search
+12
-9
@@ -231,28 +231,31 @@ func Select(found, chosen []skills.Skill) []manifest.Skill {
|
||||
return out
|
||||
}
|
||||
|
||||
// Available lists the skills Add would choose from, and which of their paths are
|
||||
// already installed from that source.
|
||||
func (s Store) Available(ctx context.Context, req AddRequest) ([]skills.Skill, map[string]bool, error) {
|
||||
// Available lists the skills and agents Add would choose from, and which of their
|
||||
// paths are already installed from that source.
|
||||
func (s Store) Available(ctx context.Context, req AddRequest) (found, agents []skills.Skill, installed map[string]bool, err error) {
|
||||
m, l, err := s.load()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
key, _, ref, err := target(m, l, req)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
_, found, _, err := s.fetchSource(ctx, ref)
|
||||
_, found, agents, err = s.fetchSource(ctx, ref)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("%s: %w", key, err)
|
||||
return nil, nil, nil, fmt.Errorf("%s: %w", key, err)
|
||||
}
|
||||
installed := map[string]bool{}
|
||||
installed = map[string]bool{}
|
||||
if locked := l.Sources[key]; locked != nil {
|
||||
for _, path := range locked.Skills {
|
||||
installed[path] = true
|
||||
}
|
||||
for _, path := range locked.Agents {
|
||||
installed[path] = true
|
||||
}
|
||||
}
|
||||
return found, installed, nil
|
||||
return found, agents, installed, nil
|
||||
}
|
||||
|
||||
// fetchSource prefetches ref and finds its skills and agent definitions.
|
||||
|
||||
Reference in new issue
Block a user