UNPKG

@graphteon/juricode

Version:

We are forging the future with lines of digital steel

32 lines • 1.23 kB
export const formatMessage = (event) => { let text = event.message || ''; let isVerbose = false; if (event.observation === 'run' && event.content) { text = `${event.message}\n\nOutput:\n${event.content}`; isVerbose = true; } else if (event.action === 'run' && event.args?.command) { text = `šŸ”§ Executing: ${event.args.command}`; } else if (event.observation === 'agent_state_changed') { const state = event.extras?.agent_state; const reason = event.extras?.reason; text = `šŸ¤– Agent state: ${state}${reason ? ` (${reason})` : ''}`; } else if (event.action === 'recall') { text = `🧠 Retrieving knowledge: ${event.args?.query || 'unknown'}`; } else if (event.llm_metrics) { const metrics = event.llm_metrics; const cost = metrics.accumulated_cost?.toFixed(4) || '0'; const tokens = metrics.accumulated_token_usage?.total_tokens || 0; text += `\n\nšŸ’° Cost: $${cost} | šŸ”¢ Tokens: ${tokens}`; isVerbose = true; } text = text .trim() .replace(/\r\n/g, '\n') .replace(/\r/g, '\n'); return { text, isVerbose }; }; //# sourceMappingURL=format-message.js.map