@hasna/bridge 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.
- package/LICENSE +17 -0
- package/README.md +94 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +6717 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4448 -0
- package/dist/lib/agents.d.ts +13 -0
- package/dist/lib/agents.d.ts.map +1 -0
- package/dist/lib/config.d.ts +11 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/doctor.d.ts +3 -0
- package/dist/lib/doctor.d.ts.map +1 -0
- package/dist/lib/paths.d.ts +4 -0
- package/dist/lib/paths.d.ts.map +1 -0
- package/dist/lib/router.d.ts +11 -0
- package/dist/lib/router.d.ts.map +1 -0
- package/dist/lib/state.d.ts +8 -0
- package/dist/lib/state.d.ts.map +1 -0
- package/dist/lib/telegram.d.ts +28 -0
- package/dist/lib/telegram.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +4356 -0
- package/dist/types.d.ts +110 -0
- package/dist/types.d.ts.map +1 -0
- package/docs/architecture.md +47 -0
- package/examples/bridge.config.example.json +49 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 Hasna
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# bridge
|
|
2
|
+
|
|
3
|
+
`bridge` connects local coding agents to external messaging channels. The local
|
|
4
|
+
folder is `open-bridge`; the public package is `@hasna/bridge`; the CLI is
|
|
5
|
+
`bridge`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
bun install -g @hasna/bridge
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
bridge init
|
|
17
|
+
bridge doctor
|
|
18
|
+
bridge channels add-telegram telegram-main --token-env TELEGRAM_BOT_TOKEN --allowed-chat-ids 123456789
|
|
19
|
+
bridge profiles add codewith-main --agent-kind codewith --auth-profile account001 --cwd /Users/hasna
|
|
20
|
+
bridge agents add codewith --kind codewith --profile codewith-main
|
|
21
|
+
bridge routes add telegram-codewith --from telegram-main --to codewith --chat-ids 123456789
|
|
22
|
+
bridge serve
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Useful inspection commands:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
bridge config path
|
|
29
|
+
bridge config show
|
|
30
|
+
bridge channels list
|
|
31
|
+
bridge profiles list
|
|
32
|
+
bridge agents list
|
|
33
|
+
bridge routes list
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Direct operations:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
bridge send telegram-main 123456789 "hello"
|
|
40
|
+
bridge ask codewith "summarize this repo"
|
|
41
|
+
bridge route-message --channel telegram-main --chat-id 123456789 --text "status" --json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Profiles
|
|
45
|
+
|
|
46
|
+
Profiles let one bridge process route messages to multiple accounts without
|
|
47
|
+
changing global agent login state.
|
|
48
|
+
|
|
49
|
+
Codewith:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
bridge profiles add cw-account001 --agent-kind codewith --auth-profile account001 --cwd /repo
|
|
53
|
+
bridge agents add codewith-main --kind codewith --profile cw-account001
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Claude:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
bridge profiles add claude-account001 --agent-kind claude --home ~/.hasna/accounts/profiles/claude/account001
|
|
60
|
+
bridge agents add claude-main --kind claude --profile claude-account001
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
AIcopilot:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
bridge profiles add aicopilot-main --agent-kind aicopilot --cwd /repo
|
|
67
|
+
bridge agents add aicopilot-main --kind aicopilot --profile aicopilot-main
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## MCP
|
|
71
|
+
|
|
72
|
+
`bridge-mcp` exposes:
|
|
73
|
+
|
|
74
|
+
- `bridge_status`
|
|
75
|
+
- `bridge_config`
|
|
76
|
+
- `bridge_route_message`
|
|
77
|
+
|
|
78
|
+
## State
|
|
79
|
+
|
|
80
|
+
Default config path:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
~/.hasna/bridge/config.json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Override with `BRIDGE_HOME` or `BRIDGE_CONFIG`.
|
|
87
|
+
|
|
88
|
+
`bridge` stores configuration and runtime state with private file permissions.
|
|
89
|
+
Telegram bot tokens should stay in environment variables; config stores the env
|
|
90
|
+
var name, not the token value. Telegram channels fail closed unless
|
|
91
|
+
`allowedChatIds` are set or `allowAllChats` is explicitly enabled.
|
|
92
|
+
Channel-level `allowedChatIds` are enforced before route matching, and long-poll
|
|
93
|
+
offsets are persisted in `~/.hasna/bridge/state.json` so restarts do not replay
|
|
94
|
+
already-seen updates.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|