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

Function lastUserText

packages/agent-core/test/agent/plan.test.ts:606–622  ·  view source on GitHub ↗
(history: readonly { role: string; content: readonly unknown[] }[])

Source from the content-addressed store, hash-verified

604}
605
606function lastUserText(history: readonly { role: string; content: readonly unknown[] }[]): string {
607 const message = history.findLast((item) => item.role === 'user');
608 if (message === undefined) return '';
609 return message.content
610 .map((part) => {
611 if (
612 part !== null &&
613 typeof part === 'object' &&
614 (part as { type?: unknown }).type === 'text'
615 ) {
616 const text = (part as { text?: unknown }).text;
617 return typeof text === 'string' ? text : '';
618 }
619 return '';
620 })
621 .join('');
622}
623
624function toolResultText(history: readonly { role: string; content: readonly unknown[] }[]): string {
625 return history

Callers 1

plan.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected