pi-sdk-web 0.3.10 → 0.3.11
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/dist/server.js +13 -2
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -112,6 +112,13 @@ export class PiWebServer {
|
|
|
112
112
|
// during teardown/dispose of the old session).
|
|
113
113
|
this.unsubscribe?.();
|
|
114
114
|
this.unsubscribe = null;
|
|
115
|
+
if (afterSwitch) {
|
|
116
|
+
// Drop stale extension dialogs/status from the PREVIOUS session BEFORE
|
|
117
|
+
// rebinding: bindExtensions emits session_start, whose handlers (e.g.
|
|
118
|
+
// magic-context's status line) call setStatus and populate statusMap.
|
|
119
|
+
// Clearing after bindExtensions would wipe the new session's values.
|
|
120
|
+
this.uiContext.clearSessionState();
|
|
121
|
+
}
|
|
115
122
|
await session.bindExtensions({
|
|
116
123
|
uiContext: this.uiContext,
|
|
117
124
|
// "rpc" is the closest ExtensionMode: dialog-capable UI (hasUI=true),
|
|
@@ -135,10 +142,14 @@ export class PiWebServer {
|
|
|
135
142
|
console.error(`Session cwd not found (${cwd}), keeping current directory`);
|
|
136
143
|
}
|
|
137
144
|
}
|
|
138
|
-
// Stale extension dialogs/status from the previous session are dropped
|
|
139
|
-
this.uiContext.clearSessionState();
|
|
140
145
|
this.broadcastState();
|
|
141
146
|
this.broadcastHistory();
|
|
147
|
+
// Push the (new) extension status snapshot: the frontend's
|
|
148
|
+
// clearContent() on history wipes ext-status and there is no other
|
|
149
|
+
// channel after switching, so plugin status lines (e.g. magic-context)
|
|
150
|
+
// would stay hidden until the new session's first turn event.
|
|
151
|
+
const extStatus = this.uiContext.getStatusSnapshot();
|
|
152
|
+
this.broadcast({ type: "ext_status", data: extStatus });
|
|
142
153
|
}
|
|
143
154
|
}
|
|
144
155
|
async stop() {
|