MCPcopy Index your code
hub / github.com/anomalyco/opencode / fileSource

Function fileSource

packages/opencode/src/cli/cmd/run/session.shared.ts:45–61  ·  view source on GitHub ↗
(
  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
45function 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
63export function messagePrompt(msg: SessionMessages[number]): RunPrompt {
64 const parts: RunPrompt["parts"] = []

Callers 1

messagePromptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected