@hasna/bridge 0.1.1 → 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 +81 -0
- package/dist/cli/index.js +831 -81
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +726 -59
- package/dist/lib/daemon.d.ts +123 -0
- package/dist/lib/daemon.d.ts.map +1 -0
- package/dist/lib/doctor.d.ts.map +1 -1
- package/dist/lib/telegram.d.ts +6 -0
- package/dist/lib/telegram.d.ts.map +1 -1
- package/dist/mcp/index.js +273 -35
- package/docs/architecture.md +31 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ bridge profiles add codewith-main --agent-kind codewith --auth-profile account00
|
|
|
20
20
|
bridge agents add codewith --kind codewith --profile codewith-main
|
|
21
21
|
bridge routes add telegram-codewith --from telegram-main --to codewith --chat-ids 123456789
|
|
22
22
|
bridge serve
|
|
23
|
+
bridge daemon start
|
|
23
24
|
```
|
|
24
25
|
|
|
25
26
|
Useful inspection commands:
|
|
@@ -41,6 +42,48 @@ bridge ask codewith "summarize this repo"
|
|
|
41
42
|
bridge route-message --channel telegram-main --chat-id 123456789 --text "status" --json
|
|
42
43
|
```
|
|
43
44
|
|
|
45
|
+
Daemon operations:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
bridge daemon start
|
|
49
|
+
bridge daemon status
|
|
50
|
+
bridge daemon logs --lines 100
|
|
51
|
+
bridge daemon restart
|
|
52
|
+
bridge daemon stop
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`bridge daemon start` uses the process supervisor by default. It starts
|
|
56
|
+
`bridge serve` in the background, inherits the current environment, and writes
|
|
57
|
+
private metadata and logs under `~/.hasna/bridge/daemon`.
|
|
58
|
+
|
|
59
|
+
For login-started services:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
bridge daemon install --supervisor auto
|
|
63
|
+
bridge daemon start --supervisor auto
|
|
64
|
+
bridge daemon stop --supervisor auto
|
|
65
|
+
bridge daemon uninstall --supervisor auto
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`install` writes a user `launchd` file on macOS or a user `systemd` file on
|
|
69
|
+
Linux. Telegram token values are not written to those files. Make token
|
|
70
|
+
environment variables available to the user service manager before starting an
|
|
71
|
+
installed daemon.
|
|
72
|
+
|
|
73
|
+
macOS:
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
launchctl setenv TELEGRAM_BOT_TOKEN "$TELEGRAM_BOT_TOKEN"
|
|
77
|
+
bridge daemon start --supervisor launchd
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Linux:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
systemctl --user import-environment TELEGRAM_BOT_TOKEN
|
|
84
|
+
bridge daemon start --supervisor systemd
|
|
85
|
+
```
|
|
86
|
+
|
|
44
87
|
## Profiles
|
|
45
88
|
|
|
46
89
|
Profiles let one bridge process route messages to multiple accounts without
|
|
@@ -93,3 +136,41 @@ Disabled channels do not match or deliver routes. Channel-level `allowedChatIds`
|
|
|
93
136
|
are enforced before route matching, and long-poll offsets are persisted in
|
|
94
137
|
`~/.hasna/bridge/state.json` so restarts do not replay already-seen updates.
|
|
95
138
|
MCP config inspection redacts profile and agent environment values.
|
|
139
|
+
|
|
140
|
+
Daemon metadata and logs are private as well. Logs can contain prompts and agent
|
|
141
|
+
responses, so treat them as sensitive.
|
|
142
|
+
|
|
143
|
+
## Telegram Smoke Test
|
|
144
|
+
|
|
145
|
+
Create a bot with BotFather and set the token only in your shell:
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
export TELEGRAM_BOT_TOKEN='123456:...'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Send any message to the bot from the Telegram account or group you want to use,
|
|
152
|
+
then find the chat id:
|
|
153
|
+
|
|
154
|
+
```sh
|
|
155
|
+
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Configure one allowed chat and a test shell agent:
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
bridge init
|
|
162
|
+
bridge channels add-telegram telegram-main --token-env TELEGRAM_BOT_TOKEN --allowed-chat-ids CHAT_ID --default-chat-id CHAT_ID
|
|
163
|
+
bridge profiles add shell-echo --agent-kind shell --command printf --arg 'bridge ok: {prompt}'
|
|
164
|
+
bridge agents add echo --kind shell --profile shell-echo
|
|
165
|
+
bridge routes add telegram-echo --from telegram-main --to echo --chat-ids CHAT_ID
|
|
166
|
+
bridge doctor
|
|
167
|
+
bridge daemon start
|
|
168
|
+
bridge daemon status
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Send a Telegram message to the bot. It should reply with `bridge ok: ...`.
|
|
172
|
+
Inspect logs with `bridge daemon logs`, then stop it with `bridge daemon stop`.
|
|
173
|
+
|
|
174
|
+
For the first live test, use the default process supervisor above because it
|
|
175
|
+
inherits `TELEGRAM_BOT_TOKEN` from your shell. Move to launchd/systemd after that
|
|
176
|
+
works.
|