(host: SlashCommandHost)
| 460 | } |
| 461 | |
| 462 | async function cancelGoal(host: SlashCommandHost): Promise<void> { |
| 463 | const session = host.requireSession(); |
| 464 | try { |
| 465 | await session.cancelGoal(); |
| 466 | if (isStreaming(host)) await session.cancel(); |
| 467 | } catch (error) { |
| 468 | if (isKimiError(error) && error.code === ErrorCodes.GOAL_NOT_FOUND) { |
| 469 | host.showStatus('No goal to cancel.'); |
| 470 | return; |
| 471 | } |
| 472 | host.showError(formatErrorMessage(error)); |
| 473 | return; |
| 474 | } |
| 475 | host.track('goal_cancel'); |
| 476 | host.showNotice('Goal cancelled.'); |
| 477 | } |
| 478 | |
| 479 | async function showGoalStatus(host: SlashCommandHost): Promise<void> { |
| 480 | const { goal } = await host.requireSession().getGoal(); |
no test coverage detected