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

Function getAttachmentMessages

src/utils/attachments.ts:2944–2977  ·  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

2942}
2943
2944export async function* getAttachmentMessages(
2945 input: string | null,
2946 toolUseContext: ToolUseContext,
2947 ideSelection: IDESelection | null,
2948 queuedCommands: QueuedCommand[],
2949 messages?: Message[],
2950 querySource?: QuerySource,
2951 options?: { skipSkillDiscovery?: boolean },
2952): AsyncGenerator<AttachmentMessage, void> {
2953 // TODO: Compute this upstream
2954 const attachments = await getAttachments(
2955 input,
2956 toolUseContext,
2957 ideSelection,
2958 queuedCommands,
2959 messages,
2960 querySource,
2961 options,
2962 )
2963
2964 if (attachments.length === 0) {
2965 return
2966 }
2967
2968 logEvent('ncode_attachments', {
2969 attachment_types: attachments.map(
2970 _ => _.type,
2971 ) as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
2972 })
2973
2974 for (const attachment of attachments) {
2975 yield createAttachmentMessage(attachment)
2976 }
2977}
2978
2979/**
2980 * 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
createAttachmentMessageFunction · 0.70
logEventFunction · 0.50

Tested by

no test coverage detected