feat: add stable proactive delivery

This commit is contained in:
xmanrui 2026-08-30 11:24:53 +08:00
parent 410cb822d7
commit 31792d7bc8
88 changed files with 6427 additions and 488 deletions

View file

@ -176,6 +176,19 @@ test('FeishuRuntime becomes chat-ready only after Harness and Feishu are connect
},
}]);
assert.deepEqual(await runtime.sendProactiveText({
kind: 'group',
route: { chatId: 'oc_proactive_group' },
}, '主动投递'), { sent: true });
assert.deepEqual(FakeClient.sent[1], {
params: { receive_id_type: 'chat_id' },
data: {
receive_id: 'oc_proactive_group',
msg_type: 'text',
content: JSON.stringify({ text: '主动投递' }),
},
});
const stopped = await runtime.stop();
assert.equal(stopped.ready, false);
assert.equal(stopped.feishuLongConnectionState, 'idle');

View file

@ -107,6 +107,7 @@ function fixture({
starts: 0,
stops: 0,
sentTests: [],
proactiveSends: [],
probes: [],
responseModes: [],
repair,
@ -127,6 +128,10 @@ function fixture({
runtime.sentTests.push(text);
return { sent: true };
},
async sendProactiveText(...args) {
runtime.proactiveSends.push(args);
return { sent: true };
},
setGroupResponseMode(mode) {
runtime.responseModes.push(mode);
runtime.config.groupResponseMode = mode;
@ -793,6 +798,11 @@ test('connection test uses the selected bot runtime and shared message copy', as
assert.deepEqual(fx.runtimes.get(healthy.id)[0].sentTests, [
'✅ DeepSeek Harness 连接测试成功\n这条消息由「IM机器人」设置页中的“机器人 healthy(cli_heal••••7890)”机器人卡片发出。',
]);
const target = { kind: 'group', route: { chatId: 'oc_target' } };
assert.deepEqual(await fx.controller.sendProactiveText(healthy.id, target, '主动投递'), {
sent: true,
});
assert.deepEqual(fx.runtimes.get(healthy.id)[0].proactiveSends, [[target, '主动投递', {}]]);
await fx.controller.close();
});