@juicesharp/rpiv-todo 1.17.0 → 1.18.0
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/index.ts +23 -2
- package/package.json +2 -2
package/index.ts
CHANGED
|
@@ -44,6 +44,13 @@ try {
|
|
|
44
44
|
// SDK absent — extension still loads with English-only UI.
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// pi-core's ExtensionRunner throws this exact phrase from an invalidated ctx
|
|
48
|
+
// proxy after session replacement/reload. Match the stable substring so genuine
|
|
49
|
+
// replay bugs still propagate instead of being silently swallowed.
|
|
50
|
+
function isStaleCtxError(e: unknown): boolean {
|
|
51
|
+
return /stale after session replacement/.test(String(e));
|
|
52
|
+
}
|
|
53
|
+
|
|
47
54
|
export default function (pi: ExtensionAPI) {
|
|
48
55
|
// Todo overlay widget — constructed lazily at the first session_start with UI.
|
|
49
56
|
let todoOverlay: TodoOverlay | undefined;
|
|
@@ -62,13 +69,27 @@ export default function (pi: ExtensionAPI) {
|
|
|
62
69
|
});
|
|
63
70
|
|
|
64
71
|
pi.on("session_compact", async (_event, ctx) => {
|
|
65
|
-
|
|
72
|
+
// Auto-compaction races session disposal: pi-core invalidates the
|
|
73
|
+
// extension runner while still emitting session_compact, so `ctx` may be
|
|
74
|
+
// a dead proxy whose getters throw the stale error. The compacting session
|
|
75
|
+
// is being discarded — the replacement session's session_start replays
|
|
76
|
+
// state — so keep current state on a stale ctx. Other errors are real
|
|
77
|
+
// replay bugs and must propagate.
|
|
78
|
+
try {
|
|
79
|
+
replaceState(replayFromBranch(ctx));
|
|
80
|
+
} catch (e) {
|
|
81
|
+
if (!isStaleCtxError(e)) throw e;
|
|
82
|
+
}
|
|
66
83
|
todoOverlay?.resetCompletedDisplayState();
|
|
67
84
|
todoOverlay?.update();
|
|
68
85
|
});
|
|
69
86
|
|
|
70
87
|
pi.on("session_tree", async (_event, ctx) => {
|
|
71
|
-
|
|
88
|
+
try {
|
|
89
|
+
replaceState(replayFromBranch(ctx));
|
|
90
|
+
} catch (e) {
|
|
91
|
+
if (!isStaleCtxError(e)) throw e;
|
|
92
|
+
}
|
|
72
93
|
todoOverlay?.resetCompletedDisplayState();
|
|
73
94
|
todoOverlay?.update();
|
|
74
95
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-todo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Pi extension. A todo list for the model, rendered as a live overlay that survives /reload and conversation compaction.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -64,6 +64,6 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@juicesharp/rpiv-config": "^1.
|
|
67
|
+
"@juicesharp/rpiv-config": "^1.18.0"
|
|
68
68
|
}
|
|
69
69
|
}
|