@agentvault/claude-bridge 0.3.1 → 0.3.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.
package/dist/bridge.d.ts CHANGED
@@ -9,13 +9,30 @@ export interface RoomMessage {
9
9
  export interface MessageMeta {
10
10
  roomId?: string;
11
11
  }
12
+ /** #392 room hush (advisory) — emitted by SecureChannel from the backend's
13
+ * `room_hushed` event. ``hushedUntil`` is an ISO string, or null when cleared. */
14
+ export interface RoomHushed {
15
+ roomId: string;
16
+ hushedUntil: string | null;
17
+ }
12
18
  export interface RoomChannel {
13
19
  on(ev: "room_message", cb: (e: RoomMessage) => void): unknown;
14
20
  on(ev: "message", cb: (text: string, metadata: MessageMeta) => void): unknown;
21
+ on(ev: "room_hushed", cb: (e: RoomHushed) => void): unknown;
15
22
  on(ev: "error", cb: (err: unknown) => void): unknown;
16
23
  sendToRoom(roomId: string, text: string): Promise<void>;
17
24
  send(text: string): Promise<void>;
18
25
  }
26
+ /**
27
+ * #392 cooperative quiet: tracks per-room hush windows so the native agent holds
28
+ * (does not room_say) while the owner has hushed the room. Advisory — the agent
29
+ * cooperates; the hard backstops are owner mute / remove (enforced server-side).
30
+ */
31
+ export declare class RoomHushState {
32
+ private until;
33
+ set(roomId: string, hushedUntilIso: string | null): void;
34
+ isHushed(roomId: string, now?: number): boolean;
35
+ }
19
36
  export interface RoomSession {
20
37
  /** `reply` is the immutable reply sink captured for THIS message (see
21
38
  * ActiveTarget.snapshotReply) — the session invokes it when Claude answers. */
package/dist/index.js CHANGED
@@ -66743,6 +66743,19 @@ var init_channel = __esm({
66743
66743
  }
66744
66744
  });
66745
66745
  }
66746
+ if (data.event === "room_hushed") {
66747
+ this.emit("room_hushed", {
66748
+ roomId: data.data?.room_id,
66749
+ hushedUntil: data.data?.hushed_until ?? null
66750
+ });
66751
+ }
66752
+ if (data.event === "room_advisory") {
66753
+ this.emit("room_advisory", {
66754
+ roomId: data.data?.room_id,
66755
+ kind: data.data?.kind,
66756
+ message: data.data?.message
66757
+ });
66758
+ }
66746
66759
  if (data.event === "policy_blocked") {
66747
66760
  this.emit("policy_blocked", data.data);
66748
66761
  }
@@ -131629,6 +131642,23 @@ var PersistentClaudeSession = class {
131629
131642
  };
131630
131643
 
131631
131644
  // src/bridge.ts
131645
+ var RoomHushState = class {
131646
+ until = /* @__PURE__ */ new Map();
131647
+ set(roomId, hushedUntilIso) {
131648
+ if (!roomId) return;
131649
+ if (!hushedUntilIso) {
131650
+ this.until.delete(roomId);
131651
+ return;
131652
+ }
131653
+ const t7 = new Date(hushedUntilIso).getTime();
131654
+ if (Number.isNaN(t7)) return;
131655
+ this.until.set(roomId, t7);
131656
+ }
131657
+ isHushed(roomId, now = Date.now()) {
131658
+ const t7 = this.until.get(roomId);
131659
+ return t7 !== void 0 && now < t7;
131660
+ }
131661
+ };
131632
131662
  var ActiveTarget = class {
131633
131663
  target = null;
131634
131664
  setRoom(roomId) {
@@ -131696,8 +131726,19 @@ function wireBridge(channel, session, target, opts = {}) {
131696
131726
  const msg = err instanceof Error ? err.message : String(err);
131697
131727
  log(`channel error (auto-reconnecting): ${msg}`);
131698
131728
  });
131729
+ const hush = new RoomHushState();
131730
+ channel.on("room_hushed", (e7) => {
131731
+ hush.set(e7.roomId, e7.hushedUntil);
131732
+ log(
131733
+ e7.hushedUntil ? `room ${e7.roomId.slice(0, 8)} hushed until ${e7.hushedUntil} \u2014 holding` : `room ${e7.roomId.slice(0, 8)} hush cleared`
131734
+ );
131735
+ });
131699
131736
  channel.on("room_message", (e7) => {
131700
131737
  if (opts.roomFilter && e7.roomId !== opts.roomFilter) return;
131738
+ if (hush.isHushed(e7.roomId)) {
131739
+ log(`inbound from ${e7.senderName} in ${e7.roomId.slice(0, 8)} \u2014 room hushed, holding (not replying)`);
131740
+ return;
131741
+ }
131701
131742
  log(`inbound from ${e7.senderName} in ${e7.roomId.slice(0, 8)}`);
131702
131743
  target.setRoom(e7.roomId);
131703
131744
  session.push(`[${e7.senderName}]: ${e7.plaintext}`, target.snapshotReply(channel, log));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/claude-bridge",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "description": "AgentVault Claude Bridge — daemon for bridging a Claude agent into secure E2E-encrypted AgentVault 1:1 direct messages and rooms.",
6
6
  "main": "dist/index.js",