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.
Files changed (2) hide show
  1. package/dist/index.js +19 -13
  2. 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
- let stopNotified = false;
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
- stopNotified = false;
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 (stopNotified)
214
- break;
217
+ if (stopDebounceTimer)
218
+ clearTimeout(stopDebounceTimer);
215
219
  const sid = ev.properties?.sessionID || activeSessionId;
216
- if (sid && client) {
217
- try {
218
- const summary = await getSessionSummary(client, sid);
219
- if (summary && shouldNotify("Stop", paneId, termProgram)) {
220
- stopNotified = true;
221
- sendNotification("Stop", paneId, zellijSession, termProgram, summary);
222
- }
223
- } catch {}
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":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zjbar-opencode",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "description": "zjbar plugin for OpenCode — live AI activity indicators in Zellij status bar",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",