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

推荐订阅源

D
DataBreaches.Net
L
LangChain Blog
博客园_首页
J
Java Code Geeks
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
WordPress大学
WordPress大学
V
Visual Studio Blog
T
The Blog of Author Tim Ferriss
U
Unit 42
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
C
Check Point Blog
IT之家
IT之家
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
D
Docker
有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
阮一峰的网络日志
阮一峰的网络日志
I
InfoQ

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
test(extensions): use real provider response mocks · open...
vincentkoc · 2026-06-23 · via Recent Commits to openclaw:main

@@ -48,6 +48,14 @@ function makeAgentModelEntry(overrides: Record<string, unknown> = {}) {

4848

};

4949

}

505051+

function jsonResponse(payload: unknown, init: ResponseInit = {}): Response {

52+

return new Response(JSON.stringify(payload), {

53+

status: 200,

54+

headers: { "Content-Type": "application/json" },

55+

...init,

56+

});

57+

}

58+5159

function expectedStaticChatCatalog() {

5260

return DEEPINFRA_MODEL_CATALOG.map((model) => {

5361

const compat = Object.assign({}, model.compat, {

@@ -195,10 +203,7 @@ describe("discoverDeepInfraModels (chat-only shim)", () => {

195203

});

196204197205

it("fetches the openclaw-projection endpoint and parses chat-surface entries when an API key is configured", async () => {

198-

const mockFetch = vi.fn().mockResolvedValue({

199-

ok: true,

200-

json: () => Promise.resolve({ data: [makeAgentModelEntry()] }),

201-

});

206+

const mockFetch = vi.fn().mockResolvedValue(jsonResponse({ data: [makeAgentModelEntry()] }));

202207203208

await withFetchPathTest(mockFetch, { DEEPINFRA_API_KEY: "sk-test" }, async () => {

204209

const models = await discoverDeepInfraModels();

@@ -228,21 +233,19 @@ describe("discoverDeepInfraModels (chat-only shim)", () => {

228233

});

229234230235

it("skips entries with no metadata or no surface tag, and deduplicates ids", async () => {

231-

const mockFetch = vi.fn().mockResolvedValue({

232-

ok: true,

233-

json: () =>

234-

Promise.resolve({

235-

data: [

236-

{ id: "BAAI/bge-m3", object: "model", metadata: null },

237-

makeAgentModelEntry({

238-

id: "untagged/model",

239-

metadata: { context_length: 1, max_tokens: 1, pricing: {}, tags: [] },

240-

}),

241-

makeAgentModelEntry(),

242-

makeAgentModelEntry(),

243-

],

244-

}),

245-

});

236+

const mockFetch = vi.fn().mockResolvedValue(

237+

jsonResponse({

238+

data: [

239+

{ id: "BAAI/bge-m3", object: "model", metadata: null },

240+

makeAgentModelEntry({

241+

id: "untagged/model",

242+

metadata: { context_length: 1, max_tokens: 1, pricing: {}, tags: [] },

243+

}),

244+

makeAgentModelEntry(),

245+

makeAgentModelEntry(),

246+

],

247+

}),

248+

);

246249247250

await withFetchPathTest(mockFetch, { DEEPINFRA_API_KEY: "sk-test" }, async () => {

248251

const models = await discoverDeepInfraModels();

@@ -283,7 +286,7 @@ describe("discoverDeepInfraModels (chat-only shim)", () => {

283286

});

284287285288

it("falls back to the static catalog on non-2xx HTTP responses", async () => {

286-

const mockFetch = vi.fn().mockResolvedValue({ ok: false, status: 503 });

289+

const mockFetch = vi.fn().mockResolvedValue(new Response("", { status: 503 }));

287290288291

await withFetchPathTest(mockFetch, { DEEPINFRA_API_KEY: "sk-test" }, async () => {

289292

const models = await discoverDeepInfraModels();

@@ -294,14 +297,10 @@ describe("discoverDeepInfraModels (chat-only shim)", () => {

294297

it("falls back without caching malformed successful model list payloads", async () => {

295298

const mockFetch = vi

296299

.fn()

297-

.mockResolvedValueOnce({

298-

ok: true,

299-

json: () => Promise.resolve({ data: {} }),

300-

})

301-

.mockResolvedValueOnce({

302-

ok: true,

303-

json: () => Promise.resolve({ data: [makeAgentModelEntry({ id: "recovered/model" })] }),

304-

});

300+

.mockResolvedValueOnce(jsonResponse({ data: {} }))

301+

.mockResolvedValueOnce(

302+

jsonResponse({ data: [makeAgentModelEntry({ id: "recovered/model" })] }),

303+

);

305304306305

await withFetchPathTest(mockFetch, { DEEPINFRA_API_KEY: "sk-test" }, async () => {

307306

expect((await discoverDeepInfraModels()).map((m) => m.id)).toEqual(

@@ -328,14 +327,8 @@ describe("discoverDeepInfraModels (chat-only shim)", () => {

328327

it("caches successful discovery responses only", async () => {

329328

const mockFetch = vi

330329

.fn()

331-

.mockResolvedValueOnce({

332-

ok: true,

333-

json: () => Promise.resolve({ data: [makeAgentModelEntry({ id: "first/model" })] }),

334-

})

335-

.mockResolvedValueOnce({

336-

ok: true,

337-

json: () => Promise.resolve({ data: [makeAgentModelEntry({ id: "second/model" })] }),

338-

});

330+

.mockResolvedValueOnce(jsonResponse({ data: [makeAgentModelEntry({ id: "first/model" })] }))

331+

.mockResolvedValueOnce(jsonResponse({ data: [makeAgentModelEntry({ id: "second/model" })] }));

339332340333

await withFetchPathTest(mockFetch, { DEEPINFRA_API_KEY: "sk-test" }, async () => {

341334

const expectedIds = expectedLiveChatCatalog([

@@ -359,14 +352,10 @@ describe("discoverDeepInfraModels (chat-only shim)", () => {

359352

it("does not cache successful responses that produce no live catalog rows", async () => {

360353

const mockFetch = vi

361354

.fn()

362-

.mockResolvedValueOnce({

363-

ok: true,

364-

json: () => Promise.resolve({ data: [] }),

365-

})

366-

.mockResolvedValueOnce({

367-

ok: true,

368-

json: () => Promise.resolve({ data: [makeAgentModelEntry({ id: "recovered/model" })] }),

369-

});

355+

.mockResolvedValueOnce(jsonResponse({ data: [] }))

356+

.mockResolvedValueOnce(

357+

jsonResponse({ data: [makeAgentModelEntry({ id: "recovered/model" })] }),

358+

);

370359371360

await withFetchPathTest(mockFetch, { DEEPINFRA_API_KEY: "sk-test" }, async () => {

372361

expect((await discoverDeepInfraModels()).map((m) => m.id)).toEqual(

@@ -393,67 +382,65 @@ describe("discoverDeepInfraModels (chat-only shim)", () => {

393382394383

describe("discoverDeepInfraSurfaces (per-surface bucketing)", () => {

395384

it("buckets dynamic entries by short-alias surface tag", async () => {

396-

const mockFetch = vi.fn().mockResolvedValue({

397-

ok: true,

398-

json: () =>

399-

Promise.resolve({

400-

data: [

401-

makeAgentModelEntry({

402-

id: "anthropic/claude-sonnet-4-6",

403-

metadata: {

404-

description: "claude sonnet 4.6",

405-

context_length: 200000,

406-

max_tokens: 8192,

407-

pricing: { input_tokens: 3, output_tokens: 15 },

408-

tags: ["chat", "vlm", "vision", "prompt_cache"],

409-

},

410-

}),

411-

makeAgentModelEntry({

412-

id: "BAAI/bge-m3",

413-

metadata: {

414-

description: "bge-m3",

415-

pricing: { input_tokens: 0.01 },

416-

tags: ["embed"],

417-

},

418-

}),

419-

makeAgentModelEntry({

420-

id: "black-forest-labs/FLUX-1-schnell",

421-

metadata: {

422-

description: "FLUX schnell",

423-

pricing: { per_image_unit: 0.003 },

424-

tags: ["image-gen"],

425-

default_width: 1024,

426-

default_height: 1024,

427-

default_iterations: 4,

428-

},

429-

}),

430-

makeAgentModelEntry({

431-

id: "Wan-AI/Wan2.6-T2V",

432-

metadata: {

433-

description: "Wan T2V",

434-

pricing: { output_seconds: 0.05 },

435-

tags: ["video-gen"],

436-

},

437-

}),

438-

makeAgentModelEntry({

439-

id: "Qwen/Qwen3-TTS",

440-

metadata: {

441-

description: "Qwen3 TTS",

442-

pricing: { input_characters: 0.65 },

443-

tags: ["tts"],

444-

},

445-

}),

446-

makeAgentModelEntry({

447-

id: "openai/whisper-large-v3-turbo",

448-

metadata: {

449-

description: "whisper",

450-

pricing: { input_seconds: 0.00004 },

451-

tags: ["stt"],

452-

},

453-

}),

454-

],

455-

}),

456-

});

385+

const mockFetch = vi.fn().mockResolvedValue(

386+

jsonResponse({

387+

data: [

388+

makeAgentModelEntry({

389+

id: "anthropic/claude-sonnet-4-6",

390+

metadata: {

391+

description: "claude sonnet 4.6",

392+

context_length: 200000,

393+

max_tokens: 8192,

394+

pricing: { input_tokens: 3, output_tokens: 15 },

395+

tags: ["chat", "vlm", "vision", "prompt_cache"],

396+

},

397+

}),

398+

makeAgentModelEntry({

399+

id: "BAAI/bge-m3",

400+

metadata: {

401+

description: "bge-m3",

402+

pricing: { input_tokens: 0.01 },

403+

tags: ["embed"],

404+

},

405+

}),

406+

makeAgentModelEntry({

407+

id: "black-forest-labs/FLUX-1-schnell",

408+

metadata: {

409+

description: "FLUX schnell",

410+

pricing: { per_image_unit: 0.003 },

411+

tags: ["image-gen"],

412+

default_width: 1024,

413+

default_height: 1024,

414+

default_iterations: 4,

415+

},

416+

}),

417+

makeAgentModelEntry({

418+

id: "Wan-AI/Wan2.6-T2V",

419+

metadata: {

420+

description: "Wan T2V",

421+

pricing: { output_seconds: 0.05 },

422+

tags: ["video-gen"],

423+

},

424+

}),

425+

makeAgentModelEntry({

426+

id: "Qwen/Qwen3-TTS",

427+

metadata: {

428+

description: "Qwen3 TTS",

429+

pricing: { input_characters: 0.65 },

430+

tags: ["tts"],

431+

},

432+

}),

433+

makeAgentModelEntry({

434+

id: "openai/whisper-large-v3-turbo",

435+

metadata: {

436+

description: "whisper",

437+

pricing: { input_seconds: 0.00004 },

438+

tags: ["stt"],

439+

},

440+

}),

441+

],

442+

}),

443+

);

457444458445

await withFetchPathTest(mockFetch, { DEEPINFRA_API_KEY: "sk-test" }, async () => {

459446

const catalog = await discoverDeepInfraSurfaces();

@@ -471,35 +458,33 @@ describe("discoverDeepInfraSurfaces (per-surface bucketing)", () => {

471458

});

472459473460

it("drops malformed live numeric metadata", async () => {

474-

const mockFetch = vi.fn().mockResolvedValue({

475-

ok: true,

476-

json: () =>

477-

Promise.resolve({

478-

data: [

479-

makeAgentModelEntry({

480-

id: "bad/chat",

481-

metadata: {

482-

description: "bad chat",

483-

context_length: -1,

484-

max_tokens: 1.5,

485-

pricing: { input_tokens: 3, output_tokens: 15 },

486-

tags: ["chat"],

487-

},

488-

}),

489-

makeAgentModelEntry({

490-

id: "bad/image",

491-

metadata: {

492-

description: "bad image",

493-

pricing: { per_image_unit: 0.003 },

494-

tags: ["image-gen"],

495-

default_width: Number.POSITIVE_INFINITY,

496-

default_height: 1024.5,

497-

default_iterations: 0,

498-

},

499-

}),

500-

],

501-

}),

502-

});

461+

const mockFetch = vi.fn().mockResolvedValue(

462+

jsonResponse({

463+

data: [

464+

makeAgentModelEntry({

465+

id: "bad/chat",

466+

metadata: {

467+

description: "bad chat",

468+

context_length: -1,

469+

max_tokens: 1.5,

470+

pricing: { input_tokens: 3, output_tokens: 15 },

471+

tags: ["chat"],

472+

},

473+

}),

474+

makeAgentModelEntry({

475+

id: "bad/image",

476+

metadata: {

477+

description: "bad image",

478+

pricing: { per_image_unit: 0.003 },

479+

tags: ["image-gen"],

480+

default_width: Number.POSITIVE_INFINITY,

481+

default_height: 1024.5,

482+

default_iterations: 0,

483+

},

484+

}),

485+

],

486+

}),

487+

);

503488504489

await withFetchPathTest(mockFetch, { DEEPINFRA_API_KEY: "sk-test" }, async () => {

505490

const catalog = await discoverDeepInfraSurfaces();