|
@@ -44,6 +44,7 @@ import { SessionStatus } from "./status"
|
|
|
import { LLM } from "./llm"
|
|
import { LLM } from "./llm"
|
|
|
import { iife } from "@/util/iife"
|
|
import { iife } from "@/util/iife"
|
|
|
import { Shell } from "@/shell/shell"
|
|
import { Shell } from "@/shell/shell"
|
|
|
|
|
+import { Truncate } from "@/tool/truncation"
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
|
globalThis.AI_SDK_LOG_WARNINGS = false
|
|
globalThis.AI_SDK_LOG_WARNINGS = false
|
|
@@ -801,10 +802,17 @@ export namespace SessionPrompt {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const truncated = await Truncate.output(textParts.join("\n\n"), {}, input.agent)
|
|
|
|
|
+ const metadata = {
|
|
|
|
|
+ ...(result.metadata ?? {}),
|
|
|
|
|
+ truncated: truncated.truncated,
|
|
|
|
|
+ ...(truncated.truncated && { outputPath: truncated.outputPath }),
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return {
|
|
return {
|
|
|
title: "",
|
|
title: "",
|
|
|
- metadata: result.metadata ?? {},
|
|
|
|
|
- output: textParts.join("\n\n"),
|
|
|
|
|
|
|
+ metadata,
|
|
|
|
|
+ output: truncated.content,
|
|
|
attachments,
|
|
attachments,
|
|
|
content: result.content, // directly return content to preserve ordering when outputting to model
|
|
content: result.content, // directly return content to preserve ordering when outputting to model
|
|
|
}
|
|
}
|