- Introduced a new `wrapAgentBlock` function to standardize the formatting of agent-only messages across the application. - Updated the `requestReview` method to utilize the new agent block format, enhancing consistency in review request messages. - Refactored legacy agent block handling to support both new XML-like and legacy fenced formats, ensuring backward compatibility. - Enhanced tests to validate the new agent block formatting and ensure proper extraction of agent-only content from messages.
18 lines
444 B
JavaScript
18 lines
444 B
JavaScript
const AGENT_BLOCK_TAG = 'info_for_agent';
|
|
const AGENT_BLOCK_OPEN = `<${AGENT_BLOCK_TAG}>`;
|
|
const AGENT_BLOCK_CLOSE = `</${AGENT_BLOCK_TAG}>`;
|
|
|
|
function wrapAgentBlock(text) {
|
|
const trimmed = typeof text === 'string' ? text.trim() : '';
|
|
if (!trimmed) {
|
|
return '';
|
|
}
|
|
return `${AGENT_BLOCK_OPEN}\n${trimmed}\n${AGENT_BLOCK_CLOSE}`;
|
|
}
|
|
|
|
module.exports = {
|
|
AGENT_BLOCK_TAG,
|
|
AGENT_BLOCK_OPEN,
|
|
AGENT_BLOCK_CLOSE,
|
|
wrapAgentBlock,
|
|
};
|