@annals/bridge-protocol 0.1.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.
@@ -0,0 +1,14 @@
1
+ /** Standard Bridge Protocol error codes */
2
+ export declare const BridgeErrorCode: {
3
+ readonly TIMEOUT: "timeout";
4
+ readonly ADAPTER_CRASH: "adapter_crash";
5
+ readonly AGENT_BUSY: "agent_busy";
6
+ readonly AUTH_FAILED: "auth_failed";
7
+ readonly AGENT_OFFLINE: "agent_offline";
8
+ readonly INVALID_MESSAGE: "invalid_message";
9
+ readonly SESSION_NOT_FOUND: "session_not_found";
10
+ readonly RATE_LIMITED: "rate_limited";
11
+ readonly INTERNAL_ERROR: "internal_error";
12
+ };
13
+ export type BridgeErrorCode = (typeof BridgeErrorCode)[keyof typeof BridgeErrorCode];
14
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,eAAO,MAAM,eAAe;;;;;;;;;;CAUlB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
package/dist/errors.js ADDED
@@ -0,0 +1,13 @@
1
+ /** Standard Bridge Protocol error codes */
2
+ export const BridgeErrorCode = {
3
+ TIMEOUT: 'timeout',
4
+ ADAPTER_CRASH: 'adapter_crash',
5
+ AGENT_BUSY: 'agent_busy',
6
+ AUTH_FAILED: 'auth_failed',
7
+ AGENT_OFFLINE: 'agent_offline',
8
+ INVALID_MESSAGE: 'invalid_message',
9
+ SESSION_NOT_FOUND: 'session_not_found',
10
+ RATE_LIMITED: 'rate_limited',
11
+ INTERNAL_ERROR: 'internal_error',
12
+ };
13
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;IAC9B,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,aAAa;IAC1B,aAAa,EAAE,eAAe;IAC9B,eAAe,EAAE,iBAAiB;IAClC,iBAAiB,EAAE,mBAAmB;IACtC,YAAY,EAAE,cAAc;IAC5B,cAAc,EAAE,gBAAgB;CACxB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './messages.js';
2
+ export * from './errors.js';
3
+ export { BRIDGE_PROTOCOL_VERSION } from './version.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './messages.js';
2
+ export * from './errors.js';
3
+ export { BRIDGE_PROTOCOL_VERSION } from './version.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,91 @@
1
+ import type { BridgeErrorCode } from './errors.js';
2
+ /** Sent immediately after WebSocket connection to authenticate */
3
+ export interface Register {
4
+ type: 'register';
5
+ agent_id: string;
6
+ token: string;
7
+ bridge_version: string;
8
+ agent_type: 'openclaw' | 'claude' | 'codex' | 'gemini' | string;
9
+ capabilities: string[];
10
+ }
11
+ /** Incremental text chunk from agent */
12
+ export interface Chunk {
13
+ type: 'chunk';
14
+ session_id: string;
15
+ request_id: string;
16
+ delta: string;
17
+ }
18
+ /** Agent finished responding */
19
+ export interface Done {
20
+ type: 'done';
21
+ session_id: string;
22
+ request_id: string;
23
+ }
24
+ /** Agent encountered an error */
25
+ export interface BridgeError {
26
+ type: 'error';
27
+ session_id: string;
28
+ request_id: string;
29
+ code: BridgeErrorCode | string;
30
+ message: string;
31
+ }
32
+ /** Periodic heartbeat from bridge CLI */
33
+ export interface Heartbeat {
34
+ type: 'heartbeat';
35
+ active_sessions: number;
36
+ uptime_ms: number;
37
+ }
38
+ /** All messages sent from Bridge CLI to Worker */
39
+ export type BridgeToWorkerMessage = Register | Chunk | Done | BridgeError | Heartbeat;
40
+ /** Registration acknowledgment */
41
+ export interface Registered {
42
+ type: 'registered';
43
+ status: 'ok' | 'error';
44
+ error?: string;
45
+ }
46
+ /** User message forwarded to agent */
47
+ export interface Message {
48
+ type: 'message';
49
+ session_id: string;
50
+ request_id: string;
51
+ content: string;
52
+ attachments: Attachment[];
53
+ }
54
+ /** Cancel an in-progress request */
55
+ export interface Cancel {
56
+ type: 'cancel';
57
+ session_id: string;
58
+ request_id: string;
59
+ }
60
+ /** All messages sent from Worker to Bridge CLI */
61
+ export type WorkerToBridgeMessage = Registered | Message | Cancel;
62
+ export interface Attachment {
63
+ name: string;
64
+ url: string;
65
+ type: string;
66
+ }
67
+ /** Any Bridge Protocol message */
68
+ export type BridgeMessage = BridgeToWorkerMessage | WorkerToBridgeMessage;
69
+ /** POST /api/relay request body */
70
+ export interface RelayRequest {
71
+ agent_id: string;
72
+ session_id: string;
73
+ request_id: string;
74
+ content: string;
75
+ attachments?: Attachment[];
76
+ }
77
+ /** SSE event from relay endpoint */
78
+ export interface RelayChunkEvent {
79
+ type: 'chunk';
80
+ delta: string;
81
+ }
82
+ export interface RelayDoneEvent {
83
+ type: 'done';
84
+ }
85
+ export interface RelayErrorEvent {
86
+ type: 'error';
87
+ code: string;
88
+ message: string;
89
+ }
90
+ export type RelayEvent = RelayChunkEvent | RelayDoneEvent | RelayErrorEvent;
91
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAMnD,kEAAkE;AAClE,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAChE,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,wCAAwC;AACxC,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gCAAgC;AAChC,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,eAAe,GAAG,MAAM,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,yCAAyC;AACzC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,kDAAkD;AAClD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,KAAK,GAAG,IAAI,GAAG,WAAW,GAAG,SAAS,CAAC;AAMtF,kCAAkC;AAClC,MAAM,W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M,MAAM,UAAU,GAAG,eAAe,GAAG,cAAc,GAAG,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** Bridge Protocol version */
2
+ export declare const BRIDGE_PROTOCOL_VERSION = 1;
3
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Bridge Protocol version */
2
+ export const BRIDGE_PROTOCOL_VERSION = 1;
3
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@annals/bridge-protocol",
3
+ "version": "0.1.0",
4
+ "description": "Bridge Protocol type definitions for agent-bridge",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "dev": "tsc --watch"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5.7.0"
20
+ },
21
+ "files": ["dist"],
22
+ "license": "MIT"
23
+ }