/
outbreak
/
kilocode
Обзор
Документация
Войти
/
outbreak
/
kilocode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/api/transform/stream.ts
105 строк
2 KB
Kevin van Dijk
Unify reasoning details accumulating with upstream
05 дек 2025, 17:59
05 дек 2025, 17:59
c4c3598
Код
Авторство
О чём код?
export type ApiStream = AsyncGenerator<ApiStreamChunk> export type ApiStreamChunk = // kilocode_change start | ApiStreamAnthropicThinkingChunk | ApiStreamAnthropicRedactedThinkingChunk // kilocode_change end | ApiStreamTextChunk | ApiStreamUsageChunk | ApiStreamReasoningChunk | ApiStreamGroundingChunk | ApiStreamToolCallChunk | ApiStreamToolCallStartChunk | ApiStreamToolCallDeltaChunk | ApiStreamToolCallEndChunk | ApiStreamToolCallPartialChunk | ApiStreamError export interface ApiStreamError { type: "error" error: string message: string } export interface ApiStreamTextChunk { type: "text" text: string } export interface ApiStreamReasoningChunk { type: "reasoning" text: string } // kilocode_change start export interface ApiStreamAnthropicThinkingChunk { type: "ant_thinking" thinking: string signature: string } export interface ApiStreamAnthropicRedactedThinkingChunk { type: "ant_redacted_thinking" data: string } // kilocode_change end export interface ApiStreamUsageChunk { type: "usage" inputTokens: number outputTokens: number cacheWriteTokens?: number cacheReadTokens?: number reasoningTokens?: number totalCost?: number inferenceProvider?: string // kilocode_change } export interface ApiStreamGroundingChunk { type: "grounding" sources: GroundingSource[] } export interface ApiStreamToolCallChunk { type: "tool_call" id: string name: string arguments: string } export interface ApiStreamToolCallStartChunk { type: "tool_call_start" id: string name: string } export interface ApiStreamToolCallDeltaChunk { type: "tool_call_delta" id: string delta: string } export interface ApiStreamToolCallEndChunk { type: "tool_call_end" id: string } /** * Raw tool call chunk from the API stream. * Providers emit this simple format; NativeToolCallParser handles all state management * (tracking, buffering, emitting start/delta/end events). */ export interface ApiStreamToolCallPartialChunk { type: "tool_call_partial" index: number id?: string name?: string arguments?: string } export interface GroundingSource { title: string url: string snippet?: string }