File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/opencode/src/session Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import { SessionStatus } from "./status"
4444import { LLM } from "./llm"
4545import { iife } from "@/util/iife"
4646import { Shell } from "@/shell/shell"
47+ import { Truncate } from "@/tool/truncation"
4748
4849// @ts -ignore
4950globalThis . AI_SDK_LOG_WARNINGS = false
@@ -801,10 +802,17 @@ export namespace SessionPrompt {
801802 }
802803 }
803804
805+ const truncated = await Truncate . output ( textParts . join ( "\n\n" ) , { } , input . agent )
806+ const metadata = {
807+ ...( result . metadata ?? { } ) ,
808+ truncated : truncated . truncated ,
809+ ...( truncated . truncated && { outputPath : truncated . outputPath } ) ,
810+ }
811+
804812 return {
805813 title : "" ,
806- metadata : result . metadata ?? { } ,
807- output : textParts . join ( "\n\n" ) ,
814+ metadata,
815+ output : truncated . content ,
808816 attachments,
809817 content : result . content , // directly return content to preserve ordering when outputting to model
810818 }
You can’t perform that action at this time.
0 commit comments