feat(02-04): update all 5 adapters to use managed skills instead of static directories
- Claude: buildSkillsDir() accepts managedSkills, uses createManagedSkillSymlinks - Codex: ensureCodexSkillsInjected() prefers managed skills over static scan - Gemini: ensureGeminiSkillsInjected() prefers managed skills over static scan - OpenCode: ensureOpenCodeSkillsInjected() prefers managed skills over static scan - Kimi: new skill injection via ensureKimiSkillsInjected() (first-time support) - All adapters fall back to static SKILLS_CANDIDATES when no managed skills provided
This commit is contained in:
1 parent
3fb9ab86d9
commit
14a7f4468e
5 files changed
+101
-17
No files matched your search
@@ -1,4 +1,6 @@
|
||||
import type { AdapterExecutionContext, AdapterExecutionResult } from "@agentcompany/adapter-utils";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import type { AdapterExecutionContext, AdapterExecutionResult, ManagedSkillRef } from "@agentcompany/adapter-utils";
|
||||
import {
|
||||
asNumber,
|
||||
asString,
|
||||
@@ -7,9 +9,22 @@ import {
|
||||
ensureCommandResolvable,
|
||||
ensurePathInEnv,
|
||||
runChildProcess,
|
||||
createManagedSkillSymlinks,
|
||||
} from "@agentcompany/adapter-utils/server-utils";
|
||||
import { DEFAULT_KIMI_LOCAL_MODEL } from "../index.js";
|
||||
|
||||
function kimiSkillsHome(): string {
|
||||
return path.join(os.homedir(), ".kimi", "skills");
|
||||
}
|
||||
|
||||
async function ensureKimiSkillsInjected(
|
||||
managedSkills: ManagedSkillRef[],
|
||||
onLog: AdapterExecutionContext["onLog"],
|
||||
): Promise<void> {
|
||||
if (managedSkills.length === 0) return;
|
||||
await createManagedSkillSymlinks(managedSkills, kimiSkillsHome(), onLog);
|
||||
}
|
||||
|
||||
function normalizeEnv(input: unknown): Record<string, string> {
|
||||
if (typeof input !== "object" || input === null || Array.isArray(input)) return {};
|
||||
const env: Record<string, string> = {};
|
||||
@@ -29,6 +44,12 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
||||
const extraArgs = asStringArray(config.extraArgs);
|
||||
|
||||
await ensureAbsoluteDirectory(cwd, { createIfMissing: true });
|
||||
const managedSkills: ManagedSkillRef[] = Array.isArray(config.managedSkills)
|
||||
? (config.managedSkills as ManagedSkillRef[]).filter(
|
||||
(s) => typeof s.runtimeName === "string" && typeof s.sourcePath === "string",
|
||||
)
|
||||
: [];
|
||||
await ensureKimiSkillsInjected(managedSkills, onLog);
|
||||
|
||||
const prompt = typeof context.taskTitle === "string" && context.taskTitle.length > 0
|
||||
? [
|
||||
|
||||
Reference in new issue
Block a user