LeoYeAI/agent-master-skills / skills/api-key-ui-tab
apikeys-ui
VerifiedVault-backed API Keys management for OpenClaw. Secure file-based secret storage with one-click migration from plaintext config, dynamic key discovery, vault key selector for skills, manual secret creation, and plugin-registered settings tab.
| File | Kind | Size |
|---|---|---|
| INSTALL_INSTRUCTIONS.md | markdown | 928 B |
| SKILL.md | skill md | 16.3 KB |
| _meta.json | config | 479 B |
| reference/apikeys-controller.ts | script | 19.1 KB |
| reference/apikeys-views.ts | script | 16.1 KB |
| reference/secrets-rpc.ts | script | 16.0 KB |
| reference/skills-controller.ts | script | 5.7 KB |
| reference/skills-rpc.ts | script | 6.7 KB |
| reference/skills-status.ts | script | 8.9 KB |
| reference/skills-views.ts | script | 9.5 KB |
reference/skills-status.ts
View on GitHubimport fs from "node:fs";
import path from "node:path";
function extractVaultKeyId(apiKey: unknown): string | undefined {
if (apiKey && typeof apiKey === "object" && "source" in apiKey && "id" in apiKey) {
const ref = apiKey as { source: string; id: string };
if (ref.source === "file" && ref.id) {
return ref.id.startsWith("/") ? ref.id.slice(1) : ref.id;
}
}
return undefined;
}
let _rawConfigCache: Record<string, unknown> | null = null;
let _rawConfigMtime = 0;
function extractVaultKeyIdFromConfig(skillKey: string): string | undefined {
// Read the raw JSON to get the unresolved SecretRef (runtime resolves them to strings)
const configPath = path.join(CONFIG_DIR, "openclaw.json");
try {
const stat = fs.statSync(configPath);
if (!_rawConfigCache || stat.mtimeMs !== _rawConfigMtime) {
_rawConfigCache = JSON.parse(fs.readFileSync(configPath, "utf8")) as Record<string, unknown>;
_rawConfigMtime = stat.mtimeMs;
}
const skills = (_rawConfigCache?.skills as Record<string, unknown>)?.entries as Record<string, Record<string, unknown>> | undefined;
const entry = skills?.[skillKey];
return extractVaultKeyId(entry?.apiKey);
} catch {
return undefined;
}
}
import type { OpenClawConfig } from "../config/config.js";
import { evaluateEntryRequirementsForCurrentPlatform } from "../shared/entry-status.js";
import type { RequirementConfigCheck, Requirements } from "../shared/requirements.js";
import { CONFIG_DIR } from "../utils.js";
import {
hasBinary,
isBundledSkillAllowed,
isConfigPathTruthy,
loadWorkspaceSkillEntries,
resolveBundledAllowlist,
resolveSkillConfig,
resolveSkillsInstallPreferences,
type SkillEntry,
type SkillEligibilityContext,
type SkillInstallSpec,
type SkillsInstallPreferences,
} from "./skills.js";
import { resolveBundledSkillsContext } from "./skills/bundled-context.js";
export type SkillStatusConfigCheck = RequirementConfigCheck;
export type SkillInstallOption = {
id: string;
kind: SkillInstallSpec["kind"];
label: string;
bins: string[];
};
export type SkillStatusEntry = {
name: string;
description: string;
source: string;
bundled: boolean;
filePath: string;
baseDir: string;
skillKey: string;
primaryEnv?: string;
vaultKeyId?: string;
emoji?: string;
homepage?: string;
always: boolean;
disabled: boolean;
blockedByAllowlist: boolean;
eligible: boolean;
requirements: Requirements;
missing: Requirements;
configChecks: SkillStatusConfigCheck[];
install: SkillInstallOption[];
};
export type SkillStatusReport = {
workspaceDir: string;
managedSkillsDir: string;
skills: SkillStatusEntry[];
};
function resolveSkillKey(entry: SkillEntry): string {
return entry.metadata?.skillKey ?? entry.skill.name;
}
function selectPreferredInstallSpec(
install: SkillInstallSpec[],
prefs: SkillsInstallPreferences,
): { spec: SkillInstallSpec; index: number } | undefined {
if (install.length === 0) {
return undefined;
}
const indexed = install.map((spec, index) => ({ spec, index }));
const findKind = (kind: SkillInstallSpec["kind"]) =>
indexed.find((item) => item.spec.kind === kind);
const brewSpec = findKind("brew");
const nodeSpec = findKind("node");
const goSpec = findKind("go");
const uvSpec = findKind("uv");
const downloadSpec = findKind("download");
const brewAvailable = hasBinary("brew");
// Table-driven preference chain; first match wins.
const pickers: Array<() => { spec: SkillInstallSpec; index: number } | undefined> = [
() => (prefs.preferBrew && brewAvailable ? brewSpec : undefined),
() => uvSpec,
() => nodeSpec,
// Only prefer brew when available to avoid guaranteed failure on Linux/Docker.
() => (brewAvailable ? brewSpec : undefined),
() => goSpec,
// Prefer download over an unavailable brew spec.
() => downloadSpec,
// Last resort: surface descriptive brew-missing error instead of "no installer found".
() => brewSpec,
() => indexed[0],
];
for (const pick of pickers) {
const selected = pick();
if (selected) {
return selected;
}
}
return undefined;
}
function normalizeInstallOptions(
entry: SkillEntry,
prefs: SkillsInstallPreferences,
): SkillInstallOption[] {
// If the skill is explicitly OS-scoped, don't surface install actions on unsupported platforms.
// (Installers run locally; remote OS eligibility is handled separately.)
const requiredOs = entry.metadata?.os ?? [];
if (requiredOs.length > 0 && !requiredOs.includes(process.platform)) {
return [];
}
const install = entry.metadata?.install ?? [];
if (install.length === 0) {
return [];
}
const platform = process.platform;
const filtered = install.filter((spec) => {
const osList = spec.os ?? [];
return osList.length === 0 || osList.includes(platform);
});
if (filtered.length === 0) {
return [];
}
const toOption = (spec: SkillInstallSpec, index: number): SkillInstallOption => {
const id = (spec.id ?? `${spec.kind}-${index}`).trim();
const bins = spec.bins ?? [];
let label = (spec.label ?? "").trim();
if (spec.kind === "node" && spec.package) {
label = `Install ${spec.package} (${prefs.nodeManager})`;
}
if (!label) {
if (spec.kind === "brew" && spec.formula) {
label = `Install ${spec.formula} (brew)`;
} else if (spec.kind === "node" && spec.package) {
label = `Install ${spec.package} (${prefs.nodeManager})`;
} else if (spec.kind === "go" && spec.module) {
label = `Install ${spec.module} (go)`;
} else if (spec.kind === "uv" && spec.package) {
label = `Install ${spec.package} (uv)`;
} else if (spec.kind === "download" && spec.url) {
const url = spec.url.trim();
const last = url.split("/").pop();
label = `Download ${last && last.length > 0 ? last : url}`;
} else {
label = "Run installer";
}
}
return { id, kind: spec.kind, label, bins };
};
const allDownloads = filtered.every((spec) => spec.kind === "download");
if (allDownloads) {
return filtered.map((spec, index) => toOption(spec, index));
}
const preferred = selectPreferredInstallSpec(filtered, prefs);
if (!preferred) {
return [];
}
return [toOption(preferred.spec, preferred.index)];
}
function buildSkillStatus(
entry: SkillEntry,
config?: OpenClawConfig,
prefs?: SkillsInstallPreferences,
eligibility?: SkillEligibilityContext,
bundledNames?: Set<string>,
): SkillStatusEntry {
const skillKey = resolveSkillKey(entry);
const skillConfig = resolveSkillConfig(config, skillKey);
const disabled = skillConfig?.enabled === false;
const allowBundled = resolveBundledAllowlist(config);
const blockedByAllowlist = !isBundledSkillAllowed(entry, allowBundled);
const always = entry.metadata?.always === true;
const isEnvSatisfied = (envName: string) =>
Boolean(
process.env[envName] ||
skillConfig?.env?.[envName] ||
(skillConfig?.apiKey && entry.metadata?.primaryEnv === envName),
);
const isConfigSatisfied = (pathStr: string) => isConfigPathTruthy(config, pathStr);
const bundled =
bundledNames && bundledNames.size > 0
? bundledNames.has(entry.skill.name)
: entry.skill.source === "openclaw-bundled";
const { emoji, homepage, required, missing, requirementsSatisfied, configChecks } =
evaluateEntryRequirementsForCurrentPlatform({
always,
entry,
hasLocalBin: hasBinary,
remote: eligibility?.remote,
isEnvSatisfied,
isConfigSatisfied,
});
const eligible = !disabled && !blockedByAllowlist && requirementsSatisfied;
return {
name: entry.skill.name,
description: entry.skill.description,
source: entry.skill.source,
bundled,
filePath: entry.skill.filePath,
baseDir: entry.skill.baseDir,
skillKey,
primaryEnv: entry.metadata?.primaryEnv,
vaultKeyId: extractVaultKeyIdFromConfig(skillKey),
emoji,
homepage,
always,
disabled,
blockedByAllowlist,
eligible,
requirements: required,
missing,
configChecks,
install: normalizeInstallOptions(entry, prefs ?? resolveSkillsInstallPreferences(config)),
};
}
export function buildWorkspaceSkillStatus(
workspaceDir: string,
opts?: {
config?: OpenClawConfig;
managedSkillsDir?: string;
entries?: SkillEntry[];
eligibility?: SkillEligibilityContext;
},
): SkillStatusReport {
const managedSkillsDir = opts?.managedSkillsDir ?? path.join(CONFIG_DIR, "skills");
const bundledContext = resolveBundledSkillsContext();
const skillEntries =
opts?.entries ??
loadWorkspaceSkillEntries(workspaceDir, {
config: opts?.config,
managedSkillsDir,
bundledSkillsDir: bundledContext.dir,
});
const prefs = resolveSkillsInstallPreferences(opts?.config);
return {
workspaceDir,
managedSkillsDir,
skills: skillEntries.map((entry) =>
buildSkillStatus(entry, opts?.config, prefs, opts?.eligibility, bundledContext.names),
),
};
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |