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

Function seedInFlight

apps/kimi-web/src/api/daemon/agentEventProjector.ts:544–587  ·  view source on GitHub ↗
(sessionId: string, turn: AppInFlightTurn)

Source from the content-addressed store, hash-verified

542 }
543
544 function seedInFlight(sessionId: string, turn: AppInFlightTurn): AppEvent[] {
545 reset(sessionId);
546 const s = getOrCreate(sessionId);
547
548 const promptId = turn.promptId ?? ulid('pr_');
549 s.currentPromptId = promptId;
550 s.turnPromptId.set(turn.turnId, promptId);
551
552 const msg = startAssistantMessage(s, sessionId, promptId);
553 if (turn.thinkingText.length > 0) {
554 msg.content.push({ type: 'thinking', thinking: turn.thinkingText });
555 }
556 if (turn.assistantText.length > 0) {
557 msg.content.push({ type: 'text', text: turn.assistantText });
558 }
559 for (const tool of turn.runningTools) {
560 const outputLines =
561 typeof tool.lastProgress?.text === 'string' && tool.lastProgress.text.length > 0
562 ? [tool.lastProgress.text]
563 : undefined;
564 msg.content.push({
565 type: 'toolUse',
566 toolCallId: tool.toolCallId,
567 toolName: tool.name,
568 input: tool.args ?? {},
569 outputLines,
570 });
571 s.toolStartTimes.set(tool.toolCallId, Date.now());
572 }
573 s.currentAssistantMsgId = msg.id;
574 s.turnTextLen = turn.assistantText.length;
575 s.turnThinkLen = turn.thinkingText.length;
576
577 return [
578 {
579 type: 'sessionStatusChanged',
580 sessionId,
581 status: 'running',
582 previousStatus: 'idle',
583 currentPromptId: promptId,
584 },
585 { type: 'messageCreated', message: cloneMessage(msg) },
586 ];
587 }
588
589 function project(
590 rawType: string,

Callers

nothing calls this directly

Calls 8

getOrCreateFunction · 0.85
ulidFunction · 0.85
startAssistantMessageFunction · 0.85
cloneMessageFunction · 0.85
resetFunction · 0.70
setMethod · 0.65
nowMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected