(messages: Message[], block: string)
| 101 | * No-op (returns the same array reference semantics, new array) when `block` is empty. |
| 102 | */ |
| 103 | export function withTextToolProtocol(messages: Message[], block: string): Message[] { |
| 104 | if (!block) return messages; |
| 105 | // Find the index just past the leading run of system messages. |
| 106 | let insertAt = 0; |
| 107 | while (insertAt < messages.length && messages[insertAt]!.role === 'system') insertAt++; |
| 108 | const protocolMsg: Message = { role: 'system', content: block }; |
| 109 | return [...messages.slice(0, insertAt), protocolMsg, ...messages.slice(insertAt)]; |
| 110 | } |
no outgoing calls
no test coverage detected