pi-agents-switch 0.2.1 → 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.
- package/index.ts +12 -9
- 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 {
|
|
@@ -359,11 +358,10 @@ export default function agentsSwitch(pi: ExtensionAPI) {
|
|
|
359
358
|
|
|
360
359
|
if (resolved.thinkingLevel) pi.setThinkingLevel(resolved.thinkingLevel);
|
|
361
360
|
|
|
362
|
-
if (
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
361
|
+
// Apply resolved tools even if empty (e.g. excluded_tools: ["*"] with no additions)
|
|
362
|
+
const allNames = new Set(pi.getAllTools().map((t) => t.name));
|
|
363
|
+
const valid = resolved.tools.filter((t) => allNames.has(t));
|
|
364
|
+
pi.setActiveTools(valid);
|
|
367
365
|
}
|
|
368
366
|
|
|
369
367
|
// ─── Agent cycling / switching ──────────────────────
|
|
@@ -696,12 +694,13 @@ export default function agentsSwitch(pi: ExtensionAPI) {
|
|
|
696
694
|
},
|
|
697
695
|
});
|
|
698
696
|
|
|
699
|
-
// ─── before_agent_start
|
|
697
|
+
// ─── before_agent_start: inject agent identity ──
|
|
700
698
|
|
|
701
699
|
pi.on("before_agent_start", async (event, ctx) => {
|
|
702
700
|
initPM(ctx.cwd);
|
|
703
701
|
loadCurrentAgent(pm.loadConfig());
|
|
704
|
-
|
|
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.
|
|
705
704
|
updateStatus(ctx);
|
|
706
705
|
const section = getAgentSystemPromptSection();
|
|
707
706
|
if (!section) return;
|
|
@@ -744,7 +743,11 @@ export default function agentsSwitch(pi: ExtensionAPI) {
|
|
|
744
743
|
|
|
745
744
|
pi.on("session_start", async (_event, ctx) => {
|
|
746
745
|
initPM(ctx.cwd);
|
|
747
|
-
|
|
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);
|
|
748
751
|
if (currentAgent !== PI_AGENT_NAME)
|
|
749
752
|
currentResolved = pm.resolveAgent(currentAgent, getPIState(), ctx.cwd);
|
|
750
753
|
updateStatus(ctx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agents-switch",
|
|
3
|
-
"version": "0.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": {
|