MCPcopy
hub / github.com/claude-code-best/claude-code / getQueuedCommandAttachments

Function getQueuedCommandAttachments

src/utils/attachments.ts:1100–1137  ·  view source on GitHub ↗
(
  queuedCommands: QueuedCommand[],
)

Source from the content-addressed store, hash-verified

1098const INLINE_NOTIFICATION_MODES = new Set(['prompt', 'task-notification'])
1099
1100export async function getQueuedCommandAttachments(
1101 queuedCommands: QueuedCommand[],
1102): Promise<Attachment[]> {
1103 if (!queuedCommands) {
1104 return []
1105 }
1106 // Include both 'prompt' and 'task-notification' commands as attachments.
1107 // During proactive agentic loops, task-notification commands would otherwise
1108 // stay in the queue permanently (useQueueProcessor can't run while a query
1109 // is active), causing hasCommandsInQueue() to return true and Sleep to
1110 // wake immediately with 0ms duration in an infinite loop.
1111 const filtered = queuedCommands.filter(_ =>
1112 INLINE_NOTIFICATION_MODES.has(_.mode),
1113 )
1114 return Promise.all(
1115 filtered.map(async _ => {
1116 const imageBlocks = await buildImageContentBlocks(_.pastedContents)
1117 let prompt: string | Array<ContentBlockParam> = _.value
1118 if (imageBlocks.length > 0) {
1119 // Build content block array with text + images so the model sees them
1120 const textValue =
1121 typeof _.value === 'string'
1122 ? _.value
1123 : extractTextContent(_.value, '\n')
1124 prompt = [{ type: 'text' as const, text: textValue }, ...imageBlocks]
1125 }
1126 return {
1127 type: 'queued_command' as const,
1128 prompt,
1129 source_uuid: _.uuid,
1130 imagePasteIds: getImagePasteIds(_.pastedContents),
1131 commandMode: _.mode,
1132 origin: _.origin,
1133 isMeta: _.isMeta,
1134 }
1135 }),
1136 )
1137}
1138
1139export function getAgentPendingMessageAttachments(
1140 toolUseContext: ToolUseContext,

Callers 2

getAttachmentsFunction · 0.85
REPLFunction · 0.85

Calls 4

buildImageContentBlocksFunction · 0.85
extractTextContentFunction · 0.85
getImagePasteIdsFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected