(
name: AcpBuiltinSlashCommandName,
args: string,
)
| 779 | } |
| 780 | |
| 781 | private async runBuiltInCommand( |
| 782 | name: AcpBuiltinSlashCommandName, |
| 783 | args: string, |
| 784 | ): Promise<PromptResponse> { |
| 785 | try { |
| 786 | switch (name) { |
| 787 | case 'compact': |
| 788 | await this.runCompactCommand(args); |
| 789 | break; |
| 790 | case 'status': |
| 791 | await this.emitLocalCommandMessage(formatStatusReport(await this.session.getStatus())); |
| 792 | break; |
| 793 | case 'usage': |
| 794 | await this.emitLocalCommandMessage( |
| 795 | formatUsageReport(await this.session.getUsage(), await this.session.getStatus()), |
| 796 | ); |
| 797 | break; |
| 798 | case 'mcp': |
| 799 | await this.emitLocalCommandMessage(formatMcpReport(await this.session.listMcpServers())); |
| 800 | break; |
| 801 | case 'tasks': |
| 802 | await this.emitLocalCommandMessage( |
| 803 | formatTasksReport(await this.session.listBackgroundTasks()), |
| 804 | ); |
| 805 | break; |
| 806 | case 'help': |
| 807 | await this.emitLocalCommandMessage(formatHelpReport(this.availableCommands)); |
| 808 | break; |
| 809 | } |
| 810 | } catch (error) { |
| 811 | await this.emitLocalCommandMessage(`/${name} failed: ${errorMessage(error)}`); |
| 812 | } |
| 813 | return { stopReason: 'end_turn' }; |
| 814 | } |
| 815 | |
| 816 | private async runUnknownSlashCommand(name: string): Promise<PromptResponse> { |
| 817 | await this.emitLocalCommandMessage( |
no test coverage detected