refactor(skills): trim loader export surface · openclaw/openclaw@5b1ba43
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ function pathFor(platform: NodeJS.Platform) {
|
12 | 12 | // "not logged in", even though the operator HOME has a valid hosts.yml. |
13 | 13 | // See https://github.com/openclaw/openclaw/issues/78063. |
14 | 14 | |
15 | | -export type GhConfigDiscoveryEnv = { |
| 15 | +type GhConfigDiscoveryEnv = { |
16 | 16 | HOME?: string; |
17 | 17 | XDG_CONFIG_HOME?: string; |
18 | 18 | GH_CONFIG_DIR?: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,7 @@ let hasWarnedMissingBundledDir = false;
|
8 | 8 | let cachedBundledContext: { dir: string; names: Set<string> } | null = null; |
9 | 9 | |
10 | 10 | /** Bundled skill path context resolved from runtime defaults. */ |
11 | | -export type BundledSkillsContext = { |
| 11 | +type BundledSkillsContext = { |
12 | 12 | dir?: string; |
13 | 13 | names: Set<string>; |
14 | 14 | }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,8 +10,6 @@ import {
|
10 | 10 | evaluateRuntimeEligibility, |
11 | 11 | hasBinary, |
12 | 12 | isConfigPathTruthyWithDefaults, |
13 | | -resolveConfigPath, |
14 | | -resolveRuntimePlatform, |
15 | 13 | } from "../../shared/config-eval.js"; |
16 | 14 | import type { SkillEligibilityContext, SkillEntry, SkillsInstallPreferences } from "../types.js"; |
17 | 15 | import { resolveSkillKey } from "./frontmatter.js"; |
@@ -23,7 +21,7 @@ const DEFAULT_CONFIG_VALUES: Record<string, boolean> = {
|
23 | 21 | }; |
24 | 22 | |
25 | 23 | /** Platform helpers re-exported for skill loading callers and tests. */ |
26 | | -export { hasBinary, resolveConfigPath, resolveRuntimePlatform }; |
| 24 | +export { hasBinary }; |
27 | 25 | |
28 | 26 | export function resolveSkillsInstallPreferences(config?: OpenClawConfig): SkillsInstallPreferences { |
29 | 27 | const raw = config?.skills?.install; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -292,4 +292,3 @@ export const testing = {
|
292 | 292 | publishPluginSkills, |
293 | 293 | resolvePluginSkillLinkType, |
294 | 294 | }; |
295 | | -export { testing as __testing }; |
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Skill contract types describe loaded skill metadata, sources, and prompt surfaces. |
2 | 2 | import type { SourceInfo } from "../../agents/sessions/source-info.js"; |
3 | 3 | |
4 | | -export type SourceScope = "user" | "project" | "temporary"; |
5 | | -export type SourceOrigin = "package" | "top-level"; |
6 | | - |
7 | 4 | export interface Skill { |
8 | 5 | name: string; |
9 | 6 | description: string; |
@@ -17,23 +14,7 @@ export interface Skill {
|
17 | 14 | source: string; |
18 | 15 | } |
19 | 16 | |
20 | | -export function createSyntheticSourceInfo( |
21 | | -path: string, |
22 | | -options: { |
23 | | -source: string; |
24 | | -scope?: SourceScope; |
25 | | -origin?: SourceOrigin; |
26 | | -baseDir?: string; |
27 | | -}, |
28 | | -): SourceInfo { |
29 | | -return { |
30 | | - path, |
31 | | -source: options.source, |
32 | | -scope: options.scope ?? "temporary", |
33 | | -origin: options.origin ?? "top-level", |
34 | | -baseDir: options.baseDir, |
35 | | -}; |
36 | | -} |
| 17 | +export { createSyntheticSourceInfo } from "../../agents/sessions/source-info.js"; |
37 | 18 | |
38 | 19 | function escapeXml(str: string): string { |
39 | 20 | return str |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -31,13 +31,6 @@ export function findContainingAllowedSkillSymlinkTarget(
|
31 | 31 | return null; |
32 | 32 | } |
33 | 33 | |
34 | | -export function isPathInsideAnyAllowedSkillSymlinkTarget( |
35 | | -rootRealPaths: readonly string[], |
36 | | -candidateRealPath: string, |
37 | | -): boolean { |
38 | | -return findContainingAllowedSkillSymlinkTarget(rootRealPaths, candidateRealPath) !== null; |
39 | | -} |
40 | | - |
41 | 34 | export function tryRealpath(filePath: string): string | null { |
42 | 35 | try { |
43 | 36 | return fs.realpathSync(filePath); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。