diff --git a/bin/opencode-ink.mjs b/bin/opencode-ink.mjs index 28bf5f9..ac1950e 100644 --- a/bin/opencode-ink.mjs +++ b/bin/opencode-ink.mjs @@ -1647,7 +1647,8 @@ const flattenMessagesToBlocks = (messages) => { blockCount++; } else if (part.match(/^\[AGENT:/)) { // AGENT TAG BLOCK (New) - const agentName = part.match(/\[AGENT:\s*([^\]]+)\]/)[1]; + const agentMatch = part.match(/\[AGENT:\s*([^\]]+)\]/); + const agentName = agentMatch ? agentMatch[1] : 'Unknown'; blocks.push({ role: 'assistant', type: 'agent_tag',