zjbar-opencode 1.1.30 → 1.1.31

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 +9 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23,8 +23,6 @@ function capitalize(s) {
23
23
  return s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
24
24
  }
25
25
  var DEFAULT_NOTIFY_EVENTS = ["PermissionRequest", "Notification", "Stop"];
26
- var NOTIFY_RATE_LIMIT_SECS = 10;
27
- var lastNotifyTime = {};
28
26
  function loadSettings() {
29
27
  const settingsPath = join(homedir(), ".config", "zellij", "plugins", "zjbar.json");
30
28
  try {
@@ -42,11 +40,6 @@ function shouldNotify(hookEvent, paneId, termProgram) {
42
40
  const events = settings.notify_events ?? DEFAULT_NOTIFY_EVENTS;
43
41
  if (!events.includes(hookEvent))
44
42
  return false;
45
- const now = Math.floor(Date.now() / 1000);
46
- const key = `pane-${paneId}`;
47
- if (now - (lastNotifyTime[key] ?? 0) < NOTIFY_RATE_LIMIT_SECS)
48
- return false;
49
- lastNotifyTime[key] = now;
50
43
  if (mode === "unfocused" && platform() === "darwin" && termProgram) {
51
44
  try {
52
45
  const { execSync } = __require("node:child_process");
@@ -178,8 +171,6 @@ var ZjbarPlugin = async ({ directory, client }) => {
178
171
  const sessionId = crypto.randomUUID();
179
172
  const termProgram = process.env.TERM_PROGRAM || null;
180
173
  let activeSessionId = null;
181
- const STOP_DEBOUNCE_MS = 2000;
182
- let stopDebounceTimer = null;
183
174
  let zellijBin = "zellij";
184
175
  try {
185
176
  const { execFileSync } = __require("node:child_process");
@@ -232,30 +223,22 @@ var ZjbarPlugin = async ({ directory, client }) => {
232
223
  case "session.status": {
233
224
  const status = ev.properties?.status?.type;
234
225
  if (status === "busy") {
235
- if (stopDebounceTimer) {
236
- clearTimeout(stopDebounceTimer);
237
- stopDebounceTimer = null;
238
- }
239
226
  sendToZjbar("UserPromptSubmit");
240
227
  }
241
228
  break;
242
229
  }
243
230
  case "session.idle": {
244
- sendToZjbar("Stop", null, null, true);
245
- if (stopDebounceTimer)
246
- clearTimeout(stopDebounceTimer);
247
231
  const sid = ev.properties?.sessionID || activeSessionId;
248
- stopDebounceTimer = setTimeout(async () => {
249
- stopDebounceTimer = null;
250
- if (sid && client) {
251
- try {
252
- const summary = await getSessionSummary(client, sid);
253
- if (summary && shouldNotify("Stop", paneId, termProgram)) {
254
- sendNotification("Stop", paneId, zellijSession, termProgram, summary);
255
- }
256
- } catch {}
232
+ if (sid && client) {
233
+ try {
234
+ const summary = await getSessionSummary(client, sid);
235
+ sendToZjbar("Stop", null, summary);
236
+ } catch {
237
+ sendToZjbar("Stop");
257
238
  }
258
- }, STOP_DEBOUNCE_MS);
239
+ } else {
240
+ sendToZjbar("Stop");
241
+ }
259
242
  break;
260
243
  }
261
244
  case "session.deleted":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zjbar-opencode",
3
- "version": "1.1.30",
3
+ "version": "1.1.31",
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",