pi-agents-switch 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +36 -15
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -867,9 +867,7 @@ export default function agentsSwitch(pi: ExtensionAPI) {
|
|
|
867
867
|
const snippets = pi.getAllTools();
|
|
868
868
|
const cleanLines = currentResolved.tools
|
|
869
869
|
.map((name) => {
|
|
870
|
-
const tool = snippets.find(
|
|
871
|
-
(t) => t.name === name,
|
|
872
|
-
);
|
|
870
|
+
const tool = snippets.find((t) => t.name === name);
|
|
873
871
|
return tool
|
|
874
872
|
? `- ${tool.name}: ${tool.description ?? ""}`
|
|
875
873
|
: `- ${name}`;
|
|
@@ -883,18 +881,41 @@ export default function agentsSwitch(pi: ExtensionAPI) {
|
|
|
883
881
|
}
|
|
884
882
|
}
|
|
885
883
|
|
|
886
|
-
//
|
|
887
|
-
//
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
884
|
+
// Replace <available_skills> block: only touch skills when the agent
|
|
885
|
+
// has explicit skill config (skillNames.length > 0).
|
|
886
|
+
// For agents without skill config, leave Pi's default skills intact.
|
|
887
|
+
if (currentResolved.skillNames.length > 0) {
|
|
888
|
+
const skillsOpen = "\n<available_skills>";
|
|
889
|
+
const skillsIdx = content.indexOf(skillsOpen);
|
|
890
|
+
if (skillsIdx >= 0) {
|
|
891
|
+
const skillsEnd = content.indexOf(
|
|
892
|
+
"\n</available_skills>",
|
|
893
|
+
skillsIdx,
|
|
894
|
+
);
|
|
895
|
+
if (skillsEnd >= 0) {
|
|
896
|
+
content =
|
|
897
|
+
content.substring(0, skillsIdx) +
|
|
898
|
+
content.substring(
|
|
899
|
+
skillsEnd + "\n</available_skills>".length,
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
// Rebuild clean skills block from our resolved config
|
|
905
|
+
const selectedSkills = pm.getSkillObjects(
|
|
906
|
+
currentResolved.skillNames,
|
|
907
|
+
);
|
|
908
|
+
if (selectedSkills.length > 0) {
|
|
909
|
+
const skillsBlock = formatSkillsBlock(selectedSkills);
|
|
910
|
+
// Insert before "Current date:"
|
|
911
|
+
const currentDateMarker = "\nCurrent date:";
|
|
912
|
+
const idx = content.indexOf(currentDateMarker);
|
|
913
|
+
if (idx >= 0) {
|
|
914
|
+
content =
|
|
915
|
+
content.substring(0, idx) +
|
|
916
|
+
skillsBlock +
|
|
917
|
+
content.substring(idx);
|
|
918
|
+
}
|
|
898
919
|
}
|
|
899
920
|
}
|
|
900
921
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agents-switch",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Tab to switch primary agents in Pi — like OpenCode's agent switching. Each agent gets an isolated profile with its own AGENTS.md, extensions, skills, and settings.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"pi": {
|