pi-prompt-template-model 0.2.0 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.2.1] - 2026-01-31
6
+
7
+ ### Fixed
8
+
9
+ - Thinking level now correctly restored after commands that switch model without a `thinking` field. Previously, running a prompt template that only specified `model` would reset thinking to "off" instead of restoring the original level (e.g., "high").
10
+
5
11
  ## [0.2.0] - 2025-01-31
6
12
 
7
13
  ### Added
package/index.ts CHANGED
@@ -549,8 +549,9 @@ export default function promptModelExtension(pi: ExtensionAPI) {
549
549
  return;
550
550
  }
551
551
 
552
- // Capture current model before any switching (needed for restore)
552
+ // Capture current state before any switching (needed for restore)
553
553
  const savedModel = ctx.model;
554
+ const savedThinking = pi.getThinkingLevel();
554
555
 
555
556
  // Resolve and switch to the first available model from the list
556
557
  const result = await resolveAndSwitch(currentPrompt.models, ctx);
@@ -558,17 +559,15 @@ export default function promptModelExtension(pi: ExtensionAPI) {
558
559
 
559
560
  if (!result.alreadyActive && currentPrompt.restore) {
560
561
  previousModel = savedModel;
562
+ previousThinking = savedThinking;
561
563
  }
562
564
 
563
565
  // Set thinking level if specified
564
566
  if (currentPrompt.thinking) {
565
- const currentThinking = pi.getThinkingLevel();
566
- if (currentThinking !== currentPrompt.thinking) {
567
- if (currentPrompt.restore) {
568
- previousThinking = currentThinking;
569
- }
570
- pi.setThinkingLevel(currentPrompt.thinking);
567
+ if (currentPrompt.restore && previousThinking === undefined && currentPrompt.thinking !== savedThinking) {
568
+ previousThinking = savedThinking;
571
569
  }
570
+ pi.setThinkingLevel(currentPrompt.thinking);
572
571
  }
573
572
 
574
573
  // Set pending skill for before_agent_start handler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-prompt-template-model",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Prompt template model selector extension for pi coding agent",
5
5
  "author": "Nico Bailon",
6
6
  "license": "MIT",