mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 12:26:38 -06:00
eb38d5e486
* refactor(reply): publish settled dispatch receipts * refactor(reply): isolate dispatch outcome accounting * refactor(discord): infer settled dispatch result * test(reply): model settled dispatch receipts * test(reply): type settled receipt fixtures * test(telegram): declare settled final receipt * test(telegram): adapt legacy dispatch fixtures * fix(reply): complete settled receipt compatibility * test(channels): keep delivery suite within lint budget * test(channels): reuse settled count fixture * test(channels): consolidate receipt assertions * test(channels): extract delivery receipt fixtures * fix(qa): recover stopped clients after config restart * fix(reply): settle deferred delivery receipts * test(channels): share delivery turn fixtures * fix(channels): preserve non-visible reconciliation * fix(reply): preserve settled receipt compatibility * refactor(reply): make settled receipts canonical * refactor(reply): absorb settlement at dispatcher boundary * test(matrix): prove settled receipt precedence * refactor(sessions): extract prompt snapshot types * fix(reply): restore queued admission counts
33 lines
988 B
TypeScript
33 lines
988 B
TypeScript
type LegacyTelegramTestDispatchResult = {
|
|
queuedFinal?: boolean;
|
|
counts?: Partial<Record<"tool" | "block" | "final", number>>;
|
|
settledReceipt?: unknown;
|
|
} & Record<string, unknown>;
|
|
|
|
export function withTelegramTestSettledReceipt(result: unknown): LegacyTelegramTestDispatchResult {
|
|
const dispatchResult = result as LegacyTelegramTestDispatchResult;
|
|
if (dispatchResult.settledReceipt) {
|
|
return dispatchResult;
|
|
}
|
|
const delivered = (kind: "tool" | "block" | "final") => ({
|
|
delivered:
|
|
dispatchResult.counts?.[kind] ?? (kind === "final" && dispatchResult.queuedFinal ? 1 : 0),
|
|
deliveredNotVisible: 0,
|
|
cancelled: 0,
|
|
failedBeforeSend: 0,
|
|
failedAfterSend: 0,
|
|
});
|
|
const counts = {
|
|
tool: delivered("tool"),
|
|
block: delivered("block"),
|
|
final: delivered("final"),
|
|
};
|
|
return {
|
|
...dispatchResult,
|
|
settledReceipt: {
|
|
counts,
|
|
anyVisibleDelivered: Object.values(counts).some((entry) => entry.delivered > 0),
|
|
},
|
|
};
|
|
}
|