agentradar-cli 0.3.8 → 0.3.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.
@@ -169,6 +169,41 @@ function tmux(argv) {
169
169
  return r;
170
170
  }
171
171
 
172
+ /**
173
+ * An engagement ended or began: wipe what the next client's snapshot (capture-pane -S) would show. `send-keys -R`
174
+ * resets tmux's own screen (nothing is typed into the app, which repaints on its next output) and clear-history
175
+ * drops the scrollback.
176
+ */
177
+ function clearPane() {
178
+ tmux(["send-keys", "-R", "-t", TMUX_SESSION]);
179
+ tmux(["clear-history", "-t", TMUX_SESSION]);
180
+ }
181
+
182
+ const epochFile = () => process.env.BRIDGE_EPOCH_FILE ?? `${process.env.HOME ?? "/tmp"}/.agentradar-terminal-epoch-${TMUX_SESSION}`;
183
+
184
+ /**
185
+ * The server sends a fingerprint of the agent's active engagements on every connect. A different one than the last
186
+ * seen (or none stored) means the clients changed while this bridge was offline or the server restarted: wipe.
187
+ * Exported for the unit test.
188
+ */
189
+ export function applyEpoch(file, value, clear) {
190
+ if (typeof value !== "string" || !value || value.length > 64) return false;
191
+ let prev = null;
192
+ try {
193
+ prev = fs.readFileSync(file, "utf8").trim();
194
+ } catch {
195
+ /* first run */
196
+ }
197
+ if (prev === value) return false;
198
+ clear();
199
+ try {
200
+ fs.writeFileSync(file, value, { mode: 0o600 });
201
+ } catch (e) {
202
+ console.error(`[bridge] cannot store the terminal epoch (${file}): ${e.message}`);
203
+ }
204
+ return true;
205
+ }
206
+
172
207
  /**
173
208
  * #9: the CURRENT pane geometry, or null if tmux could not answer.
174
209
  *
@@ -352,9 +387,10 @@ class TerminalBridge {
352
387
  this.stopPipe();
353
388
  break;
354
389
  case "clear":
355
- // An engagement ended or changed: drop the scrollback so the next client's snapshot (capture-pane -S)
356
- // cannot replay the previous one's. The visible screen of the live session is not touched.
357
- tmux(["clear-history", "-t", TMUX_SESSION]);
390
+ clearPane();
391
+ break;
392
+ case "epoch":
393
+ applyEpoch(epochFile(), obj.value, clearPane);
358
394
  break;
359
395
  case "input":
360
396
  if (typeof obj.data === "string") tmux(["send-keys", "-t", TMUX_SESSION, "-l", obj.data]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentradar-cli",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -22,6 +22,8 @@
22
22
  "dist/vault-clone.js",
23
23
  "dist/secrets.js",
24
24
  "dist/admin.js",
25
+ "dist/asset-get.js",
26
+ "dist/github.js",
25
27
  "dist/vendor-runner/**",
26
28
  "dist/agentradar-vendor/SKILL.md",
27
29
  "dist/agent-guard",
@@ -39,7 +41,7 @@
39
41
  "test": "vitest run"
40
42
  },
41
43
  "devDependencies": {
42
- "@types/node": "^22.19.21",
44
+ "@types/node": "^22.20.5",
43
45
  "typescript": "^5.7.3",
44
46
  "vitest": "^4.1.8"
45
47
  }