@agentvault/grok-bridge 0.4.24 → 0.4.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/README.md +1 -0
- package/dist/bridge.d.ts +42 -3
- package/dist/identity-prompt.d.ts +11 -0
- package/dist/index.js +645 -109
- package/dist/room-context.d.ts +101 -0
- package/dist/service/self-uninstall.d.ts +30 -2
- package/dist/service/self-uninstall.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,6 +71,7 @@ there does NOT reach us.
|
|
|
71
71
|
| `src/log.ts` | `9b28a272e87600e78627dbd0f53fcbd192e01e73` | `9b28a272e87600e78627dbd0f53fcbd192e01e73` |
|
|
72
72
|
| `src/bridge.ts` | `f3a7d53f67246e59c471891aee667e002a23b701` | `f3a7d53f67246e59c471891aee667e002a23b701` |
|
|
73
73
|
| `src/service/` | `16c95f46c654a34613aeb2a4ff94eeede9e671ef` | `16c95f46c654a34613aeb2a4ff94eeede9e671ef` |
|
|
74
|
+
| `src/room-context.ts` | PR #1458 (created there, 2026-10-26) | PR #1458 |
|
|
74
75
|
|
|
75
76
|
To review one:
|
|
76
77
|
|
package/dist/bridge.d.ts
CHANGED
|
@@ -9,7 +9,13 @@
|
|
|
9
9
|
* Those are Claude-shaped; Grok's gate is the pre_tool_use hook and arrives with
|
|
10
10
|
* the tools-on posture.
|
|
11
11
|
*/
|
|
12
|
+
/** `RoomSession` is declared ONCE in this package, by grok-session.ts. The Claude
|
|
13
|
+
* bridge declares its own in its bridge.ts; that declaration was NOT copied.
|
|
14
|
+
* Type-only, so this cannot create a runtime import cycle. */
|
|
15
|
+
import { type ToolSpanSink } from "@agentvault/agentvault";
|
|
12
16
|
import type { RoomSession } from "./grok-session.js";
|
|
17
|
+
import { type RoomContextLimits } from "./room-context.js";
|
|
18
|
+
import { type TerminalVerdict } from "./service/self-uninstall.js";
|
|
13
19
|
export interface RoomMessage {
|
|
14
20
|
roomId: string;
|
|
15
21
|
senderName: string;
|
|
@@ -24,6 +30,9 @@ export interface RoomMessage {
|
|
|
24
30
|
* payloads / tests → treated as "not an agent" is NOT assumed: replyExpected is
|
|
25
31
|
* set only when we affirmatively know the sender is a human (=== false). */
|
|
26
32
|
senderIsAgent?: boolean;
|
|
33
|
+
/** ISO send time from the emit (`data.created_at`). Used to stamp a message
|
|
34
|
+
* held as room context; receipt time stands in when absent. */
|
|
35
|
+
timestamp?: string;
|
|
27
36
|
}
|
|
28
37
|
/** Metadata SecureChannel attaches to a 1:1 `message` event. `roomId` is set only
|
|
29
38
|
* when the `message` actually originated in a room (handled by room_message), so
|
|
@@ -52,6 +61,15 @@ export interface RoomChannel {
|
|
|
52
61
|
roomId: string;
|
|
53
62
|
name?: string;
|
|
54
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;
|
|
55
73
|
on(ev: "message", cb: (text: string, metadata: MessageMeta) => void): unknown;
|
|
56
74
|
on(ev: "room_hushed", cb: (e: RoomHushed) => void): unknown;
|
|
57
75
|
on(ev: "error", cb: (err: unknown) => void): unknown;
|
|
@@ -88,6 +106,9 @@ export type BridgeTarget = {
|
|
|
88
106
|
export interface ReplyChannel {
|
|
89
107
|
sendToRoom(roomId: string, text: string): Promise<void>;
|
|
90
108
|
send(text: string): Promise<void>;
|
|
109
|
+
/** SecureChannel's TelemetryReporter (device JWT, buffered). Optional so
|
|
110
|
+
* fixtures and a channel without telemetry keep working. */
|
|
111
|
+
readonly telemetry?: ToolSpanSink | null;
|
|
91
112
|
/** #1418 — SecureChannel: run `fn` as `conversationId`'s turn, so an
|
|
92
113
|
* untargeted send inside it reaches that conversation's person only. */
|
|
93
114
|
runForConversation?<T>(conversationId: string | undefined, fn: () => Promise<T>, opts?: {
|
|
@@ -125,6 +146,7 @@ export declare class ActiveTarget {
|
|
|
125
146
|
export interface LifecycleChannel {
|
|
126
147
|
on(ev: "auth_failed", cb: (e: {
|
|
127
148
|
reason: string;
|
|
149
|
+
deviceGone?: boolean;
|
|
128
150
|
}) => void): unknown;
|
|
129
151
|
on(ev: "session_replaced", cb: (e: {
|
|
130
152
|
code?: number;
|
|
@@ -157,7 +179,7 @@ export declare function attachLifecycle(channel: LifecycleChannel, opts?: {
|
|
|
157
179
|
* well would put the same rule in two files, and the two would eventually
|
|
158
180
|
* disagree — which is how `session_replaced` (device still alive) would end
|
|
159
181
|
* up removing a healthy install. */
|
|
160
|
-
selfUninstall?: (
|
|
182
|
+
selfUninstall?: (verdict: TerminalVerdict, env: NodeJS.ProcessEnv) => boolean;
|
|
161
183
|
}): void;
|
|
162
184
|
/**
|
|
163
185
|
* How a ROOM turn is announced to the model (#366 / #499 Facet A).
|
|
@@ -179,6 +201,20 @@ export declare function attachLifecycle(channel: LifecycleChannel, opts?: {
|
|
|
179
201
|
* unmarked turn already reads as a DM, which is what the model assumes.
|
|
180
202
|
*/
|
|
181
203
|
export declare function roomTurnPrefix(roomId: string, senderName: string, roomName?: string): string;
|
|
204
|
+
/**
|
|
205
|
+
* What a held (unaddressed) room message contributes as context: the CAPTION
|
|
206
|
+
* the sender typed, never the folded file. SecureChannel folds an attachment's
|
|
207
|
+
* contents in FRONT of the caption, so holding `plaintext` and cutting it to
|
|
208
|
+
* the per-message limit kept the file and dropped what was actually said — and
|
|
209
|
+
* carried a file nobody asked this agent about into its next turn (PR #1458).
|
|
210
|
+
* Emitters older than #1223 send no caption; their plaintext is all there is.
|
|
211
|
+
*/
|
|
212
|
+
export declare function heldText(e: {
|
|
213
|
+
plaintext: string;
|
|
214
|
+
caption?: string;
|
|
215
|
+
}): string;
|
|
216
|
+
/** The room as the model sees it: its name when known, else a short id. */
|
|
217
|
+
export declare function roomLabel(roomId: string, roomName?: string): string;
|
|
182
218
|
/**
|
|
183
219
|
* Does this agent owe a reply to this room message? (#1107)
|
|
184
220
|
*
|
|
@@ -190,8 +226,9 @@ export declare function roomTurnPrefix(roomId: string, senderName: string, roomN
|
|
|
190
226
|
* in the half most likely to be read as "the protocol doesn't work".
|
|
191
227
|
*
|
|
192
228
|
* Now it defers to the ONE shared implementation exported by
|
|
193
|
-
* `@agentvault/agentvault`.
|
|
194
|
-
*
|
|
229
|
+
* `@agentvault/agentvault`. A message this returns false for is NOT pushed into
|
|
230
|
+
* the session (2026-10-26): it is held as room context and delivered with the
|
|
231
|
+
* next message in that room that this agent does owe — see room-context.ts.
|
|
195
232
|
*/
|
|
196
233
|
export declare function _makeOwesReply(agentName: string | undefined, channel: {
|
|
197
234
|
ownDisplayName?: string;
|
|
@@ -205,5 +242,7 @@ export declare function wireBridge(channel: RoomChannel, session: RoomSession, t
|
|
|
205
242
|
agentName?: string;
|
|
206
243
|
roomFilter?: string;
|
|
207
244
|
log?: (msg: string) => void;
|
|
245
|
+
/** Test-only: override the room-context bounds (see room-context.ts). */
|
|
246
|
+
roomContextLimits?: Partial<RoomContextLimits>;
|
|
208
247
|
}): void;
|
|
209
248
|
//# 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, sayTool: string): string;
|
|
11
|
+
//# sourceMappingURL=identity-prompt.d.ts.map
|