MCPcopy
hub / github.com/codeaashu/claude-code / getAttachmentMessages

Function getAttachmentMessages

src/utils/attachments.ts:2937–2970  ·  view source on GitHub ↗
(
  input: string | null,
  toolUseContext: ToolUseContext,
  ideSelection: IDESelection | null,
  queuedCommands: QueuedCommand[],
  messages?: Message[],
  querySource?: QuerySource,
  options?: { skipSkillDiscovery?: boolean },
)

Source from the content-addressed store, hash-verified

2935}
2936
2937export async function* getAttachmentMessages(
2938 input: string | null,
2939 toolUseContext: ToolUseContext,
2940 ideSelection: IDESelection | null,
2941 queuedCommands: QueuedCommand[],
2942 messages?: Message[],
2943 querySource?: QuerySource,
2944 options?: { skipSkillDiscovery?: boolean },
2945): AsyncGenerator<AttachmentMessage, void> {
2946 // TODO: Compute this upstream
2947 const attachments = await getAttachments(
2948 input,
2949 toolUseContext,
2950 ideSelection,
2951 queuedCommands,
2952 messages,
2953 querySource,
2954 options,
2955 )
2956
2957 if (attachments.length === 0) {
2958 return
2959 }
2960
2961 logEvent('tengu_attachments', {
2962 attachment_types: attachments.map(
2963 _ => _.type,
2964 ) as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
2965 })
2966
2967 for (const attachment of attachments) {
2968 yield createAttachmentMessage(attachment)
2969 }
2970}
2971
2972/**
2973 * Generates a file attachment by reading a file with proper validation and truncation.

Callers 3

queryLoopFunction · 0.85
processUserInputBaseFunction · 0.85

Calls 3

getAttachmentsFunction · 0.85
logEventFunction · 0.85
createAttachmentMessageFunction · 0.85

Tested by

no test coverage detected