Function
fileSource
(
part: Extract<SessionMessages[number]["parts"][number], { type: "file" }>,
text: { start: number; end: number; value: string },
)
Source from the content-addressed store, hash-verified
| 43 | } |
| 44 | |
| 45 | function fileSource( |
| 46 | part: Extract<SessionMessages[number]["parts"][number], { type: "file" }>, |
| 47 | text: { start: number; end: number; value: string }, |
| 48 | ) { |
| 49 | if (part.source) { |
| 50 | return { |
| 51 | ...structuredClone(part.source), |
| 52 | text, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | return { |
| 57 | type: "file" as const, |
| 58 | path: part.filename ?? part.url, |
| 59 | text, |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | export function messagePrompt(msg: SessionMessages[number]): RunPrompt { |
| 64 | const parts: RunPrompt["parts"] = [] |
Tested by
no test coverage detected