mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
73bba03e4c
* refactor: canonicalize session delivery state * test: canonicalize reply persistence fixtures * test: canonicalize talk delivery fixtures * test: canonicalize voice session routes * test: canonicalize attachment delivery fixtures * test: migrate gateway delivery fixtures * fix: skip invalid session delivery rows * test: align delivery SDK surface gates * fix: preserve legacy delivery precedence * test: canonicalize heartbeat delivery fixtures * fix: preserve delivery route prompt identity * test: canonicalize session delivery fixtures * fix: preserve recoverable legacy delivery routes * fix: canonicalize remaining session state * fix: preserve canonical session classification * style: format delivery state changes * test: refresh plugin SDK delivery baseline * test: avoid mutating session fixture input * style: simplify delivery identity check * style: simplify delivery origin spread * fix: preserve fresh delivery route metadata * test: assert canonical surface route switch * fix: canonicalize doctor file-store imports * fix: preserve transitional delivery migration state * fix: satisfy canonical delivery CI gates * ci: scope GitHub App token permissions * test: infer canonical delivery projections * test: canonicalize ACP requester delivery fixtures * test: canonicalize harness rollback fixture * style: apply pinned formatter
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import type { SessionOrigin } from "../../config/sessions.js";
|
|
import type { ChannelRouteRef } from "../../plugin-sdk/channel-route.js";
|
|
import { normalizeDeliveryChannelRoute } from "../../utils/delivery-context.shared.js";
|
|
import type { DeliveryContext } from "../../utils/delivery-context.types.js";
|
|
|
|
export function stripThreadFromSessionRoute(
|
|
route: ChannelRouteRef | undefined,
|
|
): ChannelRouteRef | undefined {
|
|
const normalized = normalizeDeliveryChannelRoute(route);
|
|
if (!normalized?.thread) {
|
|
return normalized;
|
|
}
|
|
const { thread: _drop, ...withoutThread } = normalized;
|
|
return Object.keys(withoutThread).length > 0 ? withoutThread : undefined;
|
|
}
|
|
|
|
export function stripThreadIdFromDeliveryContext(
|
|
context: DeliveryContext | undefined,
|
|
): DeliveryContext | undefined {
|
|
if (!context || context.threadId == null || context.threadId === "") {
|
|
return context;
|
|
}
|
|
const { threadId: _threadId, ...rest } = context;
|
|
return Object.keys(rest).length > 0 ? rest : undefined;
|
|
}
|
|
|
|
export function stripThreadIdFromOrigin(
|
|
origin: SessionOrigin | undefined,
|
|
): SessionOrigin | undefined {
|
|
if (!origin || origin.threadId == null || origin.threadId === "") {
|
|
return origin;
|
|
}
|
|
const { threadId: _threadId, ...rest } = origin;
|
|
return Object.keys(rest).length > 0 ? rest : undefined;
|
|
}
|