( env: NodeJS.ProcessEnv = process.env, )
| 122 | export const KIMI_CODE_CUSTOM_HEADERS_ENV = 'KIMI_CODE_CUSTOM_HEADERS'; |
| 123 | |
| 124 | export function parseKimiCodeCustomHeaders( |
| 125 | env: NodeJS.ProcessEnv = process.env, |
| 126 | ): Record<string, string> { |
| 127 | const raw = env[KIMI_CODE_CUSTOM_HEADERS_ENV]?.trim(); |
| 128 | if (raw === undefined || raw.length === 0) return {}; |
| 129 | const headers: Record<string, string> = {}; |
| 130 | for (const line of raw.split('\n')) { |
| 131 | const colon = line.indexOf(':'); |
| 132 | if (colon < 0) continue; |
| 133 | const name = line.slice(0, colon).trim(); |
| 134 | if (name.length === 0) continue; |
| 135 | headers[name] = line.slice(colon + 1).trim(); |
| 136 | } |
| 137 | return headers; |
| 138 | } |
| 139 | |
| 140 | export function assertKimiHostIdentity(identity: KimiHostIdentity | undefined): KimiHostIdentity { |
| 141 | if (identity === undefined) { |
no outgoing calls
no test coverage detected