File size: 1,166 Bytes
3a65265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import type { QueueDropPolicy, QueueMode } from "./types.js";

export function normalizeQueueMode(raw?: string): QueueMode | undefined {
  if (!raw) return undefined;
  const cleaned = raw.trim().toLowerCase();
  if (cleaned === "queue" || cleaned === "queued") return "steer";
  if (cleaned === "interrupt" || cleaned === "interrupts" || cleaned === "abort")
    return "interrupt";
  if (cleaned === "steer" || cleaned === "steering") return "steer";
  if (cleaned === "followup" || cleaned === "follow-ups" || cleaned === "followups")
    return "followup";
  if (cleaned === "collect" || cleaned === "coalesce") return "collect";
  if (cleaned === "steer+backlog" || cleaned === "steer-backlog" || cleaned === "steer_backlog")
    return "steer-backlog";
  return undefined;
}

export function normalizeQueueDropPolicy(raw?: string): QueueDropPolicy | undefined {
  if (!raw) return undefined;
  const cleaned = raw.trim().toLowerCase();
  if (cleaned === "old" || cleaned === "oldest") return "old";
  if (cleaned === "new" || cleaned === "newest") return "new";
  if (cleaned === "summarize" || cleaned === "summary") return "summarize";
  return undefined;
}