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

Function deriveStepStopReason

packages/agent-core/src/loop/turn-step.ts:259–279  ·  view source on GitHub ↗
(response: LLMChatResponse)

Source from the content-addressed store, hash-verified

257}
258
259function deriveStepStopReason(response: LLMChatResponse): LoopStepStopReason {
260 switch (response.providerFinishReason) {
261 case 'truncated':
262 return 'max_tokens';
263 case 'filtered':
264 return 'filtered';
265 case 'paused':
266 return 'paused';
267 case 'other':
268 return 'unknown';
269 case 'completed':
270 case undefined:
271 return response.toolCalls.length > 0 ? 'tool_use' : 'end_turn';
272 case 'tool_calls':
273 return response.toolCalls.length > 0 ? 'tool_use' : 'unknown';
274 default: {
275 const _exhaustive: never = response.providerFinishReason;
276 return _exhaustive;
277 }
278 }
279}
280
281function stepEndProviderDiagnostics(
282 response: LLMChatResponse,

Callers 1

executeLoopStepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected