@agentvault/claude-bridge 0.1.1 → 0.2.0
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 +27 -0
- package/dist/index.js +22025 -6220
- package/dist/session.d.ts +17 -1
- package/package.json +3 -2
package/dist/bridge.d.ts
CHANGED
|
@@ -5,12 +5,39 @@ export interface RoomMessage {
|
|
|
5
5
|
}
|
|
6
6
|
export interface RoomChannel {
|
|
7
7
|
on(ev: "room_message", cb: (e: RoomMessage) => void): unknown;
|
|
8
|
+
on(ev: "error", cb: (err: unknown) => void): unknown;
|
|
8
9
|
sendToRoom(roomId: string, text: string): Promise<void>;
|
|
9
10
|
}
|
|
10
11
|
export interface RoomSession {
|
|
11
12
|
push(text: string): void;
|
|
12
13
|
onActiveRoom(roomId: string): void;
|
|
13
14
|
}
|
|
15
|
+
export interface LifecycleChannel {
|
|
16
|
+
on(ev: "auth_failed", cb: (e: {
|
|
17
|
+
reason: string;
|
|
18
|
+
}) => void): unknown;
|
|
19
|
+
on(ev: "session_replaced", cb: (e: {
|
|
20
|
+
code?: number;
|
|
21
|
+
}) => void): unknown;
|
|
22
|
+
on(ev: "error", cb: (err: unknown) => void): unknown;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Wire terminal lifecycle events — conditions SecureChannel can't recover from
|
|
26
|
+
* by reconnecting, after which the daemon would otherwise idle forever. We log
|
|
27
|
+
* clearly and exit. Three terminal signals:
|
|
28
|
+
* - `auth_failed` — device revoked / JWT expired (needs re-enroll).
|
|
29
|
+
* - `session_replaced` — another session took over (close code 4000/4001).
|
|
30
|
+
* - `error` matching "Reconnect loop detected" — the one terminal error the
|
|
31
|
+
* channel emits AFTER it has given up reconnecting.
|
|
32
|
+
* All OTHER `error` events are transient (handled + survived by wireBridge's
|
|
33
|
+
* own `error` listener, #387) and recover via the built-in reconnect — so we
|
|
34
|
+
* deliberately do NOT exit on the generic `error`/`"error"`-state, which would
|
|
35
|
+
* regress that survival behavior.
|
|
36
|
+
*/
|
|
37
|
+
export declare function attachLifecycle(channel: LifecycleChannel, opts?: {
|
|
38
|
+
log?: (msg: string) => void;
|
|
39
|
+
onTerminal?: (reason: string) => void;
|
|
40
|
+
}): void;
|
|
14
41
|
export declare function wireBridge(channel: RoomChannel, session: RoomSession, opts?: {
|
|
15
42
|
roomFilter?: string;
|
|
16
43
|
log?: (msg: string) => void;
|