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

推荐订阅源

Martin Fowler
Martin Fowler
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
The Cloudflare Blog
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 司徒正美
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
C
Check Point Blog
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
V
V2EX
F
Fortinet All Blogs
B
Blog
大猫的无限游戏
大猫的无限游戏
N
Netflix TechBlog - Medium
B
Blog RSS Feed
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

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(media): replace Gemini CLI fallback with sandboxed An...
steipete · 2026-05-23 · via Recent Commits to openclaw:main

@@ -15,6 +15,7 @@ import type {

1515

MediaUnderstandingModelConfig,

1616

} from "../config/types.tools.js";

1717

import { logVerbose, shouldLogVerbose } from "../globals.js";

18+

import { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js";

1819

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

1920

import { resolveChannelInboundAttachmentRoots } from "../media/channel-inbound-roots.js";

2021

import { mergeInboundPathRoots } from "../media/inbound-path-policy.js";

@@ -26,7 +27,6 @@ import type { ActiveMediaModel } from "./active-model.types.js";

2627

import { MediaAttachmentCache, selectAttachments } from "./attachments.js";

2728

import { isMediaUnderstandingSkipError } from "./errors.js";

2829

import { fileExists } from "./fs.js";

29-

import { extractGeminiResponse } from "./output-extract.js";

3030

import { normalizeMediaExecutionProviderId, normalizeMediaProviderId } from "./provider-id.js";

3131

import {

3232

buildMediaUnderstandingRegistry,

@@ -304,11 +304,11 @@ export function resolveMediaAttachmentLocalRoots(params: {

304304

}

305305306306

const binaryCache = new Map<string, Promise<string | null>>();

307-

const geminiProbeCache = new Map<string, Promise<boolean>>();

307+

const antigravityCliCache = new Map<string, Promise<string | null>>();

308308309309

export function clearMediaUnderstandingBinaryCacheForTests(): void {

310310

binaryCache.clear();

311-

geminiProbeCache.clear();

311+

antigravityCliCache.clear();

312312

}

313313314314

function expandHomeDir(value: string): string {

@@ -406,27 +406,50 @@ async function hasBinary(name: string): Promise<boolean> {

406406

return Boolean(await findBinary(name));

407407

}

408408409-

async function probeGeminiCli(): Promise<boolean> {

410-

const cached = geminiProbeCache.get("gemini");

409+

async function probeAntigravityCliCandidate(command: string): Promise<string | null> {

410+

const resolved = await findBinary(command);

411+

if (!resolved) {

412+

return null;

413+

}

414+

const probeDir = await fs.mkdtemp(

415+

path.join(resolvePreferredOpenClawTmpDir(), "openclaw-antigravity-probe-"),

416+

);

417+

try {

418+

const { stdout } = await runExec(resolved, ["--help"], {

419+

timeoutMs: 3000,

420+

cwd: probeDir,

421+

});

422+

return stdout.includes("--print") &&

423+

stdout.includes("--add-dir") &&

424+

stdout.includes("--sandbox")

425+

? resolved

426+

: null;

427+

} catch {

428+

return null;

429+

} finally {

430+

await fs.rm(probeDir, { recursive: true, force: true }).catch(() => {});

431+

}

432+

}

433+434+

async function resolveAntigravityCliBinary(): Promise<string | null> {

435+

const cached = antigravityCliCache.get("agy");

411436

if (cached) {

412437

return cached;

413438

}

414439

const resolved = (async () => {

415-

if (!(await hasBinary("gemini"))) {

416-

return false;

417-

}

418-

try {

419-

const { stdout } = await runExec("gemini", ["--output-format", "json", "ok"], {

420-

timeoutMs: 8000,

421-

});

422-

return Boolean(

423-

extractGeminiResponse(stdout) ?? normalizeLowercaseStringOrEmpty(stdout).includes("ok"),

424-

);

425-

} catch {

426-

return false;

440+

const configured = process.env.OPENCLAW_ANTIGRAVITY_CLI?.trim();

441+

const candidates = [configured, "agy", "antigravity"].filter((value): value is string =>

442+

Boolean(value),

443+

);

444+

for (const candidate of candidates) {

445+

const command = await probeAntigravityCliCandidate(candidate);

446+

if (command) {

447+

return command;

448+

}

427449

}

450+

return null;

428451

})();

429-

geminiProbeCache.set("gemini", resolved);

452+

antigravityCliCache.set("agy", resolved);

430453

return resolved;

431454

}

432455

@@ -517,24 +540,25 @@ async function resolveLocalAudioEntry(): Promise<MediaUnderstandingModelConfig |

517540

return await resolveLocalWhisperEntry();

518541

}

519542520-

async function resolveGeminiCliEntry(

521-

_capability: MediaUnderstandingCapability,

543+

async function resolveAntigravityCliEntry(

544+

capability: MediaUnderstandingCapability,

522545

): Promise<MediaUnderstandingModelConfig | null> {

523-

if (!(await probeGeminiCli())) {

546+

if (capability === "audio") {

547+

return null;

548+

}

549+

const command = await resolveAntigravityCliBinary();

550+

if (!command) {

524551

return null;

525552

}

526553

return {

527554

type: "cli",

528-

command: "gemini",

555+

command,

529556

args: [

530-

"--output-format",

531-

"json",

532-

"--allowed-tools",

533-

"read_many_files",

534-

"--include-directories",

557+

"--sandbox",

558+

"--add-dir",

535559

"{{MediaDir}}",

536-

"{{Prompt}}",

537-

"Use read_many_files to read {{MediaPath}} and respond with only the text output.",

560+

"--print",

561+

"{{Prompt}} Inspect {{MediaPath}} and reply with only the requested media description.",

538562

],

539563

};

540564

}

@@ -682,14 +706,14 @@ async function resolveAutoEntries(params: {

682706

return [localAudio];

683707

}

684708

}

685-

const gemini = await resolveGeminiCliEntry(params.capability);

686-

if (gemini) {

687-

return [gemini];

688-

}

689709

const keys = await resolveKeyEntry(params);

690710

if (keys) {

691711

return [keys];

692712

}

713+

const antigravity = await resolveAntigravityCliEntry(params.capability);

714+

if (antigravity) {

715+

return [antigravity];

716+

}

693717

return [];

694718

}

695719