(messages: Message[])
| 43 | ] |
| 44 | |
| 45 | export function isSessionContainerCompatible(messages: Message[]): boolean { |
| 46 | for (const msg of messages) { |
| 47 | if (msg.type !== 'assistant') { |
| 48 | continue |
| 49 | } |
| 50 | const content = msg.message.content |
| 51 | if (!Array.isArray(content)) { |
| 52 | continue |
| 53 | } |
| 54 | for (const block of content) { |
| 55 | if (block.type !== 'tool_use' || !('name' in block)) { |
| 56 | continue |
| 57 | } |
| 58 | const toolName = block.name as string |
| 59 | if (toolName.startsWith('mcp__')) { |
| 60 | return false |
| 61 | } |
| 62 | if (toolName === BASH_TOOL_NAME) { |
| 63 | const input = (block as { input?: Record<string, unknown> }).input |
| 64 | const command = (input?.command as string) || '' |
| 65 | if (EXTERNAL_COMMAND_PATTERNS.some(p => p.test(command))) { |
| 66 | return false |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | return true |
| 72 | } |
| 73 | |
| 74 | export function hasFrictionSignal(messages: Message[]): boolean { |
| 75 | for (let i = messages.length - 1; i >= 0; i--) { |
no outgoing calls
no test coverage detected