This commit is contained in:
toboto 2026-01-30 13:55:41 +08:00 committed by GitHub
commit 07806339de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 45 additions and 8 deletions

View File

@ -6,6 +6,7 @@ Docs: https://docs.openclaw.ai
Status: stable.
### Changes
- Tools: add HTTP/HTTPS proxy support for web_search and web_fetch via environment variables (HTTP_PROXY/HTTPS_PROXY).
- Rebrand: rename the npm package/CLI to `openclaw`, add a `openclaw` compatibility shim, and move extensions to the `@openclaw/*` scope.
- Onboarding: strengthen security warning copy for beta + access control expectations.
- Onboarding: add Venice API key to non-interactive flow. (#1893) Thanks @jonisjongithub.

View File

@ -2,6 +2,7 @@ import { Type } from "@sinclair/typebox";
import type { OpenClawConfig } from "../../config/config.js";
import { formatCliCommand } from "../../cli/command-format.js";
import { createProxyAgent } from "../../infra/net/ssrf.js";
import type { AnyAgentTool } from "./common.js";
import { jsonResult, readNumberParam, readStringParam } from "./common.js";
import {
@ -273,6 +274,7 @@ async function runPerplexitySearch(params: {
timeoutSeconds: number;
}): Promise<{ content: string; citations: string[] }> {
const endpoint = `${params.baseUrl.replace(/\/$/, "")}/chat/completions`;
const proxyAgent = createProxyAgent();
const res = await fetch(endpoint, {
method: "POST",
@ -292,6 +294,8 @@ async function runPerplexitySearch(params: {
],
}),
signal: withTimeout(undefined, params.timeoutSeconds * 1000),
// @ts-expect-error - undici ProxyAgent dispatcher is not in standard fetch types
dispatcher: proxyAgent,
});
if (!res.ok) {
@ -371,6 +375,7 @@ async function runWebSearch(params: {
url.searchParams.set("freshness", params.freshness);
}
const proxyAgent = createProxyAgent();
const res = await fetch(url.toString(), {
method: "GET",
headers: {
@ -378,6 +383,8 @@ async function runWebSearch(params: {
"X-Subscription-Token": params.apiKey,
},
signal: withTimeout(undefined, params.timeoutSeconds * 1000),
// @ts-expect-error - undici ProxyAgent dispatcher is not in standard fetch types
dispatcher: proxyAgent,
});
if (!res.ok) {

View File

@ -64,12 +64,12 @@ export function randomToken(): string {
export function printWizardHeader(runtime: RuntimeEnv) {
const header = [
"▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄",
"██░▄▄▄░██░▄▄░██░▄▄▄██░▀██░██░▄▄▀██░████░▄▄▀██░███░██",
"██░███░██░▀▀░██░▄▄▄██░█░█░██░█████░████░▀▀░██░█░█░██",
"██░▀▀▀░██░█████░▀▀▀██░██▄░██░▀▀▄██░▀▀░█░██░██▄▀▄▀▄██",
"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀",
" 🦞 OPENCLAW 🦞 ",
"▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄",
"██░▄▄▄░██░▄▄░██░▄▄▄██░▀██░██░▄▄▀██░████░▄▄▀██░███░██",
"██░███░██░▀▀░██░▄▄▄██░█░█░██░█████░████░▀▀░██░█░█░██",
"██░▀▀▀░██░█████░▀▀▀██░██▄░██░▀▀▄██░▀▀░█░██░██▄▀▄▀▄██",
"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀",
" 🦞 OPENCLAW 🦞 ",
" ",
].join("\n");
runtime.log(header);

View File

@ -49,7 +49,13 @@ describe("state + config path candidates", () => {
const home = "/home/test";
const candidates = resolveDefaultConfigCandidates({} as NodeJS.ProcessEnv, () => home);
expect(candidates[0]).toBe(path.join(home, ".openclaw", "openclaw.json"));
expect(candidates).toHaveLength(1);
// Should include new .openclaw dir + legacy dirs (.clawdbot, .moltbot, .moldbot)
// with all config filenames (openclaw.json + clawdbot.json, moltbot.json, moldbot.json)
// = 4 dirs × 4 filenames = 16 candidates
expect(candidates).toHaveLength(16);
// Verify the candidates include expected legacy paths
expect(candidates).toContain(path.join(home, ".clawdbot", "clawdbot.json"));
expect(candidates).toContain(path.join(home, ".moltbot", "moltbot.json"));
});
it("prefers ~/.openclaw when it exists and legacy dir is missing", async () => {

View File

@ -1,6 +1,6 @@
import { lookup as dnsLookup } from "node:dns/promises";
import { lookup as dnsLookupCb, type LookupAddress } from "node:dns";
import { Agent, type Dispatcher } from "undici";
import { Agent, ProxyAgent, type Dispatcher } from "undici";
type LookupCallback = (
err: NodeJS.ErrnoException | null,
@ -210,7 +210,30 @@ export async function resolvePinnedHostname(
};
}
export function createProxyAgent(): ProxyAgent | undefined {
const httpProxy = process.env.HTTP_PROXY || process.env.http_proxy;
const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;
const proxy = httpsProxy || httpProxy;
if (!proxy) return undefined;
try {
return new ProxyAgent(proxy);
} catch (error) {
console.error("Failed to create proxy agent:", error);
return undefined;
}
}
export function createPinnedDispatcher(pinned: PinnedHostname): Dispatcher {
// If proxy is configured, use ProxyAgent instead of pinned Agent
// Note: When using proxy, SSRF protection is bypassed as the proxy handles DNS
const proxyAgent = createProxyAgent();
if (proxyAgent) {
return proxyAgent;
}
// Otherwise, use Agent with pinned lookup for SSRF protection
return new Agent({
connect: {
lookup: pinned.lookup,