fix(gateway): harden agent provider routing
This commit is contained in:
@@ -8,17 +8,7 @@ export function normalizeMessageProvider(
|
||||
return normalized;
|
||||
}
|
||||
|
||||
export type GatewayMessageProvider =
|
||||
| "whatsapp"
|
||||
| "telegram"
|
||||
| "discord"
|
||||
| "slack"
|
||||
| "signal"
|
||||
| "imessage"
|
||||
| "msteams"
|
||||
| "webchat";
|
||||
|
||||
const GATEWAY_MESSAGE_PROVIDERS: GatewayMessageProvider[] = [
|
||||
export const DELIVERABLE_MESSAGE_PROVIDERS = [
|
||||
"whatsapp",
|
||||
"telegram",
|
||||
"discord",
|
||||
@@ -26,13 +16,48 @@ const GATEWAY_MESSAGE_PROVIDERS: GatewayMessageProvider[] = [
|
||||
"signal",
|
||||
"imessage",
|
||||
"msteams",
|
||||
] as const;
|
||||
|
||||
export type DeliverableMessageProvider =
|
||||
(typeof DELIVERABLE_MESSAGE_PROVIDERS)[number];
|
||||
|
||||
export const INTERNAL_MESSAGE_PROVIDER = "webchat" as const;
|
||||
export type InternalMessageProvider = typeof INTERNAL_MESSAGE_PROVIDER;
|
||||
|
||||
export type GatewayMessageProvider =
|
||||
| DeliverableMessageProvider
|
||||
| InternalMessageProvider;
|
||||
|
||||
export const GATEWAY_MESSAGE_PROVIDERS = [
|
||||
...DELIVERABLE_MESSAGE_PROVIDERS,
|
||||
"webchat",
|
||||
];
|
||||
] as const;
|
||||
|
||||
export const GATEWAY_AGENT_PROVIDER_ALIASES = ["imsg", "teams"] as const;
|
||||
export type GatewayAgentProviderAlias =
|
||||
(typeof GATEWAY_AGENT_PROVIDER_ALIASES)[number];
|
||||
|
||||
export type GatewayAgentProviderHint =
|
||||
| GatewayMessageProvider
|
||||
| "last"
|
||||
| GatewayAgentProviderAlias;
|
||||
|
||||
export const GATEWAY_AGENT_PROVIDER_VALUES = [
|
||||
...GATEWAY_MESSAGE_PROVIDERS,
|
||||
"last",
|
||||
...GATEWAY_AGENT_PROVIDER_ALIASES,
|
||||
] as const;
|
||||
|
||||
export function isGatewayMessageProvider(
|
||||
value: string,
|
||||
): value is GatewayMessageProvider {
|
||||
return (GATEWAY_MESSAGE_PROVIDERS as string[]).includes(value);
|
||||
return (GATEWAY_MESSAGE_PROVIDERS as readonly string[]).includes(value);
|
||||
}
|
||||
|
||||
export function isDeliverableMessageProvider(
|
||||
value: string,
|
||||
): value is DeliverableMessageProvider {
|
||||
return (DELIVERABLE_MESSAGE_PROVIDERS as readonly string[]).includes(value);
|
||||
}
|
||||
|
||||
export function resolveGatewayMessageProvider(
|
||||
|
||||
Reference in New Issue
Block a user