mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 20:35:39 -06:00
refactor(skills): trim loader export surface
This commit is contained in:
@@ -12,7 +12,7 @@ function pathFor(platform: NodeJS.Platform) {
|
||||
// "not logged in", even though the operator HOME has a valid hosts.yml.
|
||||
// See https://github.com/openclaw/openclaw/issues/78063.
|
||||
|
||||
export type GhConfigDiscoveryEnv = {
|
||||
type GhConfigDiscoveryEnv = {
|
||||
HOME?: string;
|
||||
XDG_CONFIG_HOME?: string;
|
||||
GH_CONFIG_DIR?: string;
|
||||
|
||||
@@ -8,7 +8,7 @@ let hasWarnedMissingBundledDir = false;
|
||||
let cachedBundledContext: { dir: string; names: Set<string> } | null = null;
|
||||
|
||||
/** Bundled skill path context resolved from runtime defaults. */
|
||||
export type BundledSkillsContext = {
|
||||
type BundledSkillsContext = {
|
||||
dir?: string;
|
||||
names: Set<string>;
|
||||
};
|
||||
|
||||
@@ -10,8 +10,6 @@ import {
|
||||
evaluateRuntimeEligibility,
|
||||
hasBinary,
|
||||
isConfigPathTruthyWithDefaults,
|
||||
resolveConfigPath,
|
||||
resolveRuntimePlatform,
|
||||
} from "../../shared/config-eval.js";
|
||||
import type { SkillEligibilityContext, SkillEntry, SkillsInstallPreferences } from "../types.js";
|
||||
import { resolveSkillKey } from "./frontmatter.js";
|
||||
@@ -23,7 +21,7 @@ const DEFAULT_CONFIG_VALUES: Record<string, boolean> = {
|
||||
};
|
||||
|
||||
/** Platform helpers re-exported for skill loading callers and tests. */
|
||||
export { hasBinary, resolveConfigPath, resolveRuntimePlatform };
|
||||
export { hasBinary };
|
||||
|
||||
export function resolveSkillsInstallPreferences(config?: OpenClawConfig): SkillsInstallPreferences {
|
||||
const raw = config?.skills?.install;
|
||||
|
||||
@@ -292,4 +292,3 @@ export const testing = {
|
||||
publishPluginSkills,
|
||||
resolvePluginSkillLinkType,
|
||||
};
|
||||
export { testing as __testing };
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
// Skill contract types describe loaded skill metadata, sources, and prompt surfaces.
|
||||
import type { SourceInfo } from "../../agents/sessions/source-info.js";
|
||||
|
||||
export type SourceScope = "user" | "project" | "temporary";
|
||||
export type SourceOrigin = "package" | "top-level";
|
||||
|
||||
export interface Skill {
|
||||
name: string;
|
||||
description: string;
|
||||
@@ -17,23 +14,7 @@ export interface Skill {
|
||||
source: string;
|
||||
}
|
||||
|
||||
export function createSyntheticSourceInfo(
|
||||
path: string,
|
||||
options: {
|
||||
source: string;
|
||||
scope?: SourceScope;
|
||||
origin?: SourceOrigin;
|
||||
baseDir?: string;
|
||||
},
|
||||
): SourceInfo {
|
||||
return {
|
||||
path,
|
||||
source: options.source,
|
||||
scope: options.scope ?? "temporary",
|
||||
origin: options.origin ?? "top-level",
|
||||
baseDir: options.baseDir,
|
||||
};
|
||||
}
|
||||
export { createSyntheticSourceInfo } from "../../agents/sessions/source-info.js";
|
||||
|
||||
function escapeXml(str: string): string {
|
||||
return str
|
||||
|
||||
@@ -31,13 +31,6 @@ export function findContainingAllowedSkillSymlinkTarget(
|
||||
return null;
|
||||
}
|
||||
|
||||
export function isPathInsideAnyAllowedSkillSymlinkTarget(
|
||||
rootRealPaths: readonly string[],
|
||||
candidateRealPath: string,
|
||||
): boolean {
|
||||
return findContainingAllowedSkillSymlinkTarget(rootRealPaths, candidateRealPath) !== null;
|
||||
}
|
||||
|
||||
export function tryRealpath(filePath: string): string | null {
|
||||
try {
|
||||
return fs.realpathSync(filePath);
|
||||
|
||||
Reference in New Issue
Block a user