fix(infra): restore approval account binding compatibility

This commit is contained in:
Peter Steinberger 2026-04-04 09:13:04 +01:00
parent af7c6f4c68
commit 21ca006eca
No known key found for this signature in database
2 changed files with 13 additions and 1 deletions

View File

@ -80,7 +80,13 @@ export function resolveApprovalRequestChannelAccountId(params: {
if (!expectedChannel) {
return null;
}
return resolveApprovalRequestAccountId(params);
const turnSourceChannel = normalizeOptionalChannel(params.request.request.turnSourceChannel);
if (!turnSourceChannel || turnSourceChannel === expectedChannel) {
return resolveApprovalRequestAccountId(params);
}
const sessionBinding = resolvePersistedApprovalRequestSessionBinding(params);
return sessionBinding?.channel === expectedChannel ? (sessionBinding.accountId ?? null) : null;
}
export function doesApprovalRequestMatchChannelAccount(params: {

View File

@ -8,6 +8,12 @@ import type { ExecApprovalRequest } from "./exec-approvals.js";
import { resolveSessionDeliveryTarget } from "./outbound/targets.js";
import type { PluginApprovalRequest } from "./plugin-approvals.js";
export {
doesApprovalRequestMatchChannelAccount,
resolveApprovalRequestAccountId,
resolveApprovalRequestChannelAccountId,
} from "./approval-request-account-binding.js";
export type ExecApprovalSessionTarget = {
channel?: string;
to: string;