zjbar-opencode 1.1.9 → 1.1.10
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/index.js +19 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -152,7 +152,8 @@ var ZjbarPlugin = async ({ directory, client }) => {
|
|
|
152
152
|
const sessionId = crypto.randomUUID();
|
|
153
153
|
const termProgram = process.env.TERM_PROGRAM || null;
|
|
154
154
|
let activeSessionId = null;
|
|
155
|
-
|
|
155
|
+
const STOP_DEBOUNCE_MS = 2000;
|
|
156
|
+
let stopDebounceTimer = null;
|
|
156
157
|
let zellijBin = "zellij";
|
|
157
158
|
try {
|
|
158
159
|
const { execFileSync } = __require("node:child_process");
|
|
@@ -203,25 +204,30 @@ var ZjbarPlugin = async ({ directory, client }) => {
|
|
|
203
204
|
case "session.status": {
|
|
204
205
|
const status = ev.properties?.status?.type;
|
|
205
206
|
if (status === "busy") {
|
|
206
|
-
|
|
207
|
+
if (stopDebounceTimer) {
|
|
208
|
+
clearTimeout(stopDebounceTimer);
|
|
209
|
+
stopDebounceTimer = null;
|
|
210
|
+
}
|
|
207
211
|
sendToZjbar("UserPromptSubmit");
|
|
208
212
|
}
|
|
209
213
|
break;
|
|
210
214
|
}
|
|
211
215
|
case "session.idle": {
|
|
212
216
|
sendToZjbar("Stop", null, null, true);
|
|
213
|
-
if (
|
|
214
|
-
|
|
217
|
+
if (stopDebounceTimer)
|
|
218
|
+
clearTimeout(stopDebounceTimer);
|
|
215
219
|
const sid = ev.properties?.sessionID || activeSessionId;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
stopDebounceTimer = setTimeout(async () => {
|
|
221
|
+
stopDebounceTimer = null;
|
|
222
|
+
if (sid && client) {
|
|
223
|
+
try {
|
|
224
|
+
const summary = await getSessionSummary(client, sid);
|
|
225
|
+
if (summary && shouldNotify("Stop", paneId, termProgram)) {
|
|
226
|
+
sendNotification("Stop", paneId, zellijSession, termProgram, summary);
|
|
227
|
+
}
|
|
228
|
+
} catch {}
|
|
229
|
+
}
|
|
230
|
+
}, STOP_DEBOUNCE_MS);
|
|
225
231
|
break;
|
|
226
232
|
}
|
|
227
233
|
case "session.deleted":
|