import { defineComponent, withApiName, detachedManifestScope, validateCustomApiName, type ComponentDefinition, } from './component'; import { CustomSkill, type CustomSkillProps } from '../custom-skill'; /** New skills use API names; the legacy constructor remains available separately. */ export type DefinedCustomSkillProps = Omit & { apiName: `${string}__c`; sourceSkillId?: never; }; export function defineCustomSkill(props: DefinedCustomSkillProps): CustomSkill { validateCustomApiName(props.apiName); const { apiName, ...config } = props; return customSkillComponent.register( withApiName(new CustomSkill(detachedManifestScope, config), apiName, { source_skill_id: apiName }), props, ); } const customSkillComponent: ComponentDefinition = defineComponent({ type: 'CUSTOM_SKILL', define: defineCustomSkill, });