feat: add structured message failure reporting

This commit is contained in:
xmanrui 2026-08-25 13:42:43 +08:00
parent b42fc411c2
commit ad3c08ace3
59 changed files with 2405 additions and 607 deletions

View file

@ -1,4 +1,5 @@
import { normalizeAgentPresetCatalog, normalizeAgentPresetId, SET_AGENT_PRESET_ENDPOINT } from '../../agent-preset.js';
import { normalizeLastMessageError } from '../../last-message-error.js';
const ACCOUNT_STATES = new Set(['connected', 'connecting', 'offline', 'error']);
@ -68,6 +69,7 @@ export function createTokenChannelApi(channel, connectionSummary, {
),
lastCheckedAt: timestamp(value.health?.lastCheckedAt),
},
lastMessageError: normalizeLastMessageError(value.lastMessageError),
error: isRecord(value.error) ? {
code: text(value.error.code, `${channel.toUpperCase()}_ACCOUNT_ERROR`, 80),
message: text(value.error.message, `${channel}连接尚未就绪`),