فهرست منبع

fix(opencode): apply message transforms during compaction (#17823)

DS 1 ماه پیش
والد
کامیت
4cb29967f6
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      packages/opencode/src/session/compaction.ts

+ 3 - 1
packages/opencode/src/session/compaction.ts

@@ -200,6 +200,8 @@ When constructing the summary, try to stick to this template:
 ---`
 
     const promptText = compacting.prompt ?? [defaultPrompt, ...compacting.context].join("\n\n")
+    const msgs = structuredClone(messages)
+    await Plugin.trigger("experimental.chat.messages.transform", {}, { messages: msgs })
     const result = await processor.process({
       user: userMessage,
       agent,
@@ -208,7 +210,7 @@ When constructing the summary, try to stick to this template:
       tools: {},
       system: [],
       messages: [
-        ...MessageV2.toModelMessages(messages, model, { stripMedia: true }),
+        ...MessageV2.toModelMessages(msgs, model, { stripMedia: true }),
         {
           role: "user",
           content: [