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

Function getTaskReminderAttachments

src/utils/attachments.ts:3382–3439  ·  view source on GitHub ↗
(
  messages: Message[] | undefined,
  toolUseContext: ToolUseContext,
)

Source from the content-addressed store, hash-verified

3380}
3381
3382async function getTaskReminderAttachments(
3383 messages: Message[] | undefined,
3384 toolUseContext: ToolUseContext,
3385): Promise<Attachment[]> {
3386 if (!isTodoV2Enabled()) {
3387 return []
3388 }
3389
3390 // Skip for ant users
3391 if (isInternalBuild()) {
3392 return []
3393 }
3394
3395 // When SendUserMessage is in the toolkit, it's the primary communication
3396 // channel and the model is always told to use it (#20467). TaskUpdate
3397 // becomes a side channel — nudging the model about it conflicts with the
3398 // brief workflow. The tool itself stays available; this only gates the nag.
3399 if (
3400 BRIEF_TOOL_NAME &&
3401 toolUseContext.options.tools.some(t => toolMatchesName(t, BRIEF_TOOL_NAME))
3402 ) {
3403 return []
3404 }
3405
3406 // Skip if TaskUpdate tool is not available
3407 if (
3408 !toolUseContext.options.tools.some(t =>
3409 toolMatchesName(t, TASK_UPDATE_TOOL_NAME),
3410 )
3411 ) {
3412 return []
3413 }
3414
3415 // Skip if no messages provided
3416 if (!messages || messages.length === 0) {
3417 return []
3418 }
3419
3420 const { turnsSinceLastTaskManagement, turnsSinceLastReminder } =
3421 getTaskReminderTurnCounts(messages)
3422
3423 // Check if we should show a reminder
3424 if (
3425 turnsSinceLastTaskManagement >= TODO_REMINDER_CONFIG.TURNS_SINCE_WRITE &&
3426 turnsSinceLastReminder >= TODO_REMINDER_CONFIG.TURNS_BETWEEN_REMINDERS
3427 ) {
3428 const tasks = await listTasks(getTaskListId())
3429 return [
3430 {
3431 type: 'task_reminder',
3432 content: tasks,
3433 itemCount: tasks.length,
3434 },
3435 ]
3436 }
3437
3438 return []
3439}

Callers 1

getAttachmentsFunction · 0.85

Calls 6

isTodoV2EnabledFunction · 0.85
isInternalBuildFunction · 0.85
toolMatchesNameFunction · 0.85
listTasksFunction · 0.85
getTaskListIdFunction · 0.85

Tested by

no test coverage detected