@wu529778790/open-im 1.11.6-beta.1 → 1.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,6 +34,11 @@ export declare function flushBufferedPayloads(state: {
34
34
  /**
35
35
  * CodeBuddy 会在工具调用前后发来多段 `assistant`:本轮内多为前缀增长的流式全文,
36
36
  * 工具后的新轮次则是独立正文。不能每次 `accumulated = text`,否则只剩开场白。
37
+ *
38
+ * 安全合并策略:
39
+ * - 新内容包含旧内容 → 流式增长,用新内容(不丢内容)
40
+ * - 旧内容包含新内容 → 可能是重复推送,但也可能是新轮次,拼接(不丢内容)
41
+ * - 其他情况 → 拼接(不丢内容)
37
42
  */
38
43
  export declare function mergeAssistantReply(previous: string, incoming: string): string;
39
44
  export declare function runCodeBuddy(cliPath: string, prompt: string, sessionId: string | undefined, workDir: string, callbacks: CodeBuddyRunCallbacks, options?: CodeBuddyRunOptions): CodeBuddyRunHandle;
@@ -163,6 +163,11 @@ function extractToolUses(content) {
163
163
  /**
164
164
  * CodeBuddy 会在工具调用前后发来多段 `assistant`:本轮内多为前缀增长的流式全文,
165
165
  * 工具后的新轮次则是独立正文。不能每次 `accumulated = text`,否则只剩开场白。
166
+ *
167
+ * 安全合并策略:
168
+ * - 新内容包含旧内容 → 流式增长,用新内容(不丢内容)
169
+ * - 旧内容包含新内容 → 可能是重复推送,但也可能是新轮次,拼接(不丢内容)
170
+ * - 其他情况 → 拼接(不丢内容)
166
171
  */
167
172
  export function mergeAssistantReply(previous, incoming) {
168
173
  const a = previous.trimEnd();
@@ -173,14 +178,10 @@ export function mergeAssistantReply(previous, incoming) {
173
178
  return b;
174
179
  if (a === b)
175
180
  return a;
181
+ // 只有"新内容包含旧内容"时才替换(流式增长场景)
176
182
  if (b.startsWith(a))
177
183
  return b;
178
- if (a.startsWith(b))
179
- return a;
180
- if (a.includes(b))
181
- return a;
182
- if (b.includes(a))
183
- return b;
184
+ // 其他情况一律拼接,绝不丢弃内容
184
185
  return `${a}\n\n${b}`;
185
186
  }
186
187
  export function runCodeBuddy(cliPath, prompt, sessionId, workDir, callbacks, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "1.11.6-beta.1",
3
+ "version": "1.11.6",
4
4
  "description": "Your AI coding assistant, in every chat app. Multi-platform IM bridge for Claude Code, Codex, and CodeBuddy.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",