fix: thread accountId through subagent announce delivery

Co-authored-by: Adam Holt <adam91holt@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-01-17 02:45:07 +00:00
parent dbf8829283
commit 0291105913
9 changed files with 209 additions and 22 deletions

5
src/utils/account-id.ts Normal file
View File

@@ -0,0 +1,5 @@
export function normalizeAccountId(value?: string): string | undefined {
if (typeof value !== "string") return undefined;
const trimmed = value.trim();
return trimmed || undefined;
}

View File

@@ -0,0 +1,21 @@
import { normalizeAccountId } from "./account-id.js";
export type DeliveryContext = {
channel?: string;
to?: string;
accountId?: string;
};
export function normalizeDeliveryContext(context?: DeliveryContext): DeliveryContext | undefined {
if (!context) return undefined;
const channel =
typeof context.channel === "string" ? context.channel.trim() : undefined;
const to = typeof context.to === "string" ? context.to.trim() : undefined;
const accountId = normalizeAccountId(context.accountId);
if (!channel && !to && !accountId) return undefined;
return {
channel: channel || undefined,
to: to || undefined,
accountId,
};
}