axios+telemetry cleanup

This commit is contained in:
2026-04-02 15:19:11 +03:00
parent a3cbca1e11
commit 7e1eac8002
100 changed files with 3048 additions and 4491 deletions

View File

@@ -1,4 +1,4 @@
import axios from 'axios'
import { nativeRequest } from '../utils/http.js'
import { getOauthConfig } from '../constants/oauth.js'
import type { SDKMessage } from '../entrypoints/agentSdkTypes.js'
import { logForDebugging } from '../utils/debug.js'
@@ -47,14 +47,18 @@ async function fetchPage(
params: Record<string, string | number | boolean>,
label: string,
): Promise<HistoryPage | null> {
const resp = await axios
.get<SessionEventsResponse>(ctx.baseUrl, {
const queryString = new URLSearchParams(
Object.entries(params).map(([k, v]) => [k, String(v)]),
).toString()
const url = queryString ? `${ctx.baseUrl}?${queryString}` : ctx.baseUrl
const resp = await nativeRequest<SessionEventsResponse>(
url,
{
method: 'GET',
headers: ctx.headers,
params,
timeout: 15000,
validateStatus: () => true,
})
.catch(() => null)
},
).catch(() => null)
if (!resp || resp.status !== 200) {
logForDebugging(`[${label}] HTTP ${resp?.status ?? 'error'}`)
return null