feat: 简化微信渠道账号连接

This commit is contained in:
brother7 committed 2026-09-14 12:05:16 +08:00
1 parent a721b8fb7e
commit 21e707d9c4
21 files changed
+238 -1078

No files matched your search

+3 -4
View File
@@ -12,12 +12,12 @@ const agentB = { slug: 'ml-' + 'b'.repeat(32), name: '资料助手', published_v
const legacy = {
id: 'wechat-legacy', display_name: '原有微信', binding_id: 'binding-legacy', revision: 7, enabled: true,
status: 'active', health: 'connected', blockers: [], target_agent_slug: agentA.slug, target_agent_name: agentA.name,
target_agent_published_version: 2, provider_generation: 'generation-legacy', access_mode: 'self_only', policy_revision: 1,
target_agent_published_version: 2, provider_generation: 'generation-legacy',
};
const spare = {
id: 'wechat-spare', display_name: '备用微信', binding_id: 'binding-spare', revision: 2, enabled: false,
status: 'paused', health: 'login_required', blockers: ['target_required'], target_agent_slug: null, target_agent_name: null,
target_agent_published_version: null, provider_generation: 'generation-spare', access_mode: 'self_only', policy_revision: 0,
target_agent_published_version: null, provider_generation: 'generation-spare',
};
beforeEach(() => {
@@ -28,8 +28,7 @@ beforeEach(() => {
if (operation === 'channelAccounts') return { items: [legacy, spare] };
if (operation === 'channelAccountWechatBindStart') return { session_key: 'qr-spare', status: 'verification_required', qrcode_url: 'https://login.example.test/qr' };
if (operation === 'routeChannelAccount') return { channel: { ...spare, target_agent_slug: input.target_agent_slug } };
if (operation === 'channelBindings') return { items: [{ ...legacy, address: 'wechat:legacy', target_agent_address: 'agent:legacy', route_revision: 7, worker_online: true, agent_slug: agentA.slug, published_version: 2, desired_state: 'enabled', sync_state: 'ready' }], available_accounts: [] };
if (operation === 'channelCallers') return { items: [] };
if (operation === 'channelActivity') return { items: [], next_offset: null };
throw new Error(`Unexpected operation ${operation}`);
});
});