UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

29 lines (28 loc) 1.35 kB
import { m as normalizeResolvedSecretInputString } from "./types.secrets-kC0nOetj.js"; import { s as buildCopilotIdeHeaders } from "./copilot-dynamic-headers-C42FH9jo.js"; import "./provider-auth-BeZ7NZUU.js"; import "./secret-input-dpVVFmLG.js"; //#region extensions/github-copilot/runtime-identity.ts const COPILOT_RUNTIME_INTEGRATION_ID = "copilot-developer-cli"; /** Keep catalog and inference identity aligned without forwarding unrelated configured secrets. */ function buildCopilotRuntimeHeaders(params) { const provider = params?.config?.models?.providers?.["github-copilot"]; let integrationId = COPILOT_RUNTIME_INTEGRATION_ID; for (const headers of [ provider?.headers, provider?.request?.headers, params?.headers ]) for (const [name, value] of Object.entries(headers ?? {})) if (name.toLowerCase() === "copilot-integration-id") integrationId = normalizeResolvedSecretInputString({ value, path: "models.providers.github-copilot.headers.Copilot-Integration-Id" }) ?? integrationId; const headers = Object.fromEntries(Object.entries(params?.headers ?? {}).filter(([name]) => name.toLowerCase() !== "copilot-integration-id")); return { ...buildCopilotIdeHeaders(), "Openai-Organization": "github-copilot", ...headers, "Copilot-Integration-Id": integrationId }; } //#endregion export { buildCopilotRuntimeHeaders as t };