惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
Y
Y Combinator Blog
月光博客
月光博客
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
博客园 - 司徒正美
V
Visual Studio Blog
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
The Cloudflare Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: avoid fetch runtime proxy imports · openclaw/opencla...
shakkernerd · 2026-05-06 · via Recent Commits to openclaw:main

@@ -1,6 +1,5 @@

11

import type { Dispatcher } from "undici";

22

import { logWarn } from "../../logger.js";

3-

import { captureHttpExchange } from "../../proxy-capture/runtime.js";

43

import { buildTimeoutAbortSignal } from "../../utils/fetch-timeout.js";

54

import { hasProxyEnvConfigured, shouldUseEnvHttpProxyForUrl } from "./proxy-env.js";

65

import { retainSafeHeadersForCrossOriginRedirect as retainSafeRedirectHeaders } from "./redirect-headers.js";

@@ -95,6 +94,11 @@ type GuardedFetchPresetOptions = Omit<

9594

>;

96959796

const DEFAULT_MAX_REDIRECTS = 3;

97+

const OPENCLAW_DEBUG_PROXY_ENABLED = "OPENCLAW_DEBUG_PROXY_ENABLED";

98+99+

function isTruthyEnvValue(value: string | undefined): boolean {

100+

return value === "1" || value === "true" || value === "yes" || value === "on";

101+

}

9810299103

export function withStrictGuardedFetchMode(params: GuardedFetchPresetOptions): GuardedFetchOptions {

100104

return { ...params, mode: GUARDED_FETCH_MODE.STRICT };

@@ -232,6 +236,36 @@ export function retainSafeHeadersForCrossOriginRedirectHeaders(

232236

return retainSafeRedirectHeaders(headers);

233237

}

234238239+

async function captureGuardedFetchExchange(params: {

240+

url: string;

241+

method: string;

242+

requestHeaders?: Headers | Record<string, string> | undefined;

243+

requestBody?: BodyInit | Buffer | string | null;

244+

response: Response;

245+

transport?: "http" | "sse";

246+

capture: GuardedFetchOptions["capture"];

247+

auditContext?: string;

248+

}): Promise<void> {

249+

if (params.capture === false || !isTruthyEnvValue(process.env[OPENCLAW_DEBUG_PROXY_ENABLED])) {

250+

return;

251+

}

252+

const { captureHttpExchange } = await import("../../proxy-capture/runtime.js");

253+

captureHttpExchange({

254+

url: params.url,

255+

method: params.method,

256+

requestHeaders: params.requestHeaders,

257+

requestBody: params.requestBody,

258+

response: params.response,

259+

transport: params.transport,

260+

flowId: params.capture?.flowId,

261+

meta: {

262+

captureOrigin: "guarded-fetch",

263+

...(params.auditContext ? { auditContext: params.auditContext } : {}),

264+

...params.capture?.meta,

265+

},

266+

});

267+

}

268+235269

function retainSafeHeadersForCrossOriginRedirect(init?: RequestInit): RequestInit | undefined {

236270

if (!init?.headers) {

237271

return init;

@@ -433,23 +467,17 @@ export async function fetchWithSsrFGuard(params: GuardedFetchOptions): Promise<G

433467

? await fetchWithRuntimeDispatcher(parsedUrl.toString(), init)

434468

: await defaultFetch(parsedUrl.toString(), init);

435469436-

if (params.capture !== false) {

437-

captureHttpExchange({

438-

url: parsedUrl.toString(),

439-

method: currentInit?.method ?? "GET",

440-

requestHeaders: currentInit?.headers as Headers | Record<string, string> | undefined,

441-

requestBody:

442-

(currentInit as (RequestInit & { body?: BodyInit | null }) | undefined)?.body ?? null,

443-

response,

444-

transport: "http",

445-

flowId: params.capture?.flowId,

446-

meta: {

447-

captureOrigin: "guarded-fetch",

448-

...(params.auditContext ? { auditContext: params.auditContext } : {}),

449-

...params.capture?.meta,

450-

},

451-

});

452-

}

470+

await captureGuardedFetchExchange({

471+

url: parsedUrl.toString(),

472+

method: currentInit?.method ?? "GET",

473+

requestHeaders: currentInit?.headers as Headers | Record<string, string> | undefined,

474+

requestBody:

475+

(currentInit as (RequestInit & { body?: BodyInit | null }) | undefined)?.body ?? null,

476+

response,

477+

transport: "http",

478+

capture: params.capture,

479+

auditContext: params.auditContext,

480+

});

453481454482

if (isRedirectStatus(response.status)) {

455483

const location = response.headers.get("location");