@cad0p/pi-napkin 0.7.2-20260818.0 → 0.7.2
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/extensions/distill/index.ts +0 -24
- package/package.json +1 -1
|
@@ -466,13 +466,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
466
466
|
// session_shutdown handlers complete BEFORE invalidation (pi lifecycle), so
|
|
467
467
|
// flipping this flag there makes any queued tick a clean no-op (issue #84).
|
|
468
468
|
let sessionActive = false;
|
|
469
|
-
// Session generation (issue #93): incremented at every session_start. Each
|
|
470
|
-
// timer captures the generation at ARM time; a queued tick from an earlier
|
|
471
|
-
// session that fires after the next session_start re-armed `sessionActive`
|
|
472
|
-
// sees a mismatch and returns BEFORE touching its (invalidated) ctx — a
|
|
473
|
-
// clean no-op instead of the stale-ctx throw + `tick failed` log that #84's
|
|
474
|
-
// try/catch could only downgrade, not prevent.
|
|
475
|
-
let sessionGeneration = 0;
|
|
476
469
|
|
|
477
470
|
pi.on("before_provider_request", (event) =>
|
|
478
471
|
applyDistillPromptCacheKey(event.payload),
|
|
@@ -515,11 +508,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
515
508
|
// a tick queued from a previous session can never observe a dead session
|
|
516
509
|
// while this one is starting (issue #84).
|
|
517
510
|
sessionActive = true;
|
|
518
|
-
// Increment the session generation BEFORE any early return (issue #93): a
|
|
519
|
-
// previous session's tick already queued in the macrotask queue must see
|
|
520
|
-
// a generation mismatch even when this session_start bails on vault/
|
|
521
|
-
// config below.
|
|
522
|
-
sessionGeneration += 1;
|
|
523
511
|
|
|
524
512
|
// Reset to default before any early-return paths below; the persisted state
|
|
525
513
|
// (if any) is re-read further down when distill is enabled for the session.
|
|
@@ -704,17 +692,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
704
692
|
);
|
|
705
693
|
}
|
|
706
694
|
|
|
707
|
-
// Generation seen by the timers armed by THIS session_start. A queued
|
|
708
|
-
// tick from an earlier session that fires after the next session_start
|
|
709
|
-
// re-armed the flag sees a mismatch and no-ops (issue #93).
|
|
710
|
-
const armedGeneration = sessionGeneration;
|
|
711
|
-
|
|
712
695
|
if (ctx.hasUI && showStatus) {
|
|
713
696
|
countdownHandle = setInterval(() => {
|
|
714
697
|
// Queued tick after session replacement/reload must not touch
|
|
715
698
|
// `uiRef.ui` (stale ctx) — skip the countdown render entirely.
|
|
716
699
|
if (!sessionActive) return;
|
|
717
|
-
if (armedGeneration !== sessionGeneration) return; // old-session tick → clean no-op (#93)
|
|
718
700
|
try {
|
|
719
701
|
// `renderIdleStatus` self-guards against in-flight distills; when
|
|
720
702
|
// off it paints `distill: off (session)` (pi dedupes identical
|
|
@@ -731,7 +713,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
731
713
|
|
|
732
714
|
intervalHandle = setInterval(() => {
|
|
733
715
|
if (!sessionActive) return; // queued tick after replacement/reload → clean no-op
|
|
734
|
-
if (armedGeneration !== sessionGeneration) return; // old-session tick → clean no-op (#93)
|
|
735
716
|
if (autoDistillSuppressed) return;
|
|
736
717
|
try {
|
|
737
718
|
runAutoDistill(ctx);
|
|
@@ -1308,14 +1289,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
1308
1289
|
}
|
|
1309
1290
|
};
|
|
1310
1291
|
|
|
1311
|
-
// Capture the generation at ARM time so a queued poll tick from an
|
|
1312
|
-
// earlier session that fires after the next session_start re-armed the
|
|
1313
|
-
// flag no-ops before touching its stale ctx (issue #93).
|
|
1314
|
-
const armedGeneration = sessionGeneration;
|
|
1315
1292
|
pollHandle = setInterval(() => {
|
|
1316
1293
|
// Queued stale tick after session replacement/reload → clean no-op.
|
|
1317
1294
|
if (!sessionActive) return;
|
|
1318
|
-
if (armedGeneration !== sessionGeneration) return; // old-session tick → clean no-op (#93)
|
|
1319
1295
|
try {
|
|
1320
1296
|
pollTick();
|
|
1321
1297
|
} catch (err) {
|
package/package.json
CHANGED