(message: QueuedMessage)
| 2889 | }; |
| 2890 | |
| 2891 | const handleSpecialCommand = async (message: QueuedMessage): Promise<boolean> => { |
| 2892 | const specialCommand = parseCodexSpecialCommand(message.message); |
| 2893 | if (!specialCommand.type) { |
| 2894 | return false; |
| 2895 | } |
| 2896 | |
| 2897 | if (specialCommand.type === 'invalid') { |
| 2898 | await interruptActiveTurn(); |
| 2899 | resetCurrentTurnState(); |
| 2900 | sendVisibleStatus(specialCommand.message); |
| 2901 | return true; |
| 2902 | } |
| 2903 | |
| 2904 | if (specialCommand.type === 'clear') { |
| 2905 | await interruptActiveTurn(); |
| 2906 | resetCurrentTurnState(); |
| 2907 | this.currentThreadId = null; |
| 2908 | invalidThreadId = null; |
| 2909 | hasThread = false; |
| 2910 | session.resetCodexThread(); |
| 2911 | sendVisibleStatus('Context was reset'); |
| 2912 | return true; |
| 2913 | } |
| 2914 | |
| 2915 | await interruptActiveTurn(); |
| 2916 | resetCurrentTurnState(); |
| 2917 | const threadId = await resumeExistingThreadForCompact(message.mode); |
| 2918 | if (!threadId) { |
| 2919 | sendVisibleStatus('Nothing to compact'); |
| 2920 | return true; |
| 2921 | } |
| 2922 | |
| 2923 | sendVisibleStatus('Compaction started'); |
| 2924 | try { |
| 2925 | await appServerClient.compactThread({ threadId }, { |
| 2926 | signal: this.abortController.signal |
| 2927 | }); |
| 2928 | sendVisibleStatus('Compaction completed'); |
| 2929 | } catch (error) { |
| 2930 | const detail = error instanceof Error ? error.message : String(error); |
| 2931 | sendVisibleStatus(`Compaction failed: ${detail}`); |
| 2932 | } |
| 2933 | return true; |
| 2934 | }; |
| 2935 | |
| 2936 | while (!this.shouldExit) { |
| 2937 | logActiveHandles('loop-top'); |
nothing calls this directly
no test coverage detected