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

Function resolveInboundAttachments

src/bridge/inboundAttachments.ts:124–135  ·  view source on GitHub ↗
(
  attachments: InboundAttachment[],
)

Source from the content-addressed store, hash-verified

122 * @path refs. Empty string if none resolved.
123 */
124export async function resolveInboundAttachments(
125 attachments: InboundAttachment[],
126): Promise<string> {
127 if (attachments.length === 0) return ''
128 debug(`resolving ${attachments.length} attachment(s)`)
129 const paths = await Promise.all(attachments.map(resolveOne))
130 const ok = paths.filter((p): p is string => p !== undefined)
131 if (ok.length === 0) return ''
132 // Quoted form — extractAtMentionedFiles truncates unquoted @refs at the
133 // first space, which breaks any home dir with spaces (/Users/John Smith/).
134 return ok.map(p => `@"${p}"`).join(' ') + ' '
135}
136
137/**
138 * Prepend @path refs to content, whichever form it's in.

Callers 2

resolveAndPrependFunction · 0.85

Calls 1

debugFunction · 0.70

Tested by

no test coverage detected