fix: always populate user-agent (#708)

This commit is contained in:
cthomas
2026-01-27 15:02:01 -08:00
committed by GitHub
parent a426e4bae3
commit edeb344ad9
10 changed files with 45 additions and 49 deletions

View File

@@ -41,6 +41,7 @@ import { getResumeData } from "../agent/check-approval";
import { getClient } from "../agent/client";
import { getCurrentAgentId, setCurrentAgentId } from "../agent/context";
import { type AgentProvenance, createAgent } from "../agent/create";
import { getLettaCodeHeaders } from "../agent/http-headers";
import { ISOLATED_BLOCK_LABELS } from "../agent/memory";
import {
detachMemoryFilesystemBlock,
@@ -1099,11 +1100,7 @@ export default function App({
const apiKey = process.env.LETTA_API_KEY || settings.env?.LETTA_API_KEY;
const response = await fetch(`${baseURL}/v1/metadata/balance`, {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${apiKey}`,
"X-Letta-Source": "letta-code",
},
headers: getLettaCodeHeaders(apiKey),
});
if (response.ok) {
@@ -5113,11 +5110,7 @@ export default function App({
const balanceResponse = await fetch(
`${baseURL}/v1/metadata/balance`,
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${apiKey}`,
"X-Letta-Source": "letta-code",
},
headers: getLettaCodeHeaders(apiKey),
},
);
@@ -8754,9 +8747,7 @@ ${SYSTEM_REMINDER_CLOSE}
{
method: "POST",
headers: {
"Content-Type": "application/json",
...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),
"X-Letta-Source": "letta-code",
...getLettaCodeHeaders(apiKey),
"X-Letta-Code-Device-ID": settingsManager.getOrCreateDeviceId(),
},
body: JSON.stringify({

View File

@@ -4,6 +4,7 @@
*/
import { getServerUrl } from "../../agent/client";
import { getMcpOAuthHeaders } from "../../agent/http-headers";
import { settingsManager } from "../../settings-manager";
// Match backend's OauthStreamEvent enum
@@ -76,12 +77,7 @@ export async function connectMcpServer(
const response = await fetch(`${baseUrl}/v1/tools/mcp/servers/connect`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "text/event-stream",
Authorization: `Bearer ${apiKey}`,
"X-Letta-Source": "letta-code",
},
headers: getMcpOAuthHeaders(apiKey),
body: JSON.stringify(config),
signal: abortSignal,
});