File tree Expand file tree Collapse file tree
packages/opencode/src/session Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1491,6 +1491,12 @@ export const layer = Layer.effect(
14911491 }
14921492
14931493 const templateParts = yield * resolvePromptParts ( template )
1494+ const inputFiles = new Set (
1495+ input . parts ?. filter ( ( part ) => new URL ( part . url ) . protocol === "file:" ) . map ( ( part ) => fileURLToPath ( part . url ) ) ,
1496+ )
1497+ const uniqueTemplateParts = templateParts . filter (
1498+ ( part ) => part . type !== "file" || ! inputFiles . has ( fileURLToPath ( part . url ) ) ,
1499+ )
14941500 const isSubtask = ( agent . mode === "subagent" && cmd . subtask !== false ) || cmd . subtask === true
14951501 const parts = isSubtask
14961502 ? [
@@ -1503,7 +1509,7 @@ export const layer = Layer.effect(
15031509 prompt : templateParts . find ( ( y ) => y . type === "text" ) ?. text ?? "" ,
15041510 } ,
15051511 ]
1506- : [ ...templateParts , ...( input . parts ?? [ ] ) ]
1512+ : [ ...uniqueTemplateParts , ...( input . parts ?? [ ] ) ]
15071513
15081514 const userAgent = isSubtask ? ( input . agent ?? ( yield * agents . defaultInfo ( ) ) . name ) : agent . name
15091515 const userModel = isSubtask
You can’t perform that action at this time.
0 commit comments