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

推荐订阅源

H
Help Net Security
T
ThreatConnect
SecWiki News
SecWiki News
F
Future of Privacy Forum
AWS News Blog
AWS News Blog
C
Cisco Blogs
A
Arctic Wolf
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
Scott Helme
Scott Helme
V
V2EX
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
K
Kaspersky official blog
G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
N
News | PayPal Newsroom
Schneier on Security
Schneier on Security
NISL@THU
NISL@THU
Microsoft Azure Blog
Microsoft Azure Blog
量子位
The Hacker News
The Hacker News
Stack Overflow Blog
Stack Overflow Blog
Security Latest
Security Latest
M
Microsoft Research Blog - Microsoft Research
Google Online Security Blog
Google Online Security Blog
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
I
InfoQ
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
The Cloudflare Blog
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
Cisco Talos Blog
Cisco Talos Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Troy Hunt's Blog
F
Fox-IT International blog
S
Security @ Cisco Blogs
博客园 - 司徒正美
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
Comments on: Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
LINUX DO - 最新话题
GbyAI
GbyAI
Project Zero
Project Zero
腾讯CDC
T
Tailwind CSS Blog

Recent Commits to openclaw:main

fix: avoid compaction checkpoint transcript copies (#86666) fix: preserve code mode failure output test: avoid message tool discovery in send helper · openclaw/openclaw@1514cc8 fix(scripts): bound guard inventory file reads · openclaw/openclaw@6defcb0 fix(test): isolate kitchen sink rpc home env feat(signal): support reaction approvals (#85894) fix(scripts): bound source scan file reads · openclaw/openclaw@57748a6 test: serialize agents tools vitest files · openclaw/openclaw@978a2d0 fix(auto-reply): use context-aware overflow reserve hints (#84399) · openclaw/openclaw@3a4f2b1 feat(gateway): forward OpenAI sampling params (#84094) · openclaw/openclaw@6c7b3f3 perf: cache model cost indexes · openclaw/openclaw@068924e fix: hide unsupported best effort message option · openclaw/openclaw@5dc7043 refactor: reuse realtime output activity in google meet (#86665) fix(test): harden bundled plugin install sweep · openclaw/openclaw@84929e4 fix: prefer source public artifacts in source checkouts · openclaw/openclaw@c87957d test: type child process spawn mock · openclaw/openclaw@65a2105 test(installer): cover rocky cli installs · openclaw/openclaw@fe33747 docs: update changelog for landed fixes · openclaw/openclaw@da831e2 fix: dampen repeated device-required probes · openclaw/openclaw@399c692 fix(ui): keep local file markdown links inert · openclaw/openclaw@fc2d2d5 fix(update): avoid duplicate plugin smoke failures · openclaw/openclaw@342bde2 fix(gateway): cap retained compaction checkpoint bytes · openclaw/openclaw@d7361ef fix: stabilize tests and reduce plugin memory churn · openclaw/openclaw@c1a026a perf: reduce runtime metadata hotpath churn · openclaw/openclaw@1d21224 refactor: share realtime output activity tracking (#86661) fix(memory-wiki): bound compile page reads (#86660) · openclaw/openclaw@acbdb8c test(qa-matrix): use larger media coverage jpeg fix(cli): reject unknown command help roots (#81083) (thanks @YB0y) · openclaw/openclaw@bec7d56 test: improve test profiling helpers · openclaw/openclaw@68ab48b perf: reduce fuzzy matching allocations · openclaw/openclaw@ec7ad3b perf: reduce runtime cache churn · openclaw/openclaw@1531fe2 refactor: reuse forced consult coordinator in discord voice (#86656) · openclaw/openclaw@0164fd5 fix(scripts): drain codex-cli metadata stdout (#84239) (thanks @Iftek… fix(test): avoid discord voice tts activation tax · openclaw/openclaw@75ac0b5 fix(codex): disable native thread personality (#85891) (thanks @lastg… · openclaw/openclaw@0f35ec2 Refactor realtime voice turn context tracking (#86650) fix(discord): surface silent reply-delivery skips and remove runtime.… · openclaw/openclaw@3a48366 test(discord): cover deliver-lambda abort-skip path via processDiscor… · openclaw/openclaw@48adcb1 docs: update changelog for landed bug fixes · openclaw/openclaw@75c6cf2 test(qa-matrix): use valid media coverage jpeg · openclaw/openclaw@0f54221 fix(gmail-watcher): strip listeners from old process after settleProc… · openclaw/openclaw@0a38932 fix(gmail-watcher): prevent TDZ in settleProcess and guard exit handl… · openclaw/openclaw@94968c8 fix(hooks): stop existing Gmail watcher before re-entry to prevent leaks fix(codex): honor yolo app-server approval policy · openclaw/openclaw@7b30291 fix(usage-cost): invalidate durable cache on missing-cost semantics c… · openclaw/openclaw@9c79a0f fix(usage-cost): preserve transport-recorded positive cost for unpric… · openclaw/openclaw@6e85869 fix(usage-cost): only flag catalog-default zeros, preserve operator-c… · openclaw/openclaw@1670249 fix: treat zero-rate usage cost as unknown · openclaw/openclaw@116c600 fix(usage-cost): surface unpriced-model spend as missingCostEntries i… · openclaw/openclaw@1cc0a96 fix(irc): normalize channel route ids · openclaw/openclaw@9cb1e47 test(irc): cover transient channel join · openclaw/openclaw@c4c80ce fix(irc): store inbound channel routes as channel:#name and join befo… · openclaw/openclaw@63dee51 fix(test): harden macos onboarding e2e · openclaw/openclaw@cd96542 fix(agents): strip markdown code spans from IDENTITY.md values and la… · openclaw/openclaw@55c9a6b perf: reduce runtime cache churn · openclaw/openclaw@5b6d03e fix(pi-runner): flush blocks after compaction retry (#85288) (thanks … · openclaw/openclaw@0d4575a fix(gateway): abort stale agent runs on restart · openclaw/openclaw@a122d80 fix(ui): harden control e2e browser setup · openclaw/openclaw@4424daf fix(telegram): keep overlapping DM replies deliverable (#85361) (than… · openclaw/openclaw@0f67dfd fix(openai): route compaction through Codex auth provider (#86408) · openclaw/openclaw@f4cfa01 refactor: share realtime forced consult coordination · openclaw/openclaw@5dccba7 test(qa-lab): add runtime confidence reports build: refresh dependency pins (#86628) · openclaw/openclaw@cda7c30 test: port release validation stabilizers · openclaw/openclaw@9f7485e fix(cron): stop forcing message tool for delivery · openclaw/openclaw@c51fa0d fix(google): omit request config with cached content test: stabilize release validation test harnesses fix(test): bound kitchen sink command output · openclaw/openclaw@f1197ed fix(discord): stabilize realtime wake-name feedback test(config): guard legacy agentRuntime regression perf: precompute audio resample kernels fix(codex): allow env api-key app-server bootstrap · openclaw/openclaw@009b18c refactor: reuse shared coercion helpers (#86419) · openclaw/openclaw@77d9ac3 fix(cron): preserve runtime snapshot for isolated delivery · openclaw/openclaw@a98660e fix(test): model active assistant failover attempts · openclaw/openclaw@c55bee5 docs: update changelog for bug sweep landings test: fix mock signatures for tsgo · openclaw/openclaw@aa05c5c docs: document fail-closed behavior for rejected modelPatterns · openclaw/openclaw@36f269d fix(security): guard plugin modelPatterns with compileSafeRegex · openclaw/openclaw@117e082 docs(manifest): note safe-regex validation for modelPatterns · openclaw/openclaw@e7c7ee4 style: use bracket notation for __openclaw to satisfy no-underscore-d… · openclaw/openclaw@9a6c161 fix(security): escape field names in transcript regex extraction · openclaw/openclaw@fe8d99d test: tighten oversized metadata assertion to check exact id in __ope… · openclaw/openclaw@aff8e64 fix(logging): exit on stdout/stderr EPIPE instead of spinning · openclaw/openclaw@2aa5f17 fix(logging): preserve failure exit on EPIPE · openclaw/openclaw@623a60a fix(logging): keep string failure codes on EPIPE · openclaw/openclaw@78a1e7d fix(scripts): docs-spellcheck.sh fails on bash 3.2 with set -u · openclaw/openclaw@fef57f9 fix(docs): keep spellcheck bash 3.2-compatible · openclaw/openclaw@778fa87 fix(test): assert e2e agent reply payloads · openclaw/openclaw@74f3a1e test(gateway): pin live gateway models to pi runtime · openclaw/openclaw@c88f660 perf: speed up local TUI startup · openclaw/openclaw@a0023fb refactor: share realtime voice activation helpers (#86615) · openclaw/openclaw@d0ab0d9 fix(feishu): render native presentation buttons (#86588) · openclaw/openclaw@170e0aa fix(test): narrow plugin gauntlet prebuild · openclaw/openclaw@423f7d2 fix: route Discord gateway metadata through proxy (#86601) · openclaw/openclaw@5b6d409 fix: tighten Discord voice wake matching (#86595) · openclaw/openclaw@f00a912 refactor(logging): share diagnostic message lifecycle · openclaw/openclaw@baab4cf fix(cron): restore suspended lanes to default concurrency · openclaw/openclaw@e844d1d fix(auth): emit one-shot doctor-pointer warning for Keychain-only leg… · openclaw/openclaw@a61d530 fix(codex): recover stale preflight bindings (#86602) · openclaw/openclaw@9b9d897
test(ollama): support cloud api live smoke · openclaw/openclaw@2a6b4ed
vincentkoc · 2026-05-26 · via Recent Commits to openclaw:main

@@ -4,6 +4,7 @@ import fs from "node:fs/promises";

44

import os from "node:os";

55

import path from "node:path";

66

import { describe, expect, it } from "vitest";

7+

import { isLocalOllamaBaseUrl } from "./src/discovery-shared.js";

78

import { createOllamaEmbeddingProvider } from "./src/embedding-provider.js";

89

import { createOllamaStreamFn } from "./src/stream.js";

910

import { createOllamaWebSearchProvider } from "./src/web-search-provider.js";

@@ -16,6 +17,38 @@ const EMBEDDING_MODEL =

1617

process.env.OPENCLAW_LIVE_OLLAMA_EMBED_MODEL?.trim() || "embeddinggemma:latest";

1718

const PROVIDER_ID = process.env.OPENCLAW_LIVE_OLLAMA_PROVIDER_ID?.trim() || "ollama-live-custom";

1819

const RUN_WEB_SEARCH = process.env.OPENCLAW_LIVE_OLLAMA_WEB_SEARCH !== "0";

20+

const RUN_EMBEDDINGS =

21+

process.env.OPENCLAW_LIVE_OLLAMA_EMBEDDINGS === "1" ||

22+

(process.env.OPENCLAW_LIVE_OLLAMA_EMBEDDINGS !== "0" && !isOllamaCloudBaseUrl(OLLAMA_BASE_URL));

23+

const OLLAMA_CONFIG_API_KEY = isLocalOllamaBaseUrl(OLLAMA_BASE_URL)

24+

? "ollama-local"

25+

: "OLLAMA_API_KEY";

26+27+

function isOllamaCloudBaseUrl(baseUrl: string): boolean {

28+

try {

29+

const parsed = new URL(baseUrl);

30+

return parsed.protocol === "https:" && parsed.hostname === "ollama.com";

31+

} catch {

32+

return false;

33+

}

34+

}

35+36+

function requireOllamaRuntimeApiKey(): string | undefined {

37+

if (OLLAMA_CONFIG_API_KEY !== "OLLAMA_API_KEY") {

38+

return undefined;

39+

}

40+

const apiKey = process.env.OLLAMA_API_KEY?.trim();

41+

if (!apiKey) {

42+

throw new Error(

43+

"OPENCLAW_LIVE_OLLAMA_BASE_URL points at a remote Ollama host; set OLLAMA_API_KEY.",

44+

);

45+

}

46+

return apiKey;

47+

}

48+49+

function resolveOllamaDirectApiKey(): string {

50+

return requireOllamaRuntimeApiKey() ?? "ollama-local";

51+

}

19522053

async function collectStreamEvents<T>(stream: AsyncIterable<T>): Promise<T[]> {

2154

const events: T[] = [];

@@ -37,7 +70,7 @@ async function withTempOpenClawState<T>(run: (paths: { root: string }) => Promis

3770

ollama: {

3871

api: "ollama",

3972

baseUrl: OLLAMA_BASE_URL,

40-

apiKey: "ollama-local",

73+

apiKey: OLLAMA_CONFIG_API_KEY,

4174

models: [],

4275

},

4376

},

@@ -54,6 +87,13 @@ async function withTempOpenClawState<T>(run: (paths: { root: string }) => Promis

5487

}

55885689

async function runOpenClawCli(args: string[], env: NodeJS.ProcessEnv) {

90+

const hasBuiltEntry = ["entry.js", "entry.mjs"].some((entry) =>

91+

fsSync.existsSync(path.join(process.cwd(), "dist", entry)),

92+

);

93+

const sourceRunnerAvailable = !hasBuiltEntry;

94+

const commandArgs = sourceRunnerAvailable

95+

? ["scripts/run-node.mjs", ...args]

96+

: ["openclaw.mjs", ...args];

5797

const outputRoot = fsSync.mkdtempSync(path.join(os.tmpdir(), "openclaw-ollama-cli-output-"));

5898

const stdoutPath = path.join(outputRoot, "stdout.txt");

5999

const stderrPath = path.join(outputRoot, "stderr.txt");

@@ -62,10 +102,10 @@ async function runOpenClawCli(args: string[], env: NodeJS.ProcessEnv) {

62102

let stdoutClosed = false;

63103

let stderrClosed = false;

64104

try {

65-

const result = spawnSync(process.execPath, ["openclaw.mjs", ...args], {

105+

const result = spawnSync(process.execPath, commandArgs, {

66106

cwd: process.cwd(),

67107

env,

68-

timeout: 90_000,

108+

timeout: sourceRunnerAvailable ? 180_000 : 90_000,

69109

stdio: ["ignore", stdoutFd, stderrFd],

70110

});

71111

fsSync.closeSync(stdoutFd);

@@ -96,6 +136,7 @@ function parseJsonEnvelope(stdout: string): Record<string, unknown> {

96136

}

9713798138

function buildCliEnv(root: string): NodeJS.ProcessEnv {

139+

const apiKey = requireOllamaRuntimeApiKey();

99140

return {

100141

PATH: process.env.PATH,

101142

HOME: process.env.HOME,

@@ -110,7 +151,9 @@ function buildCliEnv(root: string): NodeJS.ProcessEnv {

110151

OPENCLAW_CONFIG_PATH: path.join(root, "openclaw.json"),

111152

OPENCLAW_NO_RESPAWN: "1",

112153

OPENCLAW_TEST_FAST: "1",

113-

OLLAMA_API_KEY: "ollama-local",

154+

PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN: "false",

155+

pnpm_config_verify_deps_before_run: "false",

156+

OLLAMA_API_KEY: apiKey ?? "ollama-local",

114157

};

115158

}

116159

@@ -204,6 +247,7 @@ describe.skipIf(!LIVE)("ollama live", () => {

204247

onPayload: (body: unknown) => {

205248

payload = body as NonNullable<typeof payload>;

206249

},

250+

apiKey: requireOllamaRuntimeApiKey(),

207251

} as never,

208252

);

209253

@@ -223,31 +267,35 @@ describe.skipIf(!LIVE)("ollama live", () => {

223267

expect(properties?.options?.type).toBe("object");

224268

}, 60_000);

225269226-

it("embeds a batch through the current Ollama endpoint for custom providers", async () => {

227-

const { client } = await createOllamaEmbeddingProvider({

228-

config: {

229-

models: {

230-

providers: {

231-

[PROVIDER_ID]: {

232-

api: "ollama",

233-

baseUrl: OLLAMA_BASE_URL,

234-

apiKey: "ollama-local",

270+

it.skipIf(!RUN_EMBEDDINGS)(

271+

"embeds a batch through the current Ollama endpoint for custom providers",

272+

async () => {

273+

const { client } = await createOllamaEmbeddingProvider({

274+

config: {

275+

models: {

276+

providers: {

277+

[PROVIDER_ID]: {

278+

api: "ollama",

279+

baseUrl: OLLAMA_BASE_URL,

280+

apiKey: resolveOllamaDirectApiKey(),

281+

},

235282

},

236283

},

237284

},

238-

},

239-

provider: PROVIDER_ID,

240-

model: `${PROVIDER_ID}/${EMBEDDING_MODEL}`,

241-

} as never);

285+

provider: PROVIDER_ID,

286+

model: `${PROVIDER_ID}/${EMBEDDING_MODEL}`,

287+

} as never);

242288243-

const embeddings = await client.embedBatch(["hello", "world"]);

289+

const embeddings = await client.embedBatch(["hello", "world"]);

244290245-

expect(embeddings).toHaveLength(2);

246-

expect(embeddings[0]?.length ?? 0).toBeGreaterThan(0);

247-

expect(embeddings[1]?.length).toBe(embeddings[0]?.length);

248-

expect(Math.hypot(...embeddings[0])).toBeGreaterThan(0.99);

249-

expect(Math.hypot(...embeddings[0])).toBeLessThan(1.01);

250-

}, 45_000);

291+

expect(embeddings).toHaveLength(2);

292+

expect(embeddings[0]?.length ?? 0).toBeGreaterThan(0);

293+

expect(embeddings[1]?.length).toBe(embeddings[0]?.length);

294+

expect(Math.hypot(...embeddings[0])).toBeGreaterThan(0.99);

295+

expect(Math.hypot(...embeddings[0])).toBeLessThan(1.01);

296+

},

297+

45_000,

298+

);

251299252300

it.skipIf(!RUN_WEB_SEARCH)(

253301

"searches through Ollama web search fallback endpoints",

@@ -260,7 +308,7 @@ describe.skipIf(!LIVE)("ollama live", () => {

260308

ollama: {

261309

api: "ollama",

262310

baseUrl: OLLAMA_BASE_URL,

263-

apiKey: "ollama-local",

311+

apiKey: resolveOllamaDirectApiKey(),

264312

},

265313

},

266314

},