MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / handleInitCommand

Function handleInitCommand

apps/kimi-code/src/tui/commands/session.ts:160–186  ·  view source on GitHub ↗
(host: SlashCommandHost)

Source from the content-addressed store, hash-verified

158}
159
160export async function handleInitCommand(host: SlashCommandHost): Promise<void> {
161 const session = host.session;
162 if (host.state.appState.model.trim().length === 0 || session === undefined) {
163 host.showError(LLM_NOT_SET_MESSAGE);
164 return;
165 }
166
167 host.deferUserMessages = true;
168 host.beginSessionRequest();
169 try {
170 await session.init();
171 host.track('init_complete');
172 host.streamingUI.finalizeTurn((item) => {
173 host.sendQueuedMessage(session, item);
174 });
175 } catch (error) {
176 if (isAbortError(error)) {
177 host.setAppState({ streamingPhase: 'idle' });
178 host.resetLivePane();
179 return;
180 }
181 const msg = error instanceof Error ? error.message : String(error);
182 host.failSessionRequest(`Init failed: ${msg}`);
183 } finally {
184 host.deferUserMessages = false;
185 }
186}

Callers 1

Calls 10

isAbortErrorFunction · 0.90
finalizeTurnMethod · 0.80
showErrorMethod · 0.65
beginSessionRequestMethod · 0.65
initMethod · 0.65
trackMethod · 0.65
sendQueuedMessageMethod · 0.65
setAppStateMethod · 0.65
resetLivePaneMethod · 0.65
failSessionRequestMethod · 0.65

Tested by

no test coverage detected