pi-openai-toolkit 0.14.1 → 0.14.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/README.md +251 -246
- package/README.zh.md +251 -246
- package/package.json +1 -1
- package/src/context-management/window-manager.ts +479 -421
- package/src/extension-runtime.ts +12 -1
package/src/extension-runtime.ts
CHANGED
|
@@ -853,7 +853,18 @@ export default function registerCompactionExtension(
|
|
|
853
853
|
tools.reset();
|
|
854
854
|
});
|
|
855
855
|
pi.on("model_select", async (event, ctx) => {
|
|
856
|
-
await syncTools(ctx, event.model);
|
|
856
|
+
const active = await syncTools(ctx, event.model);
|
|
857
|
+
// Switching into a covered model mid-session must open the window
|
|
858
|
+
// lifecycle immediately: without an identity the request rewrite skips
|
|
859
|
+
// window metadata, the backend never ingests those turns, and the first
|
|
860
|
+
// new_context would trim pre-switch history that no history can recover.
|
|
861
|
+
// ensureInitialized is idempotent when a window already exists.
|
|
862
|
+
if (!active) return;
|
|
863
|
+
try {
|
|
864
|
+
contextWindows.ensureInitialized(pi, ctx, true);
|
|
865
|
+
} catch {
|
|
866
|
+
notifyRemoteContextFailure(ctx, "malformed-window-state");
|
|
867
|
+
}
|
|
857
868
|
});
|
|
858
869
|
pi.on("before_agent_start", async (_event, ctx) => {
|
|
859
870
|
await syncTools(ctx);
|