834
? { system: typeof system === 'string' ? [{ type: 'text', text: system }] : system }
835
: {}),
837
>
838
>
const response = await capiClient.makeRequest<Response>(
839
>
{
840
>
method: 'POST',
841
>
headers: {
842
>
...options?.headers,
843
>
'Content-Type': 'application/json',
844
>
'Authorization': `Bearer ${githubToken}`,
845
>
'X-Request-Id': requestId,
846
>
'X-GitHub-Api-Version': '2026-01-09',
847
>
// Should these be parameterized?
848
>
'OpenAI-Intent': 'messages-proxy',
849
>
'X-Interaction-Type': 'messages-proxy',
850
>
// `X-Initiator` (user|agent) is intentionally omitted: the
851
>
// user-vs-agent turn origin known to `ClaudeAgentSession` is not
852
>
// plumbed across the SDK subprocess to this proxy, so a hardcoded
853
>
// value would mislabel most agent-loop traffic. CAPI accepts the
854
>
// request without it (the `responses()` and `utilityChatCompletion()`
855
>
// paths already omit it). Thread a real per-turn initiator here if
856
>
// that signal ever becomes available at the proxy boundary.
857
>
},
858
>
suppressIntegrationId: options?.suppressIntegrationId,
859
>
body,
860
>
signal: options?.signal,
861
>
},
862
>
{ type: RequestType.ChatMessages },
863
>
);
864
if (!response.ok) {
865
if (response.status === 401 || response.status === 403) {