//#region src/utils/format-messages.ts
function formatMessagesForLLM(messages) {
	return messages.map((message) => {
		return {
			role: message.role === "user" ? "user" : message.role === "agent" ? "assistant" : "system",
			content: typeof message.content === "object" && message.content && "text" in message.content ? message.content.text : String(message.content || ""),
			timestamp: message.createdAt,
			fromSubAgentId: message.fromSubAgentId
		};
	});
}
function formatMessagesForLLMContext(messages) {
	return formatMessagesForLLM(messages).map((msg) => {
		return `${msg.role === "user" ? "User" : msg.role === "assistant" ? "Agent" : "System"}${msg.fromSubAgentId ? ` (${msg.fromSubAgentId})` : ""}: ${msg.content}`;
	}).join("\n\n");
}

//#endregion
export { formatMessagesForLLM, formatMessagesForLLMContext };