pi-agents-switch 0.2.2 → 0.2.3

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 +8 -4
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -208,7 +208,6 @@ If user picks a preset, still confirm skills/extensions/model choices.
208
208
  - Offer: "Switch now with \`/switch <name>\` to test."
209
209
  `;
210
210
 
211
-
212
211
  // ─── PI state snapshot ─────────────────────────────────
213
212
 
214
213
  interface PIStateSnapshot {
@@ -695,12 +694,13 @@ export default function agentsSwitch(pi: ExtensionAPI) {
695
694
  },
696
695
  });
697
696
 
698
- // ─── before_agent_start ─────────────────────────────
697
+ // ─── before_agent_start: inject agent identity ──
699
698
 
700
699
  pi.on("before_agent_start", async (event, ctx) => {
701
700
  initPM(ctx.cwd);
702
701
  loadCurrentAgent(pm.loadConfig());
703
- await applyAgentSettings(ctx);
702
+ // Tools/model/thinking are applied at session_start and switch time,
703
+ // so here we only handle text injection into the already-correct prompt.
704
704
  updateStatus(ctx);
705
705
  const section = getAgentSystemPromptSection();
706
706
  if (!section) return;
@@ -743,7 +743,11 @@ export default function agentsSwitch(pi: ExtensionAPI) {
743
743
 
744
744
  pi.on("session_start", async (_event, ctx) => {
745
745
  initPM(ctx.cwd);
746
- loadCurrentAgent(pm.loadConfig());
746
+ const config = pm.loadConfig();
747
+ loadCurrentAgent(config);
748
+ // Apply agent settings immediately so tools/model/thinking
749
+ // are set before the first prompt builds the system prompt.
750
+ await applyAgentSettings(ctx);
747
751
  if (currentAgent !== PI_AGENT_NAME)
748
752
  currentResolved = pm.resolveAgent(currentAgent, getPIState(), ctx.cwd);
749
753
  updateStatus(ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agents-switch",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
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": {