(value: unknown)
| 501 | } |
| 502 | |
| 503 | function normalizeAgentColor(value: unknown) { |
| 504 | if (typeof value !== "string") return value |
| 505 | const trimmed = value.trim() |
| 506 | if (/^#[0-9a-fA-F]{6}$/.test(trimmed)) return trimmed |
| 507 | if (/^#[0-9a-fA-F]{3}$/.test(trimmed)) { |
| 508 | return ( |
| 509 | "#" + |
| 510 | trimmed |
| 511 | .slice(1) |
| 512 | .split("") |
| 513 | .map((c) => c + c) |
| 514 | .join("") |
| 515 | ) |
| 516 | } |
| 517 | |
| 518 | const named = trimmed.toLowerCase() |
| 519 | const namedColors: Record<string, string> = { |
| 520 | black: "#000000", |
| 521 | white: "#ffffff", |
| 522 | gray: "#808080", |
| 523 | grey: "#808080", |
| 524 | red: "#ff5c5c", |
| 525 | orange: "#ff9800", |
| 526 | yellow: "#f5a524", |
| 527 | green: "#4caf50", |
| 528 | cyan: "#22d3ee", |
| 529 | blue: "#2196f3", |
| 530 | purple: "#8b5cf6", |
| 531 | magenta: "#e91e63", |
| 532 | pink: "#ec4899", |
| 533 | } |
| 534 | return namedColors[named] ?? value |
| 535 | } |
| 536 | |
| 537 | function normalizeAgentModel(value: unknown) { |
| 538 | if (typeof value !== "string") return value |
no outgoing calls
no test coverage detected