Skip to main content

usermessage

codebolt.message-processing.UserMessage(message: Message, promptOverride: boolean): UserMessage
Handles user message processing with file/environment context attachment

Parameters

NameTypeDescription
messageMessageMessage object containing user input and file/MCP references
promptOverridebooleanFlag to enable custom prompt rendering (default false)

Example

import { UserMessage } from './usermessage';

// Create a message with file references
const message = {
userMessage: "Please analyze these config files",
mentionedFiles: ["/src/config/app.json"],
mentionedMCPs: ["config-validator"]
};

// Initialize processor
const userMsgProcessor = new UserMessage(message);

// Generate full context prompt
const fullPrompt = await userMsgProcessor.toPrompt(
true, // Attach files
false, // Skip images
true // Include environment
);

console.log("Context-rich prompt:", fullPrompt);