Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/opencode/src/session/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,24 @@ export namespace SessionPrompt {
}),
}

const history = await MessageV2.filterCompacted(MessageV2.stream(input.sessionID))
const loaded = new Set<string>()
for (const msg of history) {
for (const part of msg.parts) {
if (part.type === "file") {
const filepath = fileURLToPath(part.url)
loaded.add(filepath)
}
}
}

const parts = await Promise.all(
input.parts.map(async (part): Promise<MessageV2.Part[]> => {
if (part.type === "file") {
const filepath = fileURLToPath(part.url)
if (loaded.has(filepath)) return []
loaded.add(filepath)

const url = new URL(part.url)
switch (url.protocol) {
case "data:":
Expand Down