Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1.0 KB
Raw Blame
/**
 * Project/device filesystem skills (SKILL.md on the execution device) from the
 * operation's skill set, shaped for the tool-execution context. Shared by
 * `callTool` and `callToolsBatch` so batched device `execScript` calls resolve
 * the same SKILL.md cwd as single calls — an unshared copy is exactly how the
 * batch path silently dropped these fields once already.
 */
export const resolveRunProjectSkills = (plan?: {
  skills?: {
    skills?: { description?: string; location?: string; name: string; source?: string }[];
  };
}): { description?: string; location: string; name: string; source: 'device' | 'project' }[] =>
  (plan?.skills?.skills ?? [])
    .filter(
      (skill) => (skill.source === 'project' || skill.source === 'device') && !!skill.location,
    )
    .map((skill) => ({
      ...(skill.description ? { description: skill.description } : {}),
      location: skill.location as string,
      name: skill.name,
      source: skill.source === 'device' ? ('device' as const) : ('project' as const),
    }));