pi-skillful 0.3.4 → 0.3.5

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
@@ -6,6 +6,12 @@ This project follows the spirit of [Keep a Changelog](https://keepachangelog.com
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.5] - 2026-05-12
10
+
11
+ ### Fixed
12
+
13
+ - Fixed preserving session skill toggle state across `/new` after Pi reloads extension instances.
14
+
9
15
  ## [0.3.4] - 2026-05-12
10
16
 
11
17
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-skillful",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Pi package with skill invocation and visibility improvements.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -14,6 +14,7 @@ import { replaceSkillsSection } from "../skill-prompt.js";
14
14
  import { listLoadedSkills } from "../skills.js";
15
15
 
16
16
  const WIDGET_KEY = "pi-skillful-session-toggles";
17
+ const STORE_KEY = Symbol.for("pi-skillful.sessionSkillTogglesStore");
17
18
  const BORDER_PREFIX = "─── ";
18
19
  const BORDER_SUFFIX = " ";
19
20
  const BORDER_PREFIX_WIDTH = visibleWidth(BORDER_PREFIX);
@@ -38,8 +39,15 @@ interface SessionToggleState {
38
39
  theme: Theme | undefined;
39
40
  }
40
41
 
42
+ interface SessionToggleStore {
43
+ preservedNewSessionActiveBySkill: { cwd: string; activeBySkill: Map<string, boolean> } | undefined;
44
+ }
45
+
46
+ const store = (((globalThis as Record<PropertyKey, unknown>)[STORE_KEY] as SessionToggleStore | undefined) ??= {
47
+ preservedNewSessionActiveBySkill: undefined,
48
+ }) as SessionToggleStore;
49
+
41
50
  let state: SessionToggleState = createEmptyState();
42
- let preservedNewSessionActiveBySkill: { cwd: string; activeBySkill: Map<string, boolean> } | undefined;
43
51
 
44
52
  export default function sessionSkillToggles(pi: ExtensionAPI) {
45
53
  for (const modifier of SUPPORTED_TOGGLE_MODIFIERS) {
@@ -64,10 +72,10 @@ export default function sessionSkillToggles(pi: ExtensionAPI) {
64
72
  });
65
73
 
66
74
  const preservedActiveBySkill =
67
- event.reason === "new" && preservedNewSessionActiveBySkill?.cwd === ctx.cwd
68
- ? preservedNewSessionActiveBySkill.activeBySkill
75
+ event.reason === "new" && store.preservedNewSessionActiveBySkill?.cwd === ctx.cwd
76
+ ? store.preservedNewSessionActiveBySkill.activeBySkill
69
77
  : undefined;
70
- preservedNewSessionActiveBySkill = undefined;
78
+ store.preservedNewSessionActiveBySkill = undefined;
71
79
 
72
80
  state = {
73
81
  cwd: ctx.cwd,
@@ -107,7 +115,7 @@ export default function sessionSkillToggles(pi: ExtensionAPI) {
107
115
  pi.on("session_shutdown", (event, ctx) => {
108
116
  if (state.installedEditor) ctx.ui.setEditorComponent(state.previousEditorFactory);
109
117
  if (state.installedWidget) ctx.ui.setWidget(WIDGET_KEY, undefined);
110
- preservedNewSessionActiveBySkill =
118
+ store.preservedNewSessionActiveBySkill =
111
119
  event.reason === "new" ? { cwd: state.cwd, activeBySkill: new Map(state.activeBySkill) } : undefined;
112
120
  state = createEmptyState();
113
121
  });