* Strip a leading provider segment that Bedrock (and similar) prepend before * the actual family token — e.g. `anthropic.`, `us.anthropic.`, `eu.`. Keeps * everything from the recognised family token onward so prefix matching works.
(id: string)
| 80 | * everything from the recognised family token onward so prefix matching works. |
| 81 | */ |
| 82 | function stripProviderPrefix(id: string): string { |
| 83 | // Remove leading region/provider segments (dot-separated) until we hit the |
| 84 | // model token. Provider/region segments never contain a hyphen, whereas |
| 85 | // model families do (e.g. `claude-3-5-sonnet`, `gpt-4.1`). So drop any |
| 86 | // leading dot-separated segment that has no hyphen. |
| 87 | let rest = id; |
| 88 | while (true) { |
| 89 | const dot = rest.indexOf("."); |
| 90 | if (dot === -1) break; |
| 91 | const head = rest.slice(0, dot); |
| 92 | if (head.length === 0 || head.includes("-")) break; |
| 93 | rest = rest.slice(dot + 1); |
| 94 | } |
| 95 | return rest; |
| 96 | } |
| 97 | |
| 98 | // Normalize each comma-separated env entry IDENTICALLY to the incoming model id |
| 99 | // (date-suffix + provider/region prefix stripped, lowercased) so a prefixed |
no outgoing calls
no test coverage detected
searching dependent graphs…