handsoff 0.0.1-beta.2 → 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 +201 -0
- package/README.md +176 -87
- package/config.example.toml +15 -0
- package/dist/cli/index.js +611 -66
- package/dist/cli/index.js.map +1 -1
- package/dist/gateway/process.js +11783 -0
- package/dist/gateway/process.js.map +1 -0
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Handsoff
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/handsoff)
|
|
4
|
+
[](https://www.npmjs.com/package/handsoff?activeTab=versions)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
|
|
3
8
|
> **Hands off your desk, hand off control to your phone.**
|
|
4
9
|
>
|
|
5
10
|
> *Leave your desk, not your code.*
|
|
@@ -24,114 +29,140 @@ No more tethering yourself to your desk. Your code doesn't stop when you step aw
|
|
|
24
29
|
|
|
25
30
|
---
|
|
26
31
|
|
|
27
|
-
##
|
|
32
|
+
## Install (recommended)
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
Install globally via npm or pnpm:
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
```bash
|
|
37
|
+
npm install -g handsoff
|
|
38
|
+
```
|
|
32
39
|
|
|
33
|
-
|
|
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
|
|
40
|
+
Or run without installing:
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<img src="assets/image_02.jpg" width="45%" alt="Permission request and task completion on Telegram" />
|
|
42
|
-
</p>
|
|
42
|
+
```bash
|
|
43
|
+
npx handsoff init
|
|
44
|
+
```
|
|
43
45
|
|
|
44
46
|
---
|
|
45
47
|
|
|
46
|
-
##
|
|
48
|
+
## Quick start (TL;DR)
|
|
47
49
|
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
+-------------------------+
|
|
50
|
+
```bash
|
|
51
|
+
# 1. Configure (interactive wizard)
|
|
52
|
+
handsoff init
|
|
53
|
+
|
|
54
|
+
# 2. Start the gateway daemon
|
|
55
|
+
handsoff gateway start
|
|
56
|
+
|
|
57
|
+
# 3. Start using Codex from your bound chat channel
|
|
58
|
+
# Example: send "/codex explain the latest failing test"
|
|
73
59
|
```
|
|
74
60
|
|
|
75
|
-
|
|
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
|
|
61
|
+
Done. Codex requests, permission prompts, and task completions will now arrive on your connected channels.
|
|
79
62
|
|
|
80
63
|
---
|
|
81
64
|
|
|
82
|
-
##
|
|
65
|
+
## How it works
|
|
83
66
|
|
|
84
|
-
|
|
85
|
-
- Chat channel support: `Telegram`, `Feishu`
|
|
67
|
+
### Claude Code + Telegram integration
|
|
86
68
|
|
|
87
|
-
|
|
69
|
+
The core workflow bridges Claude Code with Telegram:
|
|
88
70
|
|
|
89
|
-
|
|
71
|
+
1. **Session Monitoring** — Handsoff listens for Claude Code session start/end events and notifies you on Telegram
|
|
72
|
+
2. **Permission Control** — When Claude requests to execute a tool, you receive a permission prompt on Telegram with **Allow/Deny** buttons
|
|
73
|
+
3. **Real-time Decisions** — Click the button in Telegram to grant or deny the tool execution
|
|
74
|
+
4. **Task Completion** — Receive final notifications when tasks complete, including execution duration, token usage, and results
|
|
90
75
|
|
|
91
|
-
|
|
92
|
-
|
|
76
|
+
<p align="center">
|
|
77
|
+
<img src="assets/image_01.jpg" width="45%" alt="Claude + Telegram workflow" />
|
|
78
|
+
|
|
79
|
+
<img src="assets/image_02.jpg" width="45%" alt="Permission request and task completion on Telegram" />
|
|
80
|
+
</p>
|
|
93
81
|
|
|
94
82
|
---
|
|
95
83
|
|
|
96
|
-
##
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
npm install -g handsoff
|
|
100
|
-
```
|
|
84
|
+
## How it works
|
|
101
85
|
|
|
102
|
-
|
|
86
|
+
### Data flow
|
|
103
87
|
|
|
104
|
-
```
|
|
105
|
-
|
|
88
|
+
```
|
|
89
|
+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
90
|
+
│ Claude Code │ │ Telegram / │ │ Web / Mobile │
|
|
91
|
+
│ (agent) │ │ Feishu │ │ (-dashboard) │
|
|
92
|
+
└────────┬────────┘ └────────▲────────┘ └────────▲────────┘
|
|
93
|
+
│ │ │
|
|
94
|
+
│ hooks │ push │ ws / http
|
|
95
|
+
│ │ │
|
|
96
|
+
v │ │
|
|
97
|
+
┌─────────────────┐ │ │
|
|
98
|
+
│ ClaudeHook │ │ │
|
|
99
|
+
│ Adapter │ │ │
|
|
100
|
+
└────────┬────────┘ │ │
|
|
101
|
+
│ │ │
|
|
102
|
+
│ event │ │
|
|
103
|
+
│ │ │
|
|
104
|
+
v │ │
|
|
105
|
+
┌─────────────────┐ ┌────────┴───────────────────────┴────────┐
|
|
106
|
+
│ Handsoff │ │ Gateway │
|
|
107
|
+
│ Gateway │ │ ┌─────────┐ ┌─────────────────────┐ │
|
|
108
|
+
│ │ │ │EventBus │ │ InteractionService │ │
|
|
109
|
+
│ ┌───────────┐ │ │ │Session │ │ NotificationHandler │ │
|
|
110
|
+
│ │ HTTP/WS │ │◄────┼──│Manager │ │ EventPublisher │ │
|
|
111
|
+
│ │ Server │ │ │ └────┬────┘ └──────────┬──────────┘ │
|
|
112
|
+
│ └───────────┘ │ │ │ │ │
|
|
113
|
+
└─────────────────┘ └───────┼───────────────────┼─────────────┘
|
|
114
|
+
│ │
|
|
115
|
+
│ subscribe │ publish
|
|
116
|
+
│ │
|
|
117
|
+
v v
|
|
118
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
119
|
+
│ ChannelManager │ │ Dashboard / │
|
|
120
|
+
│ (Telegram/ │ │ Logger │
|
|
121
|
+
│ Feishu) │ └─────────────────┘
|
|
122
|
+
└─────────────────┘
|
|
106
123
|
```
|
|
107
124
|
|
|
108
|
-
|
|
125
|
+
1. **Agent hooks** — Claude Code fires lifecycle hooks (`SessionStart`, `PermissionRequest`, `Stop`, etc.)
|
|
126
|
+
2. **Gateway ingests** — `ClaudeHookAdapter` normalizes events and feeds them into the Gateway
|
|
127
|
+
3. **Gateway routes** — `EventBus` routes events to the right handler:
|
|
128
|
+
- Session events → `NotificationHandler` → push to channels
|
|
129
|
+
- Permission requests → `InteractionService` → wait for user response
|
|
130
|
+
- Commands from channels → `Command Handler` → control the agent
|
|
131
|
+
4. **Channels notify** — `ChannelManager` forwards messages to Telegram / Feishu with interactive buttons
|
|
132
|
+
5. **Web dashboard** — HTTP + WebSocket server exposes live sessions and event history
|
|
109
133
|
|
|
110
|
-
|
|
134
|
+
### Request/response cycle
|
|
111
135
|
|
|
112
|
-
|
|
136
|
+
A typical permission-request flow looks like this:
|
|
113
137
|
|
|
114
|
-
```bash
|
|
115
|
-
handsoff init
|
|
116
138
|
```
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
Claude needs to run Bash
|
|
140
|
+
│
|
|
141
|
+
▼
|
|
142
|
+
Gateway receives PermissionRequest
|
|
143
|
+
│
|
|
144
|
+
▼
|
|
145
|
+
NotificationHandler sends card to Telegram/Feishu
|
|
146
|
+
│
|
|
147
|
+
▼
|
|
148
|
+
User clicks Allow / Deny on phone
|
|
149
|
+
│
|
|
150
|
+
▼
|
|
151
|
+
ChannelManager posts interaction response
|
|
152
|
+
│
|
|
153
|
+
▼
|
|
154
|
+
InteractionService resolves the pending request
|
|
155
|
+
│
|
|
156
|
+
▼
|
|
157
|
+
Claude continues with the result
|
|
122
158
|
```
|
|
123
159
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
handsoff attach claude
|
|
128
|
-
```
|
|
160
|
+
---
|
|
129
161
|
|
|
130
|
-
|
|
162
|
+
## Supported platforms
|
|
131
163
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
```
|
|
164
|
+
- CLI agent support: `claude`, `codex`
|
|
165
|
+
- Chat channel support: `Telegram`, `Feishu`, `App`
|
|
135
166
|
|
|
136
167
|
---
|
|
137
168
|
|
|
@@ -154,8 +185,9 @@ handsoff gateway status
|
|
|
154
185
|
Most configuration is handled by `handsoff init` interactive wizard, which guides you through:
|
|
155
186
|
|
|
156
187
|
1. Setting up your Claude Code hook server port
|
|
157
|
-
2.
|
|
158
|
-
3.
|
|
188
|
+
2. Enabling Codex agent integration
|
|
189
|
+
3. Configuring Telegram bot credentials
|
|
190
|
+
4. Testing channel connectivity
|
|
159
191
|
|
|
160
192
|
For manual setup or advanced options, edit `~/.handsoff/config.toml`. Key sections:
|
|
161
193
|
|
|
@@ -167,13 +199,29 @@ For manual setup or advanced options, edit `~/.handsoff/config.toml`. Key sectio
|
|
|
167
199
|
**Telegram channel:**
|
|
168
200
|
- `bot_token` — your Telegram bot token from BotFather
|
|
169
201
|
- `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
|
|
202
|
+
- `notify_types` — which event types to forward (`permission_request`, `question_request`, `finished`, `session_start`, `error`)
|
|
203
|
+
|
|
204
|
+
**App channel:**
|
|
205
|
+
- `enabled` — whether to start the App channel WebSocket server with the gateway
|
|
206
|
+
- `channel_id` — unique identifier for this app client (e.g., `app:desktop-001`)
|
|
207
|
+
- `auth_token` — token used to authenticate app clients
|
|
208
|
+
- `heartbeat_interval_ms` — optional heartbeat interval in milliseconds (default: `30000`)
|
|
209
|
+
- `notify_types` — which event types to forward (`*`, `permission_request`, `question_request`, `finished`, `session_start`, `error`)
|
|
210
|
+
|
|
211
|
+
Connect to: `ws://localhost:<port>/ws/channels/app`
|
|
171
212
|
|
|
172
213
|
**Claude agent:**
|
|
173
214
|
- `adapter` — integration method (always `hooks`)
|
|
174
215
|
- `binary` — Claude Code binary name
|
|
175
216
|
- `permission_mode` — how to handle tool permissions
|
|
176
217
|
|
|
218
|
+
**Codex agent:**
|
|
219
|
+
- `enabled` — whether to start the Codex adapter with the gateway
|
|
220
|
+
- `command` — command used to launch `codex app-server`
|
|
221
|
+
- `work_dir` — default working directory for chat-triggered Codex sessions
|
|
222
|
+
- `model` — default Codex model for new sessions
|
|
223
|
+
- `approval_policy` — default approval policy passed to Codex
|
|
224
|
+
|
|
177
225
|
Example `~/.handsoff/config.toml`:
|
|
178
226
|
|
|
179
227
|
```toml
|
|
@@ -186,7 +234,14 @@ hook_server_port = 9876
|
|
|
186
234
|
enabled = true
|
|
187
235
|
bot_token = "YOUR_BOT_TOKEN"
|
|
188
236
|
allowed_users = ["123456789"]
|
|
189
|
-
notify_types = ["permission_request", "finished", "session_start", "error"]
|
|
237
|
+
notify_types = ["permission_request", "question_request", "finished", "session_start", "error"]
|
|
238
|
+
|
|
239
|
+
[channels.app]
|
|
240
|
+
enabled = false
|
|
241
|
+
channel_id = "app:desktop-001"
|
|
242
|
+
auth_token = "change-me"
|
|
243
|
+
notify_types = ["*"]
|
|
244
|
+
heartbeat_interval_ms = 30000
|
|
190
245
|
|
|
191
246
|
[agent.claude]
|
|
192
247
|
adapter = "hooks"
|
|
@@ -194,24 +249,58 @@ binary = "claude"
|
|
|
194
249
|
work_dir = ""
|
|
195
250
|
model = ""
|
|
196
251
|
permission_mode = ""
|
|
252
|
+
|
|
253
|
+
[agent.codex]
|
|
254
|
+
enabled = true
|
|
255
|
+
command = ["codex", "app-server", "--listen", "stdio://"]
|
|
256
|
+
work_dir = ""
|
|
257
|
+
model = ""
|
|
258
|
+
approval_policy = ""
|
|
197
259
|
```
|
|
198
260
|
|
|
261
|
+
### Using Codex from Telegram / Feishu
|
|
262
|
+
|
|
263
|
+
After the gateway is running and the channel is bound to `codex`, send one of these commands in chat:
|
|
264
|
+
|
|
265
|
+
- `/codex <prompt>` — run a Codex task in the current chat
|
|
266
|
+
- `/codex status` — inspect the active Codex session for the current chat
|
|
267
|
+
- `/codex stop` — stop the active Codex session
|
|
268
|
+
- `/codex help` — show the Codex command help
|
|
269
|
+
|
|
199
270
|
---
|
|
200
271
|
|
|
201
|
-
##
|
|
272
|
+
## From source (development)
|
|
273
|
+
|
|
274
|
+
Requires Node.js >= 20.
|
|
202
275
|
|
|
203
276
|
```bash
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
277
|
+
# Clone the repo
|
|
278
|
+
git clone https://github.com/tapclaw/handsoff.git
|
|
279
|
+
cd handsoff
|
|
280
|
+
|
|
281
|
+
# Install dependencies
|
|
282
|
+
pnpm install
|
|
283
|
+
|
|
284
|
+
# Development mode
|
|
285
|
+
pnpm run dev -- init
|
|
286
|
+
|
|
287
|
+
# Run tests
|
|
288
|
+
pnpm test
|
|
289
|
+
|
|
290
|
+
# Build for production
|
|
291
|
+
pnpm run build
|
|
208
292
|
```
|
|
209
293
|
|
|
210
294
|
---
|
|
211
295
|
|
|
296
|
+
## Future plan
|
|
297
|
+
|
|
298
|
+
- [ ] Add more agent adapters
|
|
299
|
+
- [ ] Add more channel adapters
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
212
303
|
## Notes
|
|
213
304
|
|
|
214
305
|
- Use `config.example.toml` as the starting point.
|
|
215
306
|
- Runtime files are stored in `~/.handsoff`.
|
|
216
|
-
|
|
217
|
-
MIT
|
package/config.example.toml
CHANGED
|
@@ -27,3 +27,18 @@ permission_mode = ""
|
|
|
27
27
|
[agent.claude.permission]
|
|
28
28
|
# Low-risk tools that won't trigger permission prompts
|
|
29
29
|
lowRiskTools = ["Read", "Glob", "Grep", "List", "WebSearch", "codesearch"]
|
|
30
|
+
|
|
31
|
+
[channels.app]
|
|
32
|
+
enabled = false
|
|
33
|
+
channel_id = "app:desktop-001"
|
|
34
|
+
auth_token = "change-me"
|
|
35
|
+
notify_types = ["*"]
|
|
36
|
+
heartbeat_interval_ms = 30000
|
|
37
|
+
|
|
38
|
+
[agent.codex]
|
|
39
|
+
enabled = false
|
|
40
|
+
command = ["codex", "app-server", "--listen", "stdio://"]
|
|
41
|
+
work_dir = ""
|
|
42
|
+
model = ""
|
|
43
|
+
approval_policy = ""
|
|
44
|
+
sandbox_mode = ""
|