pi-observational-memory-extension 0.1.0 → 0.1.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.
@@ -378,7 +378,16 @@ export default function (pi: ExtensionAPI) {
378
378
  pi.on("session_shutdown", async (_event, ctx) => {
379
379
  if (runtime.statusTimer) clearInterval(runtime.statusTimer);
380
380
  runtime.currentOperation?.abort();
381
- if (runtime.state) await saveState(runtime.state);
381
+ if (runtime.state) {
382
+ try {
383
+ if (runtime.state.enabled && runtime.state.pendingMessageTokens > 0) {
384
+ await observeNow(ctx, { force: true, reason: "session_shutdown" });
385
+ }
386
+ } catch (error) {
387
+ // Safe catch on shutdown
388
+ }
389
+ await saveState(runtime.state);
390
+ }
382
391
  ctx.ui.setStatus("om", undefined);
383
392
  ctx.ui.setWidget("om", undefined);
384
393
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-observational-memory-extension",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Mastra-style Observational Memory extension for Pi compaction and runtime context.",
5
5
  "license": "MIT",
6
6
  "author": "Nikita Nosov <20nik.nosov21@gmail.com>",