@agentvault/claude-bridge 0.1.0 → 0.1.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.
@@ -0,0 +1,19 @@
1
+ export interface RoomMessage {
2
+ roomId: string;
3
+ senderName: string;
4
+ plaintext: string;
5
+ }
6
+ export interface RoomChannel {
7
+ on(ev: "room_message", cb: (e: RoomMessage) => void): unknown;
8
+ on(ev: "error", cb: (err: unknown) => void): unknown;
9
+ sendToRoom(roomId: string, text: string): Promise<void>;
10
+ }
11
+ export interface RoomSession {
12
+ push(text: string): void;
13
+ onActiveRoom(roomId: string): void;
14
+ }
15
+ export declare function wireBridge(channel: RoomChannel, session: RoomSession, opts?: {
16
+ roomFilter?: string;
17
+ log?: (msg: string) => void;
18
+ }): void;
19
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1,11 @@
1
+ export interface BridgeConfig {
2
+ inviteToken: string;
3
+ dataDir: string;
4
+ apiUrl: string;
5
+ agentName: string;
6
+ roomFilter?: string;
7
+ model?: string;
8
+ systemPrompt?: string;
9
+ }
10
+ export declare function loadConfig(env: NodeJS.ProcessEnv, argv?: string[]): BridgeConfig;
11
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -115730,6 +115730,10 @@ var PersistentClaudeSession = class {
115730
115730
  function wireBridge(channel, session, opts = {}) {
115731
115731
  const log = opts.log ?? (() => {
115732
115732
  });
115733
+ channel.on("error", (err) => {
115734
+ const msg = err instanceof Error ? err.message : String(err);
115735
+ log(`channel error (auto-reconnecting): ${msg}`);
115736
+ });
115733
115737
  channel.on("room_message", (e7) => {
115734
115738
  if (opts.roomFilter && e7.roomId !== opts.roomFilter) return;
115735
115739
  log(`inbound from ${e7.senderName} in ${e7.roomId.slice(0, 8)}`);
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Minimal local mirror of the SDK's SDKUserMessage shape.
3
+ *
4
+ * The installed SDK declares:
5
+ * type SDKUserMessage = {
6
+ * type: 'user';
7
+ * message: MessageParam; // { role: 'user'|'assistant'; content: string | ContentBlockParam[] }
8
+ * parent_tool_use_id: string | null;
9
+ * isSynthetic?: boolean;
10
+ * session_id?: string; // optional in the installed version (brief baseline had it required)
11
+ * // ... additional optional fields
12
+ * }
13
+ *
14
+ * Deviations from the brief baseline:
15
+ * - `message` is `MessageParam` not `{ role: "user"; content: string }` —
16
+ * but string content is valid per MessageParam so the shape is compatible.
17
+ * - `session_id` is optional (not required).
18
+ */
19
+ export type SDKUserMessage = {
20
+ type: "user";
21
+ message: {
22
+ role: "user";
23
+ content: string;
24
+ };
25
+ parent_tool_use_id: string | null;
26
+ session_id?: string;
27
+ };
28
+ export type QueryFn = (args: {
29
+ prompt: AsyncIterable<SDKUserMessage>;
30
+ options: Record<string, unknown>;
31
+ }) => AsyncIterable<{
32
+ type: string;
33
+ [k: string]: unknown;
34
+ }>;
35
+ export interface SessionOpts {
36
+ onReply: (text: string) => void | Promise<void>;
37
+ model?: string;
38
+ systemPrompt?: string;
39
+ queryImpl?: QueryFn;
40
+ }
41
+ export declare class PersistentClaudeSession {
42
+ private opts;
43
+ private waiting;
44
+ private pending;
45
+ constructor(opts: SessionOpts);
46
+ push(text: string): void;
47
+ private input;
48
+ start(): Promise<void>;
49
+ }
50
+ //# sourceMappingURL=session.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/claude-bridge",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "AgentVault Claude Room Bridge — daemon for bridging AI agents into secure E2E-encrypted AgentVault rooms.",
6
6
  "main": "dist/index.js",
@@ -26,10 +26,11 @@
26
26
  "prepublishOnly": "node build.mjs"
27
27
  },
28
28
  "dependencies": {
29
- "@agentvault/agentvault": "file:../plugin",
30
- "@anthropic-ai/claude-agent-sdk": "^0.2.114"
29
+ "@anthropic-ai/claude-agent-sdk": "^0.2.114",
30
+ "ws": "^8.16.0"
31
31
  },
32
32
  "devDependencies": {
33
+ "@agentvault/agentvault": "file:../plugin",
33
34
  "esbuild": "^0.27.3",
34
35
  "typescript": "^5.4.0",
35
36
  "vitest": "^2.0.0",