Files
orca/src/shared/native-chat-reported-skill.ts
T
Neil c8823b4c6f refactor: group shared native chat composer input (#34328)
* refactor: group shared native chat composer input

* refactor: consolidate concrete composer imports
2026-10-27 01:50:08 -07:00

25 lines
994 B
TypeScript

import type { DiscoveredSkill } from './skills'
import type { NativeChatSessionSkill } from './native-chat/input/native-chat-slash-commands'
import type { NativeChatPickerItem } from './native-chat/input/native-chat-picker-items'
import { stripUnsafeDisplayCharacters } from './skill-display-text'
export function locatedPickerSkill(
skill: NativeChatSessionSkill,
path: string,
scanned: DiscoveredSkill | undefined,
skillSigil: '/' | '$',
duplicate: boolean
): Extract<NativeChatPickerItem, { kind: 'skill' }> {
const description = skill.description ?? scanned?.description
return {
kind: 'skill',
id: `skill:${path}`,
name: skill.name,
token: `${skillSigil}${skill.name}`,
description: description ? stripUnsafeDisplayCharacters(description).slice(0, 240) : null,
sources: scanned ? [{ sourceKind: scanned.sourceKind, skillFilePath: path }] : [],
path,
...(duplicate ? { location: stripUnsafeDisplayCharacters(path).slice(0, 4096) } : {})
}
}