({ skill }, context)
| 352 | toAutoClassifierInput: ({ skill }) => skill ?? '', |
| 353 | |
| 354 | async validateInput({ skill }, context): Promise<ValidationResult> { |
| 355 | // Skills are just skill names, no arguments |
| 356 | const trimmed = skill.trim() |
| 357 | if (!trimmed) { |
| 358 | return { |
| 359 | result: false, |
| 360 | message: `Invalid skill format: ${skill}`, |
| 361 | errorCode: 1, |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | // Remove leading slash if present (for compatibility) |
| 366 | const hasLeadingSlash = trimmed.startsWith('/') |
| 367 | if (hasLeadingSlash) { |
| 368 | logEvent('tengu_skill_tool_slash_prefix', {}) |
| 369 | } |
| 370 | const normalizedCommandName = hasLeadingSlash |
| 371 | ? trimmed.substring(1) |
| 372 | : trimmed |
| 373 | |
| 374 | // Remote canonical skill handling (ant-only experimental). Intercept |
| 375 | // `_canonical_<slug>` names before local command lookup since remote |
| 376 | // skills are not in the local command registry. |
| 377 | if ( |
| 378 | feature('EXPERIMENTAL_SKILL_SEARCH') && |
| 379 | process.env.USER_TYPE === 'ant' |
| 380 | ) { |
| 381 | const slug = remoteSkillModules!.stripCanonicalPrefix( |
| 382 | normalizedCommandName, |
| 383 | ) |
| 384 | if (slug !== null) { |
| 385 | const meta = remoteSkillModules!.getDiscoveredRemoteSkill(slug) |
| 386 | if (!meta) { |
| 387 | return { |
| 388 | result: false, |
| 389 | message: `Remote skill ${slug} was not discovered in this session. Use DiscoverSkills to find remote skills first.`, |
| 390 | errorCode: 6, |
| 391 | } |
| 392 | } |
| 393 | // Discovered remote skill — valid. Loading happens in call(). |
| 394 | return { result: true } |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | // Get available commands (including MCP skills) |
| 399 | const commands = await getAllCommands(context) |
| 400 | |
| 401 | // Check if command exists |
| 402 | const foundCommand = findCommand(normalizedCommandName, commands) |
| 403 | if (!foundCommand) { |
| 404 | return { |
| 405 | result: false, |
| 406 | message: `Unknown skill: ${normalizedCommandName}`, |
| 407 | errorCode: 2, |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | // Check if command has model invocation disabled |
nothing calls this directly
no test coverage detected