@annals/bridge-protocol 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.
- package/README.md +49 -0
- package/package.json +11 -2
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @annals/bridge-protocol
|
|
2
|
+
|
|
3
|
+
Type definitions and constants for [Bridge Protocol v1](https://github.com/annals-ai/agent-bridge) — the WebSocket protocol between agent-bridge CLI and the Bridge Worker.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @annals/bridge-protocol
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { Register, Message, Chunk, Done, BridgeError } from '@annals/bridge-protocol';
|
|
15
|
+
import { BRIDGE_PROTOCOL_VERSION, BridgeErrorCode } from '@annals/bridge-protocol';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Protocol Messages
|
|
19
|
+
|
|
20
|
+
### CLI → Worker (upstream)
|
|
21
|
+
|
|
22
|
+
| Message | Description |
|
|
23
|
+
|---------|-------------|
|
|
24
|
+
| `register` | First message after WebSocket connect, authenticates the agent |
|
|
25
|
+
| `chunk` | Streaming text delta from agent |
|
|
26
|
+
| `done` | Agent finished responding |
|
|
27
|
+
| `error` | Agent encountered an error |
|
|
28
|
+
| `heartbeat` | Periodic keepalive (30s interval) |
|
|
29
|
+
|
|
30
|
+
### Worker → CLI (downstream)
|
|
31
|
+
|
|
32
|
+
| Message | Description |
|
|
33
|
+
|---------|-------------|
|
|
34
|
+
| `registered` | Registration result (`ok` or `error`) |
|
|
35
|
+
| `message` | User message relayed from platform |
|
|
36
|
+
| `cancel` | Cancel an in-progress request |
|
|
37
|
+
|
|
38
|
+
### Error Codes
|
|
39
|
+
|
|
40
|
+
`timeout` · `adapter_crash` · `agent_busy` · `auth_failed` · `agent_offline` · `invalid_message` · `session_not_found` · `rate_limited` · `internal_error`
|
|
41
|
+
|
|
42
|
+
## Related
|
|
43
|
+
|
|
44
|
+
- [`@annals/agent-bridge`](https://www.npmjs.com/package/@annals/agent-bridge) — CLI tool
|
|
45
|
+
- [GitHub repo](https://github.com/annals-ai/agent-bridge) — full monorepo
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
[MIT](https://github.com/annals-ai/agent-bridge/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@annals/bridge-protocol",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Bridge Protocol type definitions for agent-bridge",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,5 +19,14 @@
|
|
|
19
19
|
"typescript": "^5.7.0"
|
|
20
20
|
},
|
|
21
21
|
"files": ["dist"],
|
|
22
|
-
"license": "MIT"
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/annals-ai/agent-bridge.git",
|
|
26
|
+
"directory": "packages/protocol"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/annals-ai/agent-bridge#readme",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/annals-ai/agent-bridge/issues"
|
|
31
|
+
}
|
|
23
32
|
}
|