jbc-dssi 1.1.104 → 1.1.105
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.
- package/index.js +10 -2
- package/lib/groups-event-buffer.js +19 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import { homedir } from 'node:os';
|
|
|
22
22
|
import { watchUiConfig } from './lib/ui-config-push.js';
|
|
23
23
|
import { parseUiTuning, formatTuning, resolveRotateConfig } from './lib/ui-tuning.js';
|
|
24
24
|
import { createRestartAutocheck } from './lib/restart-autocheck.js';
|
|
25
|
-
import { createGroupsEventBuffer } from './lib/groups-event-buffer.js';
|
|
25
|
+
import { createGroupsEventBuffer, shouldBufferGroupEvent } from './lib/groups-event-buffer.js';
|
|
26
26
|
import { createScheduleEngine } from './lib/schedules.js';
|
|
27
27
|
|
|
28
28
|
/*
|
|
@@ -1085,7 +1085,15 @@ function activate(ctx, config) {
|
|
|
1085
1085
|
const groupsEventBuffer = createGroupsEventBuffer({ boot: `boot-${Date.now()}` });
|
|
1086
1086
|
|
|
1087
1087
|
function pushGroupsEvent(payload) {
|
|
1088
|
-
|
|
1088
|
+
/*
|
|
1089
|
+
* ★ 2026-11-08 修:`room_stream`(逐 token 流式帧)**只发在线、不进重放缓冲**。
|
|
1090
|
+
*
|
|
1091
|
+
* 真机事故:长回复(发版汇报)几十上百条分片把 200 条缓冲冲满,重连补发时
|
|
1092
|
+
* 那 200 条里还留着该轮的 turn_cards → 手机每一次重连都把它重复上云;
|
|
1093
|
+
* 服务端 /groups/turns 不去重 → 同一张卡 3 条、时间不同。
|
|
1094
|
+
* 排除流式帧后,缓冲只保留 room_line / round_end / turn_cards 等"必须补发"的事件。
|
|
1095
|
+
*/
|
|
1096
|
+
const event = shouldBufferGroupEvent(payload) ? groupsEventBuffer.record(payload) : payload;
|
|
1089
1097
|
const targets = new Set(live);
|
|
1090
1098
|
for (const channel of relayChannels) targets.add(channel);
|
|
1091
1099
|
for (const conn of targets) {
|
|
@@ -15,6 +15,25 @@
|
|
|
15
15
|
/** 缓冲上限(条)。200 条足够覆盖一次断线期间的一轮事件;超出丢最旧。 */
|
|
16
16
|
export const GROUPS_EVENT_BUFFER_MAX = 200;
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* 这条群事件要不要进「重连补发」缓冲(2026-11-08 修)。
|
|
20
|
+
*
|
|
21
|
+
* `room_stream` 是**逐 token 的流式帧**:只在直播时有意义,重放没有价值
|
|
22
|
+
* (手机重连靠 ROOM_SNAPSHOT + runningTurn 校准 live 块)。
|
|
23
|
+
*
|
|
24
|
+
* 为什么必须排除(真机事故 2026-11-08):一次长回复(发版汇报)会产生几十上百条
|
|
25
|
+
* 流式分片,200 条的缓冲被它冲满,真正需要补发的 room_line / round_end / turn_cards
|
|
26
|
+
* 反而被挤掉;而重连补发时那 200 条里恰好还留着长回复那一轮的 turn_cards →
|
|
27
|
+
* 手机每次重连都把同一张卡**重复上云**(服务端 /groups/turns 不去重),
|
|
28
|
+
* 表现为"发财哥的群内记录连续三条一样、时间不同,小码哥的正常"。
|
|
29
|
+
*
|
|
30
|
+
* @param {object} payload 群事件(type: room_line / room_stream / round_end / turn_cards / ack / group_list)
|
|
31
|
+
* @returns {boolean} true = 进缓冲(重连补发);false = 只发在线、不缓冲
|
|
32
|
+
*/
|
|
33
|
+
export function shouldBufferGroupEvent(payload) {
|
|
34
|
+
return payload?.type !== 'room_stream';
|
|
35
|
+
}
|
|
36
|
+
|
|
18
37
|
/**
|
|
19
38
|
* 造群事件缓冲。
|
|
20
39
|
*
|