Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
326 lines
9.4 KiB
TypeScript
326 lines
9.4 KiB
TypeScript
// Nvidia tests cover provider catalog plugin behavior.
|
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import {
|
|
buildLiveNvidiaProvider,
|
|
buildNvidiaProvider,
|
|
buildSelectableLiveNvidiaProvider,
|
|
clearNvidiaFeaturedModelCacheForTests,
|
|
NVIDIA_FEATURED_MODELS_URL,
|
|
} from "./provider-catalog.js";
|
|
|
|
const ssrfRuntimeMocks = vi.hoisted(() => ({
|
|
fetchWithSsrFGuard: vi.fn(),
|
|
ssrfPolicyFromHttpBaseUrlAllowedHostname: vi.fn((baseUrl: string) => ({
|
|
allowedHostnames: [new URL(baseUrl).hostname],
|
|
})),
|
|
}));
|
|
|
|
vi.mock("openclaw/plugin-sdk/ssrf-runtime", () => ssrfRuntimeMocks);
|
|
|
|
afterEach(() => {
|
|
vi.useRealTimers();
|
|
clearNvidiaFeaturedModelCacheForTests();
|
|
ssrfRuntimeMocks.fetchWithSsrFGuard.mockReset();
|
|
ssrfRuntimeMocks.ssrfPolicyFromHttpBaseUrlAllowedHostname.mockClear();
|
|
});
|
|
|
|
function mockFeaturedCatalogResponse(payload: unknown, status = 200) {
|
|
const release = vi.fn();
|
|
ssrfRuntimeMocks.fetchWithSsrFGuard.mockResolvedValueOnce({
|
|
response: Response.json(payload, { status }),
|
|
finalUrl: NVIDIA_FEATURED_MODELS_URL,
|
|
release,
|
|
});
|
|
return release;
|
|
}
|
|
|
|
describe("nvidia provider catalog", () => {
|
|
it("builds the bundled NVIDIA provider defaults", () => {
|
|
const provider = buildNvidiaProvider();
|
|
|
|
expect(provider.baseUrl).toBe("https://integrate.api.nvidia.com/v1");
|
|
expect(provider.api).toBe("openai-completions");
|
|
expect(provider.apiKey).toBe("NVIDIA_API_KEY");
|
|
expect(provider.models.map((model) => model.id)).toEqual([
|
|
"nvidia/nemotron-3-ultra-550b-a55b",
|
|
"nvidia/nemotron-3-super-120b-a12b",
|
|
"moonshotai/kimi-k2.5",
|
|
"minimaxai/minimax-m2.7",
|
|
"z-ai/glm-5.1",
|
|
"minimaxai/minimax-m2.5",
|
|
"z-ai/glm5",
|
|
]);
|
|
expect(provider.models.filter((model) => model.compat?.requiresStringContent !== true)).toEqual(
|
|
[],
|
|
);
|
|
expect(provider.models[0]).toMatchObject({
|
|
contextWindow: 1_000_000,
|
|
maxTokens: 16_384,
|
|
params: {
|
|
chat_template_kwargs: {
|
|
enable_thinking: false,
|
|
force_nonempty_content: true,
|
|
},
|
|
},
|
|
});
|
|
expect(provider.models[1]).toMatchObject({
|
|
id: "nvidia/nemotron-3-super-120b-a12b",
|
|
contextWindow: 1_048_576,
|
|
});
|
|
});
|
|
|
|
it("promotes ranked models from NVIDIA's featured catalog", async () => {
|
|
const release = mockFeaturedCatalogResponse({
|
|
"featured-models": [
|
|
{
|
|
model: "z-ai/glm-5.1",
|
|
"model-name": "GLM 5.1",
|
|
context: 202752,
|
|
"max-output": 8192,
|
|
},
|
|
{
|
|
model: "nemotron-3-super-120b-a12b",
|
|
"model-name": "Nemotron 3 Super 120B",
|
|
context: 262144,
|
|
"max-output": 8192,
|
|
},
|
|
],
|
|
});
|
|
|
|
const provider = await buildLiveNvidiaProvider();
|
|
|
|
expect(provider.models.map((model) => model.id)).toEqual([
|
|
"z-ai/glm-5.1",
|
|
"nvidia/nemotron-3-super-120b-a12b",
|
|
]);
|
|
expect(provider.models[0]).toMatchObject({
|
|
name: "GLM 5.1",
|
|
contextWindow: 202752,
|
|
maxTokens: 8192,
|
|
compat: { requiresStringContent: true },
|
|
});
|
|
expect(ssrfRuntimeMocks.fetchWithSsrFGuard).toHaveBeenCalledWith({
|
|
auditContext: "nvidia-featured-model-catalog",
|
|
init: { headers: expect.any(Headers) },
|
|
lookupFn: expect.any(Function),
|
|
policy: { allowedHostnames: ["assets.ngc.nvidia.com"] },
|
|
signal: undefined,
|
|
timeoutMs: 10_000,
|
|
url: NVIDIA_FEATURED_MODELS_URL,
|
|
requireHttps: true,
|
|
});
|
|
expect(release).toHaveBeenCalledOnce();
|
|
});
|
|
|
|
it("falls back to the bundled catalog when the featured catalog is unavailable", async () => {
|
|
mockFeaturedCatalogResponse({ error: "unavailable" }, 503);
|
|
|
|
const provider = await buildLiveNvidiaProvider();
|
|
|
|
expect(provider.models.map((model) => model.id)).toEqual([
|
|
"nvidia/nemotron-3-ultra-550b-a55b",
|
|
"nvidia/nemotron-3-super-120b-a12b",
|
|
"moonshotai/kimi-k2.5",
|
|
"minimaxai/minimax-m2.7",
|
|
"z-ai/glm-5.1",
|
|
"minimaxai/minimax-m2.5",
|
|
"z-ai/glm5",
|
|
]);
|
|
});
|
|
|
|
it("retains shipped NVIDIA model refs as bundled fallback compatibility rows", () => {
|
|
const provider = buildNvidiaProvider();
|
|
|
|
expect(provider.models.map((model) => model.id)).toEqual(
|
|
expect.arrayContaining(["minimaxai/minimax-m2.5", "z-ai/glm5"]),
|
|
);
|
|
});
|
|
|
|
it("uses only selectable live catalog rows when the featured catalog returns models", async () => {
|
|
mockFeaturedCatalogResponse({
|
|
"featured-models": [
|
|
{
|
|
model: "z-ai/glm-5.1",
|
|
"model-name": "GLM 5.1",
|
|
context: 202752,
|
|
"max-output": 8192,
|
|
},
|
|
{
|
|
model: "nemotron-3-super-120b-a12b",
|
|
"model-name": "Nemotron 3 Super 120B",
|
|
context: 262144,
|
|
"max-output": 8192,
|
|
},
|
|
],
|
|
});
|
|
|
|
const provider = await buildSelectableLiveNvidiaProvider();
|
|
|
|
expect(provider.models.map((model) => model.id)).toEqual([
|
|
"z-ai/glm-5.1",
|
|
"nvidia/nemotron-3-super-120b-a12b",
|
|
]);
|
|
});
|
|
|
|
it("returns no selectable live rows when the featured catalog is unavailable", async () => {
|
|
mockFeaturedCatalogResponse({ error: "unavailable" }, 503);
|
|
|
|
const provider = await buildSelectableLiveNvidiaProvider();
|
|
|
|
expect(provider.models.map((model) => model.id)).toEqual([]);
|
|
});
|
|
|
|
it("ignores malformed featured catalog rows and keeps valid entries", async () => {
|
|
mockFeaturedCatalogResponse({
|
|
"featured-models": [
|
|
{
|
|
model: "bad model id",
|
|
"model-name": "Bad",
|
|
context: 1000,
|
|
"max-output": 1000,
|
|
},
|
|
{
|
|
model: "minimaxai/minimax-m2.7",
|
|
"model-name": "Minimax M2.7",
|
|
context: 196608,
|
|
"max-output": 8192,
|
|
},
|
|
{
|
|
model: "oversized-context",
|
|
"model-name": "Oversized Context",
|
|
context: 10_000_001,
|
|
"max-output": 8192,
|
|
},
|
|
],
|
|
});
|
|
|
|
const provider = await buildLiveNvidiaProvider();
|
|
|
|
expect(provider.models.map((model) => model.id)).toEqual(["minimaxai/minimax-m2.7"]);
|
|
});
|
|
|
|
it("caches the featured catalog for repeated provider builds", async () => {
|
|
mockFeaturedCatalogResponse({
|
|
"featured-models": [
|
|
{
|
|
model: "minimaxai/minimax-m2.7",
|
|
"model-name": "Minimax M2.7",
|
|
context: 196608,
|
|
"max-output": 8192,
|
|
},
|
|
],
|
|
});
|
|
|
|
await buildLiveNvidiaProvider();
|
|
await buildLiveNvidiaProvider();
|
|
|
|
expect(ssrfRuntimeMocks.fetchWithSsrFGuard).toHaveBeenCalledOnce();
|
|
});
|
|
|
|
it("skips featured catalog cache when ttl expiry overflows", async () => {
|
|
vi.setSystemTime(new Date(8_640_000_000_000_000));
|
|
mockFeaturedCatalogResponse({
|
|
"featured-models": [
|
|
{
|
|
model: "minimaxai/minimax-m2.7",
|
|
"model-name": "Minimax M2.7",
|
|
context: 196608,
|
|
"max-output": 8192,
|
|
},
|
|
],
|
|
});
|
|
mockFeaturedCatalogResponse({
|
|
"featured-models": [
|
|
{
|
|
model: "z-ai/glm-5.1",
|
|
"model-name": "GLM 5.1",
|
|
context: 202752,
|
|
"max-output": 8192,
|
|
},
|
|
],
|
|
});
|
|
|
|
const first = await buildLiveNvidiaProvider();
|
|
const second = await buildLiveNvidiaProvider();
|
|
|
|
expect(first.models.map((model) => model.id)).toEqual(["minimaxai/minimax-m2.7"]);
|
|
expect(second.models.map((model) => model.id)).toEqual(["z-ai/glm-5.1"]);
|
|
expect(ssrfRuntimeMocks.fetchWithSsrFGuard).toHaveBeenCalledTimes(2);
|
|
});
|
|
|
|
it("does not cache successful featured catalog responses with no usable rows", async () => {
|
|
mockFeaturedCatalogResponse({
|
|
"featured-models": [
|
|
{
|
|
model: "bad model id",
|
|
"model-name": "Bad",
|
|
context: 1000,
|
|
"max-output": 1000,
|
|
},
|
|
],
|
|
});
|
|
mockFeaturedCatalogResponse({
|
|
"featured-models": [
|
|
{
|
|
model: "z-ai/glm-5.1",
|
|
"model-name": "GLM 5.1",
|
|
context: 202752,
|
|
"max-output": 8192,
|
|
},
|
|
],
|
|
});
|
|
|
|
const first = await buildLiveNvidiaProvider();
|
|
const second = await buildLiveNvidiaProvider();
|
|
|
|
expect(first.models.map((model) => model.id)).toEqual([
|
|
"nvidia/nemotron-3-ultra-550b-a55b",
|
|
"nvidia/nemotron-3-super-120b-a12b",
|
|
"moonshotai/kimi-k2.5",
|
|
"minimaxai/minimax-m2.7",
|
|
"z-ai/glm-5.1",
|
|
"minimaxai/minimax-m2.5",
|
|
"z-ai/glm5",
|
|
]);
|
|
expect(second.models.map((model) => model.id)).toEqual(["z-ai/glm-5.1"]);
|
|
expect(ssrfRuntimeMocks.fetchWithSsrFGuard).toHaveBeenCalledTimes(2);
|
|
});
|
|
|
|
it("applies bundled Ultra defaults when featured catalog returns Ultra", async () => {
|
|
mockFeaturedCatalogResponse({
|
|
"featured-models": [
|
|
{
|
|
model: "nemotron-3-ultra-550b-a55b",
|
|
"model-name": "Nemotron 3 Ultra 550B",
|
|
context: 1000000,
|
|
"max-output": 16384,
|
|
},
|
|
{
|
|
model: "minimaxai/minimax-m2.7",
|
|
"model-name": "Minimax M2.7",
|
|
context: 196608,
|
|
"max-output": 8192,
|
|
},
|
|
],
|
|
});
|
|
|
|
const provider = await buildLiveNvidiaProvider();
|
|
|
|
expect(provider.models.map((model) => model.id)).toEqual([
|
|
"nvidia/nemotron-3-ultra-550b-a55b",
|
|
"minimaxai/minimax-m2.7",
|
|
]);
|
|
expect(provider.models[0]).toMatchObject({
|
|
name: "Nemotron 3 Ultra 550B",
|
|
contextWindow: 1_000_000,
|
|
maxTokens: 16_384,
|
|
params: {
|
|
chat_template_kwargs: {
|
|
enable_thinking: false,
|
|
force_nonempty_content: true,
|
|
},
|
|
},
|
|
});
|
|
});
|
|
});
|