( ctx context.Context, scope toolspkg.Scope, id toolspkg.ToolID, workspaceID string, name string, )
| 3559 | } |
| 3560 | |
| 3561 | func (n *daemonNativeTools) resolveSkill( |
| 3562 | ctx context.Context, |
| 3563 | scope toolspkg.Scope, |
| 3564 | id toolspkg.ToolID, |
| 3565 | workspaceID string, |
| 3566 | name string, |
| 3567 | ) (*skills.Skill, error) { |
| 3568 | trimmedName := strings.TrimSpace(name) |
| 3569 | workspaceID, err := nativeCallerWorkspaceInput(id, "workspace_id", workspaceID, scope) |
| 3570 | if err != nil { |
| 3571 | return nil, err |
| 3572 | } |
| 3573 | if workspaceID == "" { |
| 3574 | skill, ok := n.deps.Skills.Get(trimmedName) |
| 3575 | if !ok { |
| 3576 | return nil, fmt.Errorf("daemon: skill %q not found", trimmedName) |
| 3577 | } |
| 3578 | return skill, nil |
| 3579 | } |
| 3580 | skillList, err := n.skillsFor(ctx, scope, id, workspaceID) |
| 3581 | if err != nil { |
| 3582 | return nil, err |
| 3583 | } |
| 3584 | for _, skill := range skillList { |
| 3585 | if skill != nil && skill.Meta.Name == trimmedName { |
| 3586 | return skill, nil |
| 3587 | } |
| 3588 | } |
| 3589 | return nil, fmt.Errorf("daemon: skill %q not found", trimmedName) |
| 3590 | } |
| 3591 | |
| 3592 | func (n *daemonNativeTools) workspaceID(ctx context.Context, ref string) (string, error) { |
| 3593 | trimmed := strings.TrimSpace(ref) |
no test coverage detected