pi-agents-switch 0.2.5 → 0.2.6

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.
Files changed (2) hide show
  1. package/index.ts +23 -5
  2. 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,8 +881,9 @@ export default function agentsSwitch(pi: ExtensionAPI) {
883
881
  }
884
882
  }
885
883
 
886
- // Strip the <available_skills> block (other extensions might add extra skills)
887
- // Our before_agent_start handler manages this any extras are contamination.
884
+ // Replace <available_skills> block: strip whatever is there
885
+ // (other extensions may inject extra skills), then rebuild
886
+ // from our resolved skill set.
888
887
  const skillsOpen = "\n<available_skills>";
889
888
  const skillsIdx = content.indexOf(skillsOpen);
890
889
  if (skillsIdx >= 0) {
@@ -898,6 +897,25 @@ export default function agentsSwitch(pi: ExtensionAPI) {
898
897
  }
899
898
  }
900
899
 
900
+ // Rebuild clean skills block from our resolved config
901
+ if (currentResolved.skillNames.length > 0) {
902
+ const selectedSkills = pm.getSkillObjects(
903
+ currentResolved.skillNames,
904
+ );
905
+ if (selectedSkills.length > 0) {
906
+ const skillsBlock = formatSkillsBlock(selectedSkills);
907
+ // Insert before "Current date:"
908
+ const currentDateMarker = "\nCurrent date:";
909
+ const idx = content.indexOf(currentDateMarker);
910
+ if (idx >= 0) {
911
+ content =
912
+ content.substring(0, idx) +
913
+ skillsBlock +
914
+ content.substring(idx);
915
+ }
916
+ }
917
+ }
918
+
901
919
  // Strip "Pi documentation" block (pi-lens may re-add after our handler strips it)
902
920
  const piDocsMarker =
903
921
  "Pi documentation (read only when the user asks about pi itself";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agents-switch",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
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": {