MCPcopy Create free account
hub / github.com/Noumena-Network/code / wrapMessagesInSystemReminder

Function wrapMessagesInSystemReminder

src/utils/messages.ts:3201–3234  ·  view source on GitHub ↗
(
  messages: UserMessage[],
)

Source from the content-addressed store, hash-verified

3199}
3200
3201export function wrapMessagesInSystemReminder(
3202 messages: UserMessage[],
3203): UserMessage[] {
3204 return messages.map(msg => {
3205 if (typeof msg.message.content === 'string') {
3206 return {
3207 ...msg,
3208 message: {
3209 ...msg.message,
3210 content: wrapInSystemReminder(msg.message.content),
3211 },
3212 }
3213 } else if (Array.isArray(msg.message.content)) {
3214 // For array content, wrap text blocks in system-reminder
3215 const wrappedContent = msg.message.content.map(block => {
3216 if (block.type === 'text') {
3217 return {
3218 ...block,
3219 text: wrapInSystemReminder(block.text),
3220 }
3221 }
3222 return block
3223 })
3224 return {
3225 ...msg,
3226 message: {
3227 ...msg.message,
3228 content: wrappedContent,
3229 },
3230 }
3231 }
3232 return msg
3233 })
3234}
3235
3236function getPlanModeInstructions(attachment: {
3237 reminderType: 'full' | 'sparse'

Calls 1

wrapInSystemReminderFunction · 0.85

Tested by

no test coverage detected