@agentvault/claude-bridge 0.8.24 → 0.8.26

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
@@ -1,4 +1,7 @@
1
+ import { type ToolSpanSink } from "@agentvault/agentvault";
1
2
  import { ArmingState } from "./arming.js";
3
+ import { type TerminalVerdict } from "./service/self-uninstall.js";
4
+ import { type RoomContextLimits } from "./room-context.js";
2
5
  export interface RoomMessage {
3
6
  roomId: string;
4
7
  senderName: string;
@@ -9,6 +12,9 @@ export interface RoomMessage {
9
12
  /** SecureChannel's sender classification. Only an explicit false authorizes
10
13
  * room tools; reply eligibility is independently decided by the @ protocol. */
11
14
  senderIsAgent?: boolean;
15
+ /** ISO send time from the emit (`data.created_at`). Used to stamp a message
16
+ * held as room context; receipt time stands in when absent. */
17
+ timestamp?: string;
12
18
  }
13
19
  /** Slice 2 Plan C arming events (SecureChannel re-emits these from the backend). */
14
20
  export interface ArmRequested {
@@ -55,6 +61,15 @@ export interface RoomChannel {
55
61
  roomId: string;
56
62
  name?: string;
57
63
  }) => void): unknown;
64
+ /** This agent left the room itself (SecureChannel.leaveRoom). Drops its held context. */
65
+ on(ev: "room_left", cb: (e: {
66
+ roomId: string;
67
+ }) => void): unknown;
68
+ /** Rooms the server no longer lists for this agent (removed or disbanded),
69
+ * pruned on reconnect. Drops their held context. */
70
+ on(ev: "rooms_reconciled", cb: (e: {
71
+ pruned?: string[];
72
+ }) => void): unknown;
58
73
  on(ev: "message", cb: (text: string, metadata: MessageMeta) => void): unknown;
59
74
  on(ev: "room_hushed", cb: (e: RoomHushed) => void): unknown;
60
75
  on(ev: "error", cb: (err: unknown) => void): unknown;
@@ -101,13 +116,21 @@ export interface RoomSession {
101
116
  * `opts.autoReplyOnText` (set for 1:1 DMs) makes the session fall back to
102
117
  * sending plain assistant text when the model never calls the say tool (#416).
103
118
  * `opts.replyExpected` requests that same fallback for a room turn (a human/owner
104
- * sender) WITHOUT enabling tools — decoupled from autoReplyOnText on purpose. */
119
+ * sender) WITHOUT enabling tools — decoupled from autoReplyOnText on purpose.
120
+ * `opts.roomContext` is the held "earlier in this room" block (see
121
+ * room-context.ts), delivered in front of `text` in the SAME turn.
122
+ *
123
+ * Returns `false` only when the turn went somewhere that does not take room
124
+ * context (the router's tool-capable worker lane), so the caller keeps it for
125
+ * the next turn that does. Anything else (`void`, `true`, …) means it was
126
+ * delivered. */
105
127
  push(text: string, reply?: (text: string) => Promise<void>, opts?: {
106
128
  autoReplyOnText?: boolean;
107
129
  replyExpected?: boolean;
108
130
  toolEligibleSender?: boolean;
109
131
  armed?: () => boolean;
110
- }): void;
132
+ roomContext?: string;
133
+ }): unknown;
111
134
  }
112
135
  /** Where a reply should go: a room (sendToRoom) or a 1:1 DM (send). */
113
136
  export type BridgeTarget = {
@@ -122,6 +145,9 @@ export type BridgeTarget = {
122
145
  export interface ReplyChannel {
123
146
  sendToRoom(roomId: string, text: string): Promise<void>;
124
147
  send(text: string): Promise<void>;
148
+ /** SecureChannel's TelemetryReporter (device JWT, buffered). Optional so
149
+ * fixtures and a channel without telemetry keep working. */
150
+ readonly telemetry?: ToolSpanSink | null;
125
151
  /** #1418 — SecureChannel: run `fn` as `conversationId`'s turn, so an
126
152
  * untargeted send inside it reaches that conversation's person only. */
127
153
  runForConversation?<T>(conversationId: string | undefined, fn: () => Promise<T>, opts?: {
@@ -156,6 +182,7 @@ export declare class ActiveTarget {
156
182
  export interface LifecycleChannel {
157
183
  on(ev: "auth_failed", cb: (e: {
158
184
  reason: string;
185
+ deviceGone?: boolean;
159
186
  }) => void): unknown;
160
187
  on(ev: "session_replaced", cb: (e: {
161
188
  code?: number;
@@ -188,7 +215,7 @@ export declare function attachLifecycle(channel: LifecycleChannel, opts?: {
188
215
  * well would put the same rule in two files, and the two would eventually
189
216
  * disagree — which is how `session_replaced` (device still alive) would end
190
217
  * up removing a healthy install. */
191
- selfUninstall?: (reason: string, env: NodeJS.ProcessEnv) => boolean;
218
+ selfUninstall?: (verdict: TerminalVerdict, env: NodeJS.ProcessEnv) => boolean;
192
219
  }): void;
193
220
  /**
194
221
  * Slice 2 Plan C (Task 11) — one drain of the local-approval marker dir.
@@ -224,6 +251,20 @@ export declare function pollApprovalsOnce(arming: ArmingState, dataDir: string,
224
251
  * unmarked turn already reads as a DM, which is what the model assumes.
225
252
  */
226
253
  export declare function roomTurnPrefix(roomId: string, senderName: string, roomName?: string): string;
254
+ /**
255
+ * What a held (unaddressed) room message contributes as context: the CAPTION
256
+ * the sender typed, never the folded file. SecureChannel folds an attachment's
257
+ * contents in FRONT of the caption, so holding `plaintext` and cutting it to
258
+ * the per-message limit kept the file and dropped what was actually said — and
259
+ * carried a file nobody asked this agent about into its next turn (PR #1458).
260
+ * Emitters older than #1223 send no caption; their plaintext is all there is.
261
+ */
262
+ export declare function heldText(e: {
263
+ plaintext: string;
264
+ caption?: string;
265
+ }): string;
266
+ /** The room as the model sees it: its name when known, else a short id. */
267
+ export declare function roomLabel(roomId: string, roomName?: string): string;
227
268
  /**
228
269
  * Does this agent owe a reply to this room message? (#1107)
229
270
  *
@@ -235,8 +276,9 @@ export declare function roomTurnPrefix(roomId: string, senderName: string, roomN
235
276
  * in the half most likely to be read as "the protocol doesn't work".
236
277
  *
237
278
  * Now it defers to the ONE shared implementation exported by
238
- * `@agentvault/agentvault`. The message is still pushed into the session either
239
- * way — the agent reads the whole room and only the reply obligation changes.
279
+ * `@agentvault/agentvault`. A message this returns false for is NOT pushed into
280
+ * the session (2026-10-26): it is held as room context and delivered with the
281
+ * next message in that room that this agent does owe — see room-context.ts.
240
282
  */
241
283
  export declare function _makeOwesReply(agentName: string | undefined, channel: {
242
284
  ownDisplayName?: string;
@@ -298,5 +340,7 @@ export declare function wireBridge(channel: RoomChannel, session: RoomSession, t
298
340
  * dir so they can `grant(...)` into it without touching the real host.
299
341
  */
300
342
  trustRoot?: string;
343
+ /** Test-only: override the room-context bounds (see room-context.ts). */
344
+ roomContextLimits?: Partial<RoomContextLimits>;
301
345
  }): ArmingState;
302
346
  //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1,11 @@
1
+ /** The bridge-controlled agent identity prompt (no workspace file may supply it). */
2
+ /**
3
+ * How a room works, as this bridge now delivers it (PR #1458). The old line —
4
+ * "In a room you see every message" — stopped being true when unaddressed room
5
+ * messages stopped running turns: the agent is shown only what @-mentions it,
6
+ * with what it missed arriving as a quoted context block. Telling the model it
7
+ * sees everything would have it treat that block as live conversation.
8
+ */
9
+ export declare function roomRules(sayTool: string): string;
10
+ export declare function identityPrompt(agentName: string): string;
11
+ //# sourceMappingURL=identity-prompt.d.ts.map