handsoff 0.0.1-beta.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/README.md ADDED
@@ -0,0 +1,217 @@
1
+ # Handsoff
2
+
3
+ > **Hands off your desk, hand off control to your phone.**
4
+ >
5
+ > *Leave your desk, not your code.*
6
+
7
+ Handsoff is a local gateway that bridges AI programming assistants (like Claude Code) with messaging platforms (like Telegram, Feishu). It captures agent events in real-time and forwards them to your phone, letting you monitor and control your AI assistant from anywhere.
8
+
9
+ ---
10
+
11
+ ## The Problem
12
+
13
+ You're running Claude Code on your workstation. It asks for permission to execute a tool. You're away from your desk—maybe grabbing coffee, in a meeting, or simply stepping out. The session sits there waiting. Time ticks away.
14
+
15
+ ## The Solution
16
+
17
+ **Handsoff** keeps you connected to your coding sessions wherever you are:
18
+
19
+ - **Monitor** — Get notified when Claude starts or finishes tasks
20
+ - **Control** — Approve or deny tool execution requests right from your phone
21
+ - **Stay informed** — Receive execution summaries with token usage and results
22
+
23
+ No more tethering yourself to your desk. Your code doesn't stop when you step away.
24
+
25
+ ---
26
+
27
+ ## How it works
28
+
29
+ ### Claude Code + Telegram integration
30
+
31
+ The core workflow bridges Claude Code with Telegram:
32
+
33
+ 1. **Session Monitoring** — Handsoff listens for Claude Code session start/end events and notifies you on Telegram
34
+ 2. **Permission Control** — When Claude requests to execute a tool, you receive a permission prompt on Telegram with **Allow/Deny** buttons
35
+ 3. **Real-time Decisions** — Click the button in Telegram to grant or deny the tool execution
36
+ 4. **Task Completion** — Receive final notifications when tasks complete, including execution duration, token usage, and results
37
+
38
+ <p align="center">
39
+ <img src="assets/image_01.jpg" width="45%" alt="Claude + Telegram workflow" />
40
+ &nbsp;&nbsp;
41
+ <img src="assets/image_02.jpg" width="45%" alt="Permission request and task completion on Telegram" />
42
+ </p>
43
+
44
+ ---
45
+
46
+ ## Architecture
47
+
48
+ ```
49
+ +-------------------------+
50
+ | CLI Layer |
51
+ | init | attach | gateway |
52
+ +-----------+-------------+
53
+ |
54
+ v
55
+ +-------------------------+
56
+ | Agent Adapter Layer |
57
+ | ClaudeHookAdapter |
58
+ +-----------+-------------+
59
+ |
60
+ v
61
+ +-------------------------+
62
+ | Gateway Layer |
63
+ | SessionManager |
64
+ | EventBus | Publisher |
65
+ | PermissionService |
66
+ +-----------+-------------+
67
+ |
68
+ v
69
+ +-------------------------+
70
+ | Channel Adapter Layer |
71
+ | Telegram | Feishu |
72
+ +-------------------------+
73
+ ```
74
+
75
+ - **CLI Layer**: User commands (init, attach, gateway, logs, status)
76
+ - **Agent Adapter Layer**: Translates agent events to unified format
77
+ - **Gateway Layer**: Core hub managing sessions, events, permissions
78
+ - **Channel Adapter Layer**: Sends notifications to messaging platforms
79
+
80
+ ---
81
+
82
+ ## Supported platforms
83
+
84
+ - CLI agent support: `claude`
85
+ - Chat channel support: `Telegram`, `Feishu`
86
+
87
+ ---
88
+
89
+ ## Future plan
90
+
91
+ - [ ] Add more agent adapters
92
+ - [ ] Add more channel adapters
93
+
94
+ ---
95
+
96
+ ## Installation
97
+
98
+ ```bash
99
+ npm install -g handsoff
100
+ ```
101
+
102
+ Or run without installing:
103
+
104
+ ```bash
105
+ npx handsoff init
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Quick start
111
+
112
+ 1. Initialize configuration:
113
+
114
+ ```bash
115
+ handsoff init
116
+ ```
117
+
118
+ 2. Start the gateway daemon:
119
+
120
+ ```bash
121
+ handsoff gateway start
122
+ ```
123
+
124
+ 3. Attach an agent:
125
+
126
+ ```bash
127
+ handsoff attach claude
128
+ ```
129
+
130
+ 4. Check gateway status:
131
+
132
+ ```bash
133
+ handsoff gateway status
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Main commands
139
+
140
+ - `handsoff init` — initialize or update `~/.handsoff/config.toml`
141
+ - `handsoff gateway start` — start or restart the gateway daemon
142
+ - `handsoff gateway stop` — stop the gateway daemon
143
+ - `handsoff gateway restart` — restart the gateway daemon
144
+ - `handsoff gateway status` — show gateway health and active sessions
145
+ - `handsoff attach <agent-type>` — attach a supported agent to the gateway
146
+ - `handsoff status` — view CLI status
147
+ - `handsoff logs` — inspect logs
148
+ - `handsoff stop` — stop the daemon
149
+
150
+ ---
151
+
152
+ ## Configuration
153
+
154
+ Most configuration is handled by `handsoff init` interactive wizard, which guides you through:
155
+
156
+ 1. Setting up your Claude Code hook server port
157
+ 2. Configuring Telegram bot credentials
158
+ 3. Testing channel connectivity
159
+
160
+ For manual setup or advanced options, edit `~/.handsoff/config.toml`. Key sections:
161
+
162
+ **General settings:**
163
+ - `default_agent` — default agent to use (currently `claude`)
164
+ - `hook_server_port` — local port for receiving agent hooks (default `9876`)
165
+ - `log_level` — logging verbosity (`debug`, `info`, `warn`, `error`)
166
+
167
+ **Telegram channel:**
168
+ - `bot_token` — your Telegram bot token from BotFather
169
+ - `allowed_users` — list of Telegram user IDs allowed to interact with the bot (e.g., `[123456789, 987654321]`)
170
+ - `notify_types` — which event types to forward (`permission_request`, `finished`, `session_start`, `error`, etc.)
171
+
172
+ **Claude agent:**
173
+ - `adapter` — integration method (always `hooks`)
174
+ - `binary` — Claude Code binary name
175
+ - `permission_mode` — how to handle tool permissions
176
+
177
+ Example `~/.handsoff/config.toml`:
178
+
179
+ ```toml
180
+ [general]
181
+ default_agent = "claude"
182
+ log_level = "info"
183
+ hook_server_port = 9876
184
+
185
+ [channel.telegram]
186
+ enabled = true
187
+ bot_token = "YOUR_BOT_TOKEN"
188
+ allowed_users = ["123456789"]
189
+ notify_types = ["permission_request", "finished", "session_start", "error"]
190
+
191
+ [agent.claude]
192
+ adapter = "hooks"
193
+ binary = "claude"
194
+ work_dir = ""
195
+ model = ""
196
+ permission_mode = ""
197
+ ```
198
+
199
+ ---
200
+
201
+ ## Development
202
+
203
+ ```bash
204
+ npm install
205
+ npm run dev -- init
206
+ npm test
207
+ npm run build
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Notes
213
+
214
+ - Use `config.example.toml` as the starting point.
215
+ - Runtime files are stored in `~/.handsoff`.
216
+
217
+ MIT
@@ -0,0 +1,29 @@
1
+ # Handsoff configuration
2
+ # Copy to ~/.handsoff/config.toml and fill in your credentials
3
+
4
+ [general]
5
+ default_agent = "claude"
6
+ log_level = "info"
7
+ hook_server_port = 9876
8
+
9
+ [channel.telegram]
10
+ enabled = true
11
+ bot_token = "YOUR_BOT_TOKEN"
12
+ allowed_users = [123456789]
13
+
14
+ [channel.feishu]
15
+ enabled = false
16
+ app_id = ""
17
+ app_secret = ""
18
+
19
+ [agent.claude]
20
+ adapter = "hooks"
21
+ binary = "claude"
22
+ work_dir = ""
23
+ model = ""
24
+ permission_mode = ""
25
+
26
+ # Agent-specific permission settings
27
+ [agent.claude.permission]
28
+ # Low-risk tools that won't trigger permission prompts
29
+ lowRiskTools = ["Read", "Glob", "Grep", "List", "WebSearch", "codesearch"]
@@ -0,0 +1,2 @@
1
+
2
+ export { }