Release v0.23.2

Fixed Claude models via GitHub Copilot re-answering all previous prompts.

fixes #209
This commit is contained in:
Mario Zechner 2025-12-17 17:56:00 +01:00
parent b5c3d77219
commit 4894fa411c
18 changed files with 268 additions and 198 deletions

View file

@ -310,13 +310,11 @@ function createClient(model: Model<"openai-responses">, context: Context, apiKey
const headers = { ...model.headers };
if (model.provider === "github-copilot") {
// Copilot expects X-Initiator to indicate whether the request is user-initiated
// or agent-initiated (e.g. follow-up after assistant/tool messages). If there is
// no prior message, default to user-initiated.
// or agent-initiated. It's an agent call if ANY message in history has assistant/tool role.
const messages = context.messages || [];
const lastMessage = messages[messages.length - 1];
const isAgentCall = lastMessage ? lastMessage.role !== "user" : false;
const initiatorValue = isAgentCall ? "agent" : "user";
headers["X-Initiator"] = initiatorValue;
const isAgentCall = messages.some((msg) => msg.role === "assistant" || msg.role === "toolResult");
headers["X-Initiator"] = isAgentCall ? "agent" : "user";
headers["Openai-Intent"] = "conversation-edits";
}
return new OpenAI({