@fonz/tgcc 0.6.19 → 0.7.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.
Files changed (33) hide show
  1. package/README.md +77 -0
  2. package/dist/plugin/index.d.ts +41 -0
  3. package/dist/plugin/index.js +161 -0
  4. package/dist/plugin/index.js.map +1 -0
  5. package/dist/plugin/openclaw.plugin.json +55 -0
  6. package/dist/plugin/package.json +6 -0
  7. package/dist/plugin/skills/tgcc-agents/SKILL.md +161 -0
  8. package/dist/plugin/src/client.d.ts +167 -0
  9. package/dist/plugin/src/client.js +523 -0
  10. package/dist/plugin/src/client.js.map +1 -0
  11. package/dist/plugin/src/events.d.ts +44 -0
  12. package/dist/plugin/src/events.js +226 -0
  13. package/dist/plugin/src/events.js.map +1 -0
  14. package/dist/plugin/src/permissions.d.ts +21 -0
  15. package/dist/plugin/src/permissions.js +78 -0
  16. package/dist/plugin/src/permissions.js.map +1 -0
  17. package/dist/plugin/src/tools/tgcc-kill.d.ts +6 -0
  18. package/dist/plugin/src/tools/tgcc-kill.js +52 -0
  19. package/dist/plugin/src/tools/tgcc-kill.js.map +1 -0
  20. package/dist/plugin/src/tools/tgcc-send.d.ts +9 -0
  21. package/dist/plugin/src/tools/tgcc-send.js +61 -0
  22. package/dist/plugin/src/tools/tgcc-send.js.map +1 -0
  23. package/dist/plugin/src/tools/tgcc-spawn.d.ts +9 -0
  24. package/dist/plugin/src/tools/tgcc-spawn.js +79 -0
  25. package/dist/plugin/src/tools/tgcc-spawn.js.map +1 -0
  26. package/dist/plugin/src/tools/tgcc-status.d.ts +9 -0
  27. package/dist/plugin/src/tools/tgcc-status.js +74 -0
  28. package/dist/plugin/src/tools/tgcc-status.js.map +1 -0
  29. package/dist/streaming.js +5 -2
  30. package/dist/streaming.js.map +1 -1
  31. package/package.json +10 -3
  32. package/plugin/openclaw.plugin.json +55 -0
  33. package/plugin/skills/tgcc-agents/SKILL.md +161 -0
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: tgcc-agents
3
+ description: 'Manage TGCC agents (Claude Code via Telegram) using tgcc_spawn, tgcc_send, tgcc_status, tgcc_kill tools. Use when: spawning CC sessions through TGCC, sending tasks to persistent TGCC bots, checking agent status, killing sessions, or creating ephemeral agents for one-off work.'
4
+ homepage: https://github.com/botverse/tgcc
5
+ metadata:
6
+ {
7
+ "openclaw":
8
+ {
9
+ "emoji": "🔌",
10
+ "requires": { "sockets": ["/tmp/tgcc/ctl/tgcc.sock"] },
11
+ "install":
12
+ [
13
+ {
14
+ "id": "npm",
15
+ "kind": "npm",
16
+ "package": "@fonz/tgcc",
17
+ "label": "Install TGCC plugin",
18
+ },
19
+ ],
20
+ "setup": "Install with `openclaw plugins install @fonz/tgcc`, then configure plugin with socketDir and defaultAgent.",
21
+ },
22
+ }
23
+ ---
24
+
25
+ # TGCC Agents — OpenClaw Plugin
26
+
27
+ Manage **Claude Code sessions via TGCC** (Telegram ↔ Claude Code bridge) using four dedicated tools. TGCC manages CC processes with Telegram rendering — you get visibility in both OpenClaw and Telegram.
28
+
29
+ ## Tools
30
+
31
+ ### `tgcc_status` — Check what's running
32
+
33
+ ```
34
+ tgcc_status # all agents
35
+ tgcc_status agentId="tgcc" # specific agent
36
+ ```
37
+
38
+ Returns:
39
+ - **agents**: list with repo, type (persistent/ephemeral), state (idle/active/spawning)
40
+ - **pendingResults**: completed CC results not yet consumed (use `drain=true` to consume)
41
+ - **pendingPermissions**: permission requests waiting for approval
42
+ - **recentEvents**: last events (cc_spawned, result, error, etc.)
43
+
44
+ ### `tgcc_spawn` — Start a CC session
45
+
46
+ **Existing agent** (persistent, has Telegram bot):
47
+ ```
48
+ tgcc_spawn agentId="tgcc" task="Fix the render pipeline bug"
49
+ tgcc_spawn agentId="sentinella" task="Check tile coverage for Ibiza"
50
+ ```
51
+
52
+ **Ephemeral agent** (one-off, no Telegram bot — requires `repo`):
53
+ ```
54
+ tgcc_spawn agentId="my-task" repo="/home/user/project" task="Add error handling"
55
+ tgcc_spawn agentId="review-pr" repo="/tmp/pr-42" task="Review this PR" model="opus"
56
+ ```
57
+
58
+ Optional params:
59
+ - `model`: override CC model (e.g. `opus`, `sonnet`)
60
+ - `permissionMode`: CC permission mode (`plan`, `default`, `bypassPermissions`)
61
+
62
+ ### `tgcc_send` — Message an active agent
63
+
64
+ Send a follow-up message or new task to an agent that already has a CC session:
65
+ ```
66
+ tgcc_send agentId="tgcc" text="Also run the tests"
67
+ tgcc_send agentId="sentinella" text="Now compare with last month"
68
+ ```
69
+
70
+ If the agent is idle (no CC process), this spawns a new session. If active, the message is queued and sent to CC when it's ready for input.
71
+
72
+ ### `tgcc_kill` — Stop a CC session
73
+
74
+ ```
75
+ tgcc_kill agentId="tgcc" # kill CC process, keep agent
76
+ tgcc_kill agentId="my-task" destroy=true # kill CC + destroy ephemeral agent
77
+ ```
78
+
79
+ ## Typical Workflows
80
+
81
+ ### Delegate a coding task
82
+ ```
83
+ tgcc_spawn agentId="tgcc" task="Implement the OpenClaw plugin per specs/openclaw-plugin.md"
84
+ # ... wait ...
85
+ tgcc_status # check pendingResults for completion
86
+ ```
87
+
88
+ ### Multi-agent coordination
89
+ ```
90
+ tgcc_send agentId="sentinella" text="Generate the fire risk report"
91
+ tgcc_send agentId="kyobot" text="Update the booking dashboard"
92
+ tgcc_status # see both working in parallel
93
+ ```
94
+
95
+ ### Ephemeral agent for isolated work
96
+ ```
97
+ tgcc_spawn agentId="pr-review" repo="/tmp/pr-42" task="Review changes" model="opus"
98
+ # ... result comes back ...
99
+ tgcc_kill agentId="pr-review" destroy=true # clean up
100
+ ```
101
+
102
+ ### Follow up on running work
103
+ ```
104
+ tgcc_send agentId="tgcc" text="Also fix the edge case in splitMessage"
105
+ ```
106
+
107
+ ## How It Works
108
+
109
+ ```
110
+ OpenClaw Plugin TGCC Bridge CC Process
111
+ │ │ │
112
+ │── send_message ───────────►│ │
113
+ │ {agentId, text} │── spawn/resume CC ──────►│
114
+ │◄── ack ───────────────────│ {sessionId, state} │
115
+ │ │ │
116
+ │ (CC works, visible │ │
117
+ │ in Telegram chat) │ │
118
+ │ │◄── result ───────────────│
119
+ │◄── event: result ─────────│ {text, cost} │
120
+ │ │ │
121
+ ```
122
+
123
+ - **Protocol**: NDJSON over Unix socket (default: `/tmp/tgcc/ctl/*.sock`)
124
+ - **Connection**: Plugin registers as supervisor, auto-reconnects with backoff
125
+ - **Discovery**: Agents auto-discovered on connect (persistent bots + ephemeral)
126
+ - **Events**: cc_spawned, result, process_exit, permission_request, api_error
127
+ - **Shared sessions**: Persistent agents share CC sessions with Telegram users — both see the same work
128
+
129
+ ## Plugin Configuration
130
+
131
+ ```json
132
+ {
133
+ "plugins": {
134
+ "entries": {
135
+ "tgcc": {
136
+ "enabled": true,
137
+ "config": {
138
+ "socketDir": "/tmp/tgcc/ctl",
139
+ "defaultAgent": "tgcc",
140
+ "telegramChatId": "7016073156"
141
+ }
142
+ }
143
+ }
144
+ }
145
+ }
146
+ ```
147
+
148
+ - **socketDir**: where TGCC control sockets live (default: `/tmp/tgcc/ctl`)
149
+ - **defaultAgent**: fallback agentId when none specified
150
+ - **telegramChatId**: chat ID for permission request buttons
151
+ - **agents**: optional array of agent IDs to subscribe to (default: all)
152
+
153
+ ## Permission Requests
154
+
155
+ When CC needs permission (file write, bash command, etc.), TGCC forwards it through the plugin. If `telegramChatId` is configured, approval buttons appear in Telegram (✅ Allow / ❌ Deny). Otherwise, permissions follow CC's configured `permissionMode`.
156
+
157
+ ## When NOT to Use This
158
+
159
+ - **Quick file edits**: use the `edit` tool directly
160
+ - **Reading/exploring code**: use `read` / `exec` tools
161
+ - **Tasks needing full isolation from Telegram**: spawn CC directly via coding-agent skill