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

Function project

packages/agent-core/src/agent/context/projector.ts:99–115  ·  view source on GitHub ↗
(history: readonly ContextMessage[], options?: ProjectOptions)

Source from the content-addressed store, hash-verified

97 | { readonly kind: 'whitespace_text_dropped'; readonly role: string };
98
99export function project(history: readonly ContextMessage[], options?: ProjectOptions): Message[] {
100 let result = mergeAdjacentUserMessages(history, options?.onAnomaly);
101 if (options?.dedupeDuplicateToolCalls === true) {
102 result = dedupeDuplicateToolCalls(result, options.onAnomaly);
103 }
104 result = repairToolExchangeAdjacency(result, options);
105 if (options?.mergeConsecutiveAssistants === true) {
106 result = mergeConsecutiveAssistantMessages(result, options.onAnomaly);
107 }
108 if (options?.dropOrphanResults === true) {
109 result = dropOrphanToolResults(result, options.onAnomaly);
110 }
111 if (options?.dropLeadingNonUser === true) {
112 result = dropLeadingNonUserMessages(result, options.onAnomaly);
113 }
114 return result;
115}
116
117// Strict providers (Anthropic) require every assistant `tool_use` to be answered
118// by a matching `tool_result` in the immediately following message(s). A

Callers 3

context.test.tsFile · 0.90
projector.test.tsFile · 0.90
projectMethod · 0.90

Tested by

no test coverage detected