Vendor OpenClaw source as Adolf fork baseline
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
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
This commit is contained in:
251
extensions/nvidia/provider-catalog.ts
Normal file
251
extensions/nvidia/provider-catalog.ts
Normal file
@@ -0,0 +1,251 @@
|
||||
// Nvidia provider module implements model/runtime integration.
|
||||
import { lookup as dnsLookup } from "node:dns/promises";
|
||||
import {
|
||||
clearLiveCatalogCacheForTests,
|
||||
getCachedLiveProviderModelRows,
|
||||
} from "openclaw/plugin-sdk/provider-catalog-live-runtime";
|
||||
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
|
||||
import type {
|
||||
ModelDefinitionConfig,
|
||||
ModelProviderConfig,
|
||||
} from "openclaw/plugin-sdk/provider-model-shared";
|
||||
import {
|
||||
type LookupFn,
|
||||
ssrfPolicyFromHttpBaseUrlAllowedHostname,
|
||||
} from "openclaw/plugin-sdk/ssrf-runtime";
|
||||
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
||||
import manifest from "./openclaw.plugin.json" with { type: "json" };
|
||||
|
||||
export const NVIDIA_DEFAULT_MODEL_ID = "nvidia/nemotron-3-ultra-550b-a55b";
|
||||
export const NVIDIA_FEATURED_MODELS_URL =
|
||||
"https://assets.ngc.nvidia.com/products/api-catalog/featured-models.json";
|
||||
|
||||
const FEATURED_MODEL_CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
||||
const FEATURED_MODEL_FETCH_TIMEOUT_MS = 10_000;
|
||||
const FEATURED_MODEL_MAX_ROWS = 32;
|
||||
const FEATURED_MODEL_MAX_ID_LENGTH = 200;
|
||||
const FEATURED_MODEL_MAX_NAME_LENGTH = 200;
|
||||
const FEATURED_MODEL_MAX_CONTEXT_WINDOW = 10_000_000;
|
||||
const FEATURED_MODEL_MAX_OUTPUT_TOKENS = 1_000_000;
|
||||
const FEATURED_MODEL_COST = {
|
||||
input: 0,
|
||||
output: 0,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
} as const;
|
||||
const NVIDIA_ULTRA_DEFAULT_PARAMS = {
|
||||
chat_template_kwargs: {
|
||||
enable_thinking: false,
|
||||
force_nonempty_content: true,
|
||||
},
|
||||
} as const;
|
||||
|
||||
type NvidiaFeaturedModel = {
|
||||
model: string;
|
||||
"model-name": string;
|
||||
context: number;
|
||||
"max-output": number;
|
||||
};
|
||||
|
||||
type DnsLookupOptions = {
|
||||
all?: boolean;
|
||||
family?: number;
|
||||
hints?: number;
|
||||
order?: "ipv4first" | "ipv6first" | "verbatim";
|
||||
verbatim?: boolean;
|
||||
};
|
||||
|
||||
const lookupNvidiaFeaturedModelHostname = (async (
|
||||
hostname: string,
|
||||
options?: number | DnsLookupOptions,
|
||||
) => {
|
||||
if (typeof options === "object" && options !== null) {
|
||||
return await dnsLookup(hostname, { ...options, family: 4 });
|
||||
}
|
||||
return await dnsLookup(hostname, { family: 4 });
|
||||
}) as LookupFn;
|
||||
|
||||
export function buildNvidiaProvider(): ModelProviderConfig {
|
||||
const provider = {
|
||||
...buildManifestModelProviderConfig({
|
||||
providerId: "nvidia",
|
||||
catalog: manifest.modelCatalog.providers.nvidia,
|
||||
}),
|
||||
apiKey: "NVIDIA_API_KEY",
|
||||
};
|
||||
return {
|
||||
...provider,
|
||||
models: applyNvidiaModelDefaults(provider.models ?? []),
|
||||
};
|
||||
}
|
||||
|
||||
export async function buildLiveNvidiaProvider(): Promise<ModelProviderConfig> {
|
||||
const provider = buildNvidiaProvider();
|
||||
const featuredModels = await loadNvidiaFeaturedModels();
|
||||
if (!featuredModels || featuredModels.length === 0) {
|
||||
return provider;
|
||||
}
|
||||
return {
|
||||
...provider,
|
||||
models: applyNvidiaModelDefaults(featuredModels),
|
||||
};
|
||||
}
|
||||
|
||||
export async function buildSelectableLiveNvidiaProvider(): Promise<ModelProviderConfig> {
|
||||
const provider = buildNvidiaProvider();
|
||||
const featuredModels = await loadNvidiaFeaturedModels();
|
||||
if (!featuredModels || featuredModels.length === 0) {
|
||||
return {
|
||||
...provider,
|
||||
models: [],
|
||||
};
|
||||
}
|
||||
return {
|
||||
...provider,
|
||||
models: applyNvidiaModelDefaults(featuredModels),
|
||||
};
|
||||
}
|
||||
|
||||
export function clearNvidiaFeaturedModelCacheForTests() {
|
||||
clearLiveCatalogCacheForTests();
|
||||
}
|
||||
|
||||
async function loadNvidiaFeaturedModels(): Promise<ModelDefinitionConfig[] | null> {
|
||||
try {
|
||||
const rows = await getCachedLiveProviderModelRows({
|
||||
providerId: "nvidia",
|
||||
endpoint: NVIDIA_FEATURED_MODELS_URL,
|
||||
timeoutMs: FEATURED_MODEL_FETCH_TIMEOUT_MS,
|
||||
ttlMs: FEATURED_MODEL_CACHE_TTL_MS,
|
||||
requireHttps: true,
|
||||
policy: ssrfPolicyFromHttpBaseUrlAllowedHostname(NVIDIA_FEATURED_MODELS_URL),
|
||||
// The featured catalog is an NVIDIA-owned CloudFront URL. Some resolvers
|
||||
// stall for seconds on the default all-family lookup; IPv4 pinning keeps
|
||||
// the guarded fixed-host fetch on the fast path.
|
||||
lookupFn: lookupNvidiaFeaturedModelHostname,
|
||||
auditContext: "nvidia-featured-model-catalog",
|
||||
shouldCacheRows: (modelRows) => parseNvidiaFeaturedModels(modelRows) !== null,
|
||||
readRows: (payload) => {
|
||||
if (!payload || typeof payload !== "object") {
|
||||
return [];
|
||||
}
|
||||
const featuredRows = (payload as { "featured-models"?: unknown })["featured-models"];
|
||||
return Array.isArray(featuredRows) ? featuredRows : [];
|
||||
},
|
||||
});
|
||||
return parseNvidiaFeaturedModels(rows);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function parseNvidiaFeaturedModels(rows: readonly unknown[]): ModelDefinitionConfig[] | null {
|
||||
const models = rows
|
||||
.slice(0, FEATURED_MODEL_MAX_ROWS)
|
||||
.map(parseNvidiaFeaturedModel)
|
||||
.filter((model) => model !== null);
|
||||
return models.length > 0 ? models : null;
|
||||
}
|
||||
|
||||
function applyNvidiaModelDefaults(models: ModelDefinitionConfig[]): ModelDefinitionConfig[] {
|
||||
return models.map((model) =>
|
||||
model.id === NVIDIA_DEFAULT_MODEL_ID
|
||||
? {
|
||||
...model,
|
||||
params: {
|
||||
...model.params,
|
||||
chat_template_kwargs: {
|
||||
...NVIDIA_ULTRA_DEFAULT_PARAMS.chat_template_kwargs,
|
||||
...(isRecord(model.params?.chat_template_kwargs)
|
||||
? model.params.chat_template_kwargs
|
||||
: {}),
|
||||
},
|
||||
},
|
||||
}
|
||||
: model,
|
||||
);
|
||||
}
|
||||
|
||||
function parseNvidiaFeaturedModel(row: unknown): ModelDefinitionConfig | null {
|
||||
if (!row || typeof row !== "object") {
|
||||
return null;
|
||||
}
|
||||
const entry = row as Partial<NvidiaFeaturedModel>;
|
||||
if (
|
||||
typeof entry.model !== "string" ||
|
||||
typeof entry["model-name"] !== "string" ||
|
||||
!isBoundedPositiveInteger(entry.context, FEATURED_MODEL_MAX_CONTEXT_WINDOW) ||
|
||||
!isBoundedPositiveInteger(entry["max-output"], FEATURED_MODEL_MAX_OUTPUT_TOKENS)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
const id = normalizeNvidiaFeaturedModelId(entry.model);
|
||||
const name = normalizeFeaturedModelName(entry["model-name"]);
|
||||
if (!id || !name) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
reasoning: false,
|
||||
input: ["text"],
|
||||
contextWindow: entry.context,
|
||||
maxTokens: entry["max-output"],
|
||||
cost: { ...FEATURED_MODEL_COST },
|
||||
compat: {
|
||||
requiresStringContent: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeNvidiaFeaturedModelId(model: string): string {
|
||||
const trimmed = model.trim();
|
||||
if (
|
||||
!trimmed ||
|
||||
trimmed.length > FEATURED_MODEL_MAX_ID_LENGTH ||
|
||||
hasWhitespaceOrControlCharacter(trimmed)
|
||||
) {
|
||||
return "";
|
||||
}
|
||||
return trimmed.includes("/") ? trimmed : `nvidia/${trimmed}`;
|
||||
}
|
||||
|
||||
function normalizeFeaturedModelName(name: string): string {
|
||||
const trimmed = name.trim();
|
||||
if (!trimmed || trimmed.length > FEATURED_MODEL_MAX_NAME_LENGTH || hasControlCharacter(trimmed)) {
|
||||
return "";
|
||||
}
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
function isBoundedPositiveInteger(value: unknown, max: number): value is number {
|
||||
return typeof value === "number" && Number.isInteger(value) && value > 0 && value <= max;
|
||||
}
|
||||
|
||||
function hasWhitespaceOrControlCharacter(value: string): boolean {
|
||||
for (const char of value) {
|
||||
if (isAsciiWhitespaceOrControlCharacter(char)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasControlCharacter(value: string): boolean {
|
||||
for (const char of value) {
|
||||
if (isControlCharacter(char)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isControlCharacter(char: string): boolean {
|
||||
const code = char.charCodeAt(0);
|
||||
return code <= 31 || code === 127;
|
||||
}
|
||||
|
||||
function isAsciiWhitespaceOrControlCharacter(char: string): boolean {
|
||||
const code = char.charCodeAt(0);
|
||||
return code <= 32 || code === 127;
|
||||
}
|
||||
Reference in New Issue
Block a user