Skip to content

The open-source app everyone uses to manage agents at work

Merge public-gh/master into paperclip-company-import-export

dotta2d7b9e95cb34
diff --cc packages/adapters/pi-local/src/server/execute.ts
index 6f3c883c09,697387cde3..efe9d78e84
--- a/packages/adapters/pi-local/src/server/execute.ts
+++ b/packages/adapters/pi-local/src/server/execute.ts
@@@ -51,19 -51,19 +52,18 @@@ function parseModelId(model: string | n
return trimmed.slice(trimmed.indexOf("/") + 1).trim() || null;
}
-function resolvePiBiller(env: Record<string, string>, provider: string | null): string {
- return inferOpenAiCompatibleBiller(env, null) ?? provider ?? "unknown";
-}
-
-async function ensurePiSkillsInjected(onLog: AdapterExecutionContext["onLog"]) {
- const skillsEntries = await listPaperclipSkillEntries(__moduleDir);
-
+async function ensurePiSkillsInjected(
+ onLog: AdapterExecutionContext["onLog"],
+ skillsEntries: Array<{ key: string; runtimeName: string; source: string }>,
+ desiredSkillNames?: string[],
+) {
+ const desiredSet = new Set(desiredSkillNames ?? skillsEntries.map((entry) => entry.key));
+ const selectedEntries = skillsEntries.filter((entry) => desiredSet.has(entry.key));
+ if (selectedEntries.length === 0) return;
- const piSkillsHome = path.join(os.homedir(), ".pi", "agent", "skills");
- await fs.mkdir(piSkillsHome, { recursive: true });
+ await fs.mkdir(PI_AGENT_SKILLS_DIR, { recursive: true });
- if (skillsEntries.length === 0) return;
-
const removedSkills = await removeMaintainerOnlySkillSymlinks(
- piSkillsHome,
+ PI_AGENT_SKILLS_DIR,
- skillsEntries.map((entry) => entry.name),
+ selectedEntries.map((entry) => entry.runtimeName),
);
for (const skillName of removedSkills) {
await onLog(
@@@ -72,20 -72,20 +72,20 @@@
);
}
- for (const entry of skillsEntries) {
- const target = path.join(PI_AGENT_SKILLS_DIR, entry.name);
+ for (const entry of selectedEntries) {
- const target = path.join(piSkillsHome, entry.runtimeName);
++ const target = path.join(PI_AGENT_SKILLS_DIR, entry.runtimeName);
try {
const result = await ensurePaperclipSkillSymlink(entry.source, target);
if (result === "skipped") continue;
await onLog(
"stderr",
- `[paperclip] ${result === "repaired" ? "Repaired" : "Injected"} Pi skill "${entry.key}" into ${piSkillsHome}\n`,
- `[paperclip] ${result === "repaired" ? "Repaired" : "Injected"} Pi skill "${entry.name}" into ${PI_AGENT_SKILLS_DIR}\n`,
++ `[paperclip] ${result === "repaired" ? "Repaired" : "Injected"} Pi skill "${entry.runtimeName}" into ${PI_AGENT_SKILLS_DIR}\n`,
);
} catch (err) {
await onLog(
"stderr",
- `[paperclip] Failed to inject Pi skill "${entry.key}" into ${piSkillsHome}: ${err instanceof Error ? err.message : String(err)}\n`,
- `[paperclip] Failed to inject Pi skill "${entry.name}" into ${PI_AGENT_SKILLS_DIR}: ${err instanceof Error ? err.message : String(err)}\n`,
++ `[paperclip] Failed to inject Pi skill "${entry.runtimeName}" into ${PI_AGENT_SKILLS_DIR}: ${err instanceof Error ? err.message : String(err)}\n`,
);
}
}