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

@ -57,6 +57,7 @@ test('Enterprise WeChat Bot ID and Secret binding stores credentials and starts
const configs = [];
let runtimeArgs;
let connectionTestText;
const proactiveSends = [];
const controller = new WecomController({
qrAuth: { start: async () => ({}), poll: async () => ({ status: 'waiting' }) },
credentials: {
@ -77,6 +78,10 @@ test('Enterprise WeChat Bot ID and Secret binding stores credentials and starts
status: { ready: true, wecomConnectionState: 'connected', harnessReachable: true },
start: async () => {}, stop: async () => {},
sendConnectionTest: async (text) => { connectionTestText = text; },
sendProactiveText: async (...args) => {
proactiveSends.push(args);
return { sent: true };
},
};
},
});
@ -88,6 +93,11 @@ test('Enterprise WeChat Bot ID and Secret binding stores credentials and starts
await controller.sendConnectionTest(status.bots[0].botId);
assert.match(connectionTestText, /DeepSeek Harness 连接测试成功/);
assert.match(connectionTestText, /企业微信机器人(remote••••nual)/);
const target = { kind: 'group', route: { chatId: 'group-target' } };
assert.deepEqual(await controller.sendProactiveText(status.bots[0].botId, target, '主动投递'), {
sent: true,
});
assert.deepEqual(proactiveSends, [[target, '主动投递', {}]]);
await controller.close();
});

View file

@ -42,6 +42,14 @@ test('Enterprise WeChat runtime sends a connection test only to the remembered p
chatId: 'member-private',
body: { msgtype: 'markdown', markdown: { content: '测试' } },
}]);
assert.deepEqual(await runtime.sendProactiveText({
kind: 'group',
route: { chatId: 'group-target' },
}, '主动投递'), { sent: true });
assert.deepEqual(client.sent[1], {
chatId: 'group-target',
body: { msgtype: 'markdown', markdown: { content: '主动投递' } },
});
await runtime.stop();
});