@zeph-to/hook-sdk 1.10.1 → 1.10.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.
@@ -34,6 +34,15 @@ interface AgentSession {
34
34
  export declare const checkRateLimit: (session: string, now?: number) => boolean;
35
35
  /** Read the foreground command in the named tmux session's active pane. */
36
36
  export declare const paneCurrentCommand: (session: string) => string | null;
37
+ /**
38
+ * Mark the cached socket as no longer trustworthy — call this when a
39
+ * tmux command fails against the cached path. The next findTmuxSocket()
40
+ * will redo full discovery (default probe → /var/folders walk → lsof
41
+ * fallback) instead of returning a stale answer. Without this the
42
+ * listener wedged at "reported 0 session(s)" forever after a tmux
43
+ * server restart, even when a new server was live and discoverable.
44
+ */
45
+ export declare const invalidateTmuxSocketCache: () => void;
37
46
  /**
38
47
  * Parse a `zeph-*` tmux session name into `{project, label}`. For
39
48
  * Phase 1 the wrapper only emits `zeph-<project>` (no labels), so the
@@ -1 +1 @@
1
- {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../src/listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAuBH,KAAK,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAG/C,UAAU,YAAY;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AA2BD,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,MAAK,MAAmB,KAAG,OAgB1E,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,GAAI,SAAS,M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AC,MAAM,CAyF3F,CAAC"}
package/dist/listener.js CHANGED
@@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.handleListener = exports.computeListenerDeviceId = exports.handlePush = exports.collectSessions = exports.collectSessionsVerbose = exports.detectClaudeSessionId = exports.parseSessionName = exports.paneCurrentCommand = exports.checkRateLimit = void 0;
28
+ exports.handleListener = exports.computeListenerDeviceId = exports.handlePush = exports.collectSessions = exports.collectSessionsVerbose = exports.detectClaudeSessionId = exports.parseSessionName = exports.invalidateTmuxSocketCache = exports.paneCurrentCommand = exports.checkRateLimit = void 0;
29
29
  const child_process_1 = require("child_process");
30
30
  const crypto_1 = require("crypto");
31
31
  const fs_1 = require("fs");
@@ -135,6 +135,19 @@ let cachedSocketPath = null;
135
135
  * removes the ambiguity so we don't re-probe every collectSessions
136
136
  * cycle (which was spamming the log with "tmux: default socket OK"). */
137
137
  let cacheValid = false;
138
+ /**
139
+ * Mark the cached socket as no longer trustworthy — call this when a
140
+ * tmux command fails against the cached path. The next findTmuxSocket()
141
+ * will redo full discovery (default probe → /var/folders walk → lsof
142
+ * fallback) instead of returning a stale answer. Without this the
143
+ * listener wedged at "reported 0 session(s)" forever after a tmux
144
+ * server restart, even when a new server was live and discoverable.
145
+ */
146
+ const invalidateTmuxSocketCache = () => {
147
+ cacheValid = false;
148
+ cachedSocketPath = null;
149
+ };
150
+ exports.invalidateTmuxSocketCache = invalidateTmuxSocketCache;
138
151
  const probeTmuxSocketDetail = (socketPath) => {
139
152
  const args = socketPath ? ['-S', socketPath, 'list-sessions'] : ['list-sessions'];
140
153
  const r = (0, child_process_1.spawnSync)('tmux', args, {
@@ -518,6 +531,11 @@ const collectSessionsVerbose = () => {
518
531
  if (list.status !== 0) {
519
532
  const stderr = (list.stderr ?? '').toString().trim();
520
533
  log(` tmux list-sessions failed: status=${list.status}${stderr ? ', stderr=' + stderr : ''}`);
534
+ // Tmux call failed against the cached socket — the server it
535
+ // pointed at is gone (died, restarted at a different path, etc).
536
+ // Invalidate so the next cycle re-runs full discovery instead of
537
+ // wedging the listener at "reported 0 session(s)" forever.
538
+ (0, exports.invalidateTmuxSocketCache)();
521
539
  return { sessions: [], rejected: [] };
522
540
  }
523
541
  const rawLines = (list.stdout ?? '').split('\n').filter(Boolean);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeph-to/hook-sdk",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "Zeph push notification SDK + CLI for AI agents",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",