From cc485f00096dc9766b19165fdb7ca833f21a60b1 Mon Sep 17 00:00:00 2001 From: sol Date: Sat, 7 Mar 2026 19:23:13 +0000 Subject: [PATCH] Switch from code block to blockquote format Code blocks collapse after ~4 lines in Mattermost, requiring click to expand. Blockquotes (> prefix) never collapse and show all content inline with a distinct left border. - Tool calls: inline code formatting (backtick tool name) - Thinking text: box drawing prefix for visual distinction - Header: bold status + code agent name - All lines visible without clicking to expand --- src/status-formatter.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/status-formatter.js b/src/status-formatter.js index 21c0706..c8dce8f 100644 --- a/src/status-formatter.js +++ b/src/status-formatter.js @@ -42,12 +42,12 @@ function format(sessionState, opts = {}) { const elapsed = formatElapsed(Date.now() - sessionState.startTime); const agentId = sessionState.agentId || extractAgentId(sessionState.sessionKey); const statusPrefix = statusIcon(sessionState.status); - lines.push(`${indent}${statusPrefix} ${agentId} | ${elapsed}`); + lines.push(`${indent}**${statusPrefix}** \`${agentId}\` | ${elapsed}`); // Status lines (trimmed to maxLines, most recent) const statusLines = (sessionState.lines || []).slice(-maxLines); for (const line of statusLines) { - lines.push(`${indent} ${truncateLine(line)}`); + lines.push(`${indent}${formatStatusLine(truncateLine(line))}`); } // Child sessions (sub-agents) @@ -63,13 +63,14 @@ function format(sessionState, opts = {}) { const tokenStr = sessionState.tokenCount ? ` | ${formatTokens(sessionState.tokenCount)} tokens` : ''; - lines.push(`${indent} [${sessionState.status.toUpperCase()}] ${elapsed}${tokenStr}`); + lines.push(`${indent}**[${sessionState.status.toUpperCase()}]** ${elapsed}${tokenStr}`); } - // Wrap in code block at top level so it looks distinct from normal messages + // Wrap in blockquote at top level — visually distinct (left border), + // never collapses like code blocks do, supports inline markdown var body = lines.join('\n'); if (depth === 0) { - body = '```\n' + body + '\n```'; + body = body.split('\n').map(function (l) { return '> ' + l; }).join('\n'); } return body; } @@ -120,6 +121,24 @@ function statusIcon(status) { } } +/** + * Format a status line with inline markdown. + * Tool calls get inline code formatting; thinking text stays plain. + * @param {string} line + * @returns {string} + */ +function formatStatusLine(line) { + // Tool call lines: "toolName: arguments [OK]" or "toolName: label" + var match = line.match(/^(\S+?): (.+?)( \[OK\]| \[ERR\])?$/); + if (match) { + var marker = match[3] || ''; + return '`' + match[1] + ':` ' + match[2] + marker; + } + // Thinking text — use a unicode marker to distinguish from tool calls + // Avoid markdown italic (*) since it breaks with special characters + return '\u2502 ' + line; +} + /** * Truncate a line to MAX_LINE_CHARS. * @param {string} line