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

Function resolveStoredPastedContent

src/history.ts:230–260  ·  view source on GitHub ↗

* Resolve stored paste content to full PastedContent by fetching from paste store if needed.

(
  stored: StoredPastedContent,
)

Source from the content-addressed store, hash-verified

228 * Resolve stored paste content to full PastedContent by fetching from paste store if needed.
229 */
230async function resolveStoredPastedContent(
231 stored: StoredPastedContent,
232): Promise<PastedContent | null> {
233 // If we have inline content, use it directly
234 if (stored.content) {
235 return {
236 id: stored.id,
237 type: stored.type,
238 content: stored.content,
239 mediaType: stored.mediaType,
240 filename: stored.filename,
241 }
242 }
243
244 // If we have a hash reference, fetch from paste store
245 if (stored.contentHash) {
246 const content = await retrievePastedText(stored.contentHash)
247 if (content) {
248 return {
249 id: stored.id,
250 type: stored.type,
251 content,
252 mediaType: stored.mediaType,
253 filename: stored.filename,
254 }
255 }
256 }
257
258 // Content not available
259 return null
260}
261
262/**
263 * Convert LogEntry to HistoryEntry by resolving paste store references.

Callers 1

logEntryToHistoryEntryFunction · 0.85

Calls 1

retrievePastedTextFunction · 0.85

Tested by

no test coverage detected