@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
package/README.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  **Telegram ↔ Claude Code bridge** — run Claude Code sessions from Telegram with full streaming, session management, and multi-agent support.
4
4
 
5
+ ## Why TGCC?
6
+
7
+ Claude Code is powerful but lives in a terminal. TGCC gives it a **shared, visible interface** through Telegram.
8
+
9
+ **The problem**: When an AI agent spawns a Claude Code session, it's ephemeral and invisible. No one can watch it work. No one can jump in. When it finishes, the context is gone.
10
+
11
+ **What TGCC does**: Each CC session gets a Telegram bot that streams output in real-time — thinking, tool use, code edits — all in a single updating message. Multiple sources can share the same CC process:
12
+
13
+ - Your **OpenClaw agent** delegates a coding task via the supervisor protocol
14
+ - **You** watch it work in Telegram from your phone
15
+ - You can **jump in** mid-session to steer, approve permissions, or add context
16
+ - The agent gets the **result back** automatically when CC finishes
17
+
18
+ This turns Claude Code from a black-box subprocess into a **collaborative workspace** between humans and AI agents.
19
+
5
20
  ## Quick Start
6
21
 
7
22
  ```bash
@@ -96,6 +111,68 @@ CC processes can communicate back to the orchestrator via built-in MCP tools:
96
111
  See [`docs/SPEC-SUPERVISOR-PROTOCOL.md`](docs/SPEC-SUPERVISOR-PROTOCOL.md) for the full protocol spec.
97
112
  See [`docs/SPEC-SUBAGENT-OBSERVABILITY.md`](docs/SPEC-SUBAGENT-OBSERVABILITY.md) for the observability spec.
98
113
 
114
+
115
+ ## OpenClaw Plugin
116
+
117
+ TGCC ships an **OpenClaw community plugin** that gives your OpenClaw agents direct access to TGCC-managed Claude Code sessions.
118
+
119
+ ### Install
120
+
121
+ ```bash
122
+ openclaw plugins install @fonz/tgcc
123
+ ```
124
+
125
+ ### Configure
126
+
127
+ Add to your OpenClaw config (`~/.openclaw/openclaw.json`):
128
+
129
+ ```json
130
+ {
131
+ "plugins": {
132
+ "entries": {
133
+ "tgcc": {
134
+ "enabled": true,
135
+ "config": {
136
+ "socketDir": "/tmp/tgcc/ctl",
137
+ "defaultAgent": "tgcc",
138
+ "telegramChatId": "your-chat-id"
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+ ```
145
+
146
+ ### Tools
147
+
148
+ The plugin registers four agent tools:
149
+
150
+ | Tool | Description |
151
+ |------|-------------|
152
+ | `tgcc_status` | List agents, check state, view pending results and events |
153
+ | `tgcc_spawn` | Start a CC session (existing or ephemeral agent) |
154
+ | `tgcc_send` | Send a message to an active agent |
155
+ | `tgcc_kill` | Kill a CC process or destroy an ephemeral agent |
156
+
157
+ ### Example
158
+
159
+ ```
160
+ # From your OpenClaw agent:
161
+ tgcc_spawn agentId="tgcc" task="Fix the render pipeline"
162
+ tgcc_status # check progress
163
+ tgcc_send agentId="tgcc" text="Also run the tests"
164
+ tgcc_kill agentId="tgcc" # done
165
+ ```
166
+
167
+ Ephemeral agents for isolated work:
168
+
169
+ ```
170
+ tgcc_spawn agentId="pr-42" repo="/tmp/pr-42" task="Review this PR" model="opus"
171
+ tgcc_kill agentId="pr-42" destroy=true
172
+ ```
173
+
174
+ The plugin also ships a **skill** (`tgcc-agents`) that teaches OpenClaw agents how to use these tools effectively.
175
+
99
176
  ## Service Management
100
177
 
101
178
  ```bash
@@ -0,0 +1,41 @@
1
+ /**
2
+ * OpenClaw plugin entry point for the TGCC Bridge.
3
+ *
4
+ * Connects to TGCC's control socket as a supervisor, registers agent tools
5
+ * (tgcc_spawn, tgcc_send, tgcc_status, tgcc_kill), and relays events.
6
+ */
7
+ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
8
+ interface TgccPluginConfig {
9
+ enabled: boolean;
10
+ socketDir: string;
11
+ defaultAgent?: string;
12
+ agents?: string[];
13
+ telegramChatId?: string;
14
+ }
15
+ declare const tgccPlugin: {
16
+ id: string;
17
+ name: string;
18
+ description: string;
19
+ configSchema: {
20
+ parse(value: unknown): TgccPluginConfig;
21
+ uiHints: {
22
+ socketDir: {
23
+ label: string;
24
+ help: string;
25
+ };
26
+ defaultAgent: {
27
+ label: string;
28
+ help: string;
29
+ };
30
+ agents: {
31
+ label: string;
32
+ };
33
+ telegramChatId: {
34
+ label: string;
35
+ help: string;
36
+ };
37
+ };
38
+ };
39
+ register(api: OpenClawPluginApi): void;
40
+ };
41
+ export default tgccPlugin;
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ /**
3
+ * OpenClaw plugin entry point for the TGCC Bridge.
4
+ *
5
+ * Connects to TGCC's control socket as a supervisor, registers agent tools
6
+ * (tgcc_spawn, tgcc_send, tgcc_status, tgcc_kill), and relays events.
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const node_path_1 = __importDefault(require("node:path"));
13
+ const node_fs_1 = __importDefault(require("node:fs"));
14
+ const client_js_1 = require("./src/client.js");
15
+ const events_js_1 = require("./src/events.js");
16
+ const tgcc_spawn_js_1 = require("./src/tools/tgcc-spawn.js");
17
+ const tgcc_send_js_1 = require("./src/tools/tgcc-send.js");
18
+ const tgcc_status_js_1 = require("./src/tools/tgcc-status.js");
19
+ const tgcc_kill_js_1 = require("./src/tools/tgcc-kill.js");
20
+ const permissions_js_1 = require("./src/permissions.js");
21
+ function parseConfig(raw) {
22
+ const obj = raw ?? {};
23
+ return {
24
+ enabled: typeof obj.enabled === "boolean" ? obj.enabled : true,
25
+ socketDir: typeof obj.socketDir === "string" ? obj.socketDir : "/tmp/tgcc/ctl",
26
+ defaultAgent: typeof obj.defaultAgent === "string" ? obj.defaultAgent : undefined,
27
+ agents: Array.isArray(obj.agents) ? obj.agents : undefined,
28
+ telegramChatId: typeof obj.telegramChatId === "string" ? obj.telegramChatId : undefined,
29
+ };
30
+ }
31
+ // ---------------------------------------------------------------------------
32
+ // Socket discovery — find .sock files in the socket directory
33
+ // ---------------------------------------------------------------------------
34
+ function discoverSocket(socketDir) {
35
+ try {
36
+ const files = node_fs_1.default.readdirSync(socketDir);
37
+ const sock = files.find((f) => f.endsWith(".sock"));
38
+ return sock ? node_path_1.default.join(socketDir, sock) : null;
39
+ }
40
+ catch {
41
+ return null;
42
+ }
43
+ }
44
+ // ---------------------------------------------------------------------------
45
+ // Plugin export
46
+ // ---------------------------------------------------------------------------
47
+ const tgccPlugin = {
48
+ id: "tgcc",
49
+ name: "TGCC Bridge",
50
+ description: "Bridge OpenClaw agents to Claude Code sessions via TGCC",
51
+ configSchema: {
52
+ parse(value) {
53
+ const raw = value && typeof value === "object" && !Array.isArray(value)
54
+ ? value
55
+ : {};
56
+ return parseConfig(raw);
57
+ },
58
+ uiHints: {
59
+ socketDir: {
60
+ label: "Socket Directory",
61
+ help: "Directory containing TGCC control sockets (default: /tmp/tgcc/ctl)",
62
+ },
63
+ defaultAgent: {
64
+ label: "Default Agent",
65
+ help: "Default TGCC agent ID for spawns",
66
+ },
67
+ agents: { label: "Agent IDs" },
68
+ telegramChatId: {
69
+ label: "Telegram Chat ID",
70
+ help: "Chat ID for permission request buttons",
71
+ },
72
+ },
73
+ },
74
+ register(api) {
75
+ const config = parseConfig(api.pluginConfig);
76
+ if (!config.enabled) {
77
+ api.logger.info("[tgcc] plugin disabled");
78
+ return;
79
+ }
80
+ const log = api.logger;
81
+ let client = null;
82
+ const getClient = () => client;
83
+ // ── Register tools ──────────────────────────────────────────────
84
+ api.registerTool((0, tgcc_spawn_js_1.createTgccSpawnTool)(getClient, config.defaultAgent));
85
+ api.registerTool((0, tgcc_send_js_1.createTgccSendTool)(getClient));
86
+ api.registerTool((0, tgcc_status_js_1.createTgccStatusTool)(getClient));
87
+ api.registerTool((0, tgcc_kill_js_1.createTgccKillTool)(getClient));
88
+ // ── Register gateway methods ────────────────────────────────────
89
+ // Permission response gateway method
90
+ api.registerGatewayMethod("tgcc.permission_response", (0, permissions_js_1.createPermissionResponseHandler)(getClient, log));
91
+ // Status gateway method (for programmatic access)
92
+ api.registerGatewayMethod("tgcc.status", async ({ params, respond }) => {
93
+ const c = getClient();
94
+ if (!c?.isConnected()) {
95
+ respond(false, { error: "Not connected to TGCC" });
96
+ return;
97
+ }
98
+ try {
99
+ const agentId = typeof params.agentId === "string" ? params.agentId : undefined;
100
+ const status = await c.getStatus(agentId);
101
+ respond(true, status);
102
+ }
103
+ catch (err) {
104
+ respond(false, { error: err instanceof Error ? err.message : String(err) });
105
+ }
106
+ });
107
+ // Send message gateway method
108
+ api.registerGatewayMethod("tgcc.send", async ({ params, respond }) => {
109
+ const c = getClient();
110
+ if (!c?.isConnected()) {
111
+ respond(false, { error: "Not connected to TGCC" });
112
+ return;
113
+ }
114
+ const agentId = typeof params.agentId === "string" ? params.agentId : "";
115
+ const text = typeof params.text === "string" ? params.text : "";
116
+ if (!agentId || !text) {
117
+ respond(false, { error: "agentId and text are required" });
118
+ return;
119
+ }
120
+ try {
121
+ const result = await c.sendMessage(agentId, text, { subscribe: true });
122
+ respond(true, result);
123
+ }
124
+ catch (err) {
125
+ respond(false, { error: err instanceof Error ? err.message : String(err) });
126
+ }
127
+ });
128
+ // ── Register background service ─────────────────────────────────
129
+ api.registerService({
130
+ id: "tgcc-supervisor",
131
+ async start() {
132
+ const socketPath = discoverSocket(config.socketDir);
133
+ if (!socketPath) {
134
+ log.info(`[tgcc] no socket found in ${config.socketDir}, will retry on reconnect`);
135
+ }
136
+ const effectiveSocket = socketPath ?? node_path_1.default.join(config.socketDir, "tgcc.sock");
137
+ client = new client_js_1.TgccSupervisorClient({
138
+ socket: effectiveSocket,
139
+ logger: log,
140
+ });
141
+ // Wire up event handlers
142
+ (0, events_js_1.attachEventHandlers)(client, log);
143
+ // Wire up permission request handler
144
+ (0, events_js_1.setPermissionRequestHandler)((event) => {
145
+ (0, permissions_js_1.handlePermissionRequest)(event, api.runtime, config.telegramChatId, log);
146
+ });
147
+ client.start();
148
+ log.info(`[tgcc] supervisor service started (socket: ${effectiveSocket})`);
149
+ },
150
+ async stop() {
151
+ if (client) {
152
+ client.stop();
153
+ client = null;
154
+ log.info("[tgcc] supervisor service stopped");
155
+ }
156
+ },
157
+ });
158
+ },
159
+ };
160
+ exports.default = tgccPlugin;
161
+ //# s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 "name": "TGCC Bridge",
4
+ "description": "Bridge OpenClaw agents to Claude Code sessions via TGCC (Telegram \u2194 Claude Code)",
5
+ "version": "0.6.19",
6
+ "uiHints": {
7
+ "socketDir": {
8
+ "label": "Socket Directory",
9
+ "help": "Directory containing TGCC control sockets (default: /tmp/tgcc/ctl)"
10
+ },
11
+ "defaultAgent": {
12
+ "label": "Default Agent",
13
+ "help": "Default TGCC agent ID for spawns"
14
+ },
15
+ "agents": {
16
+ "label": "Agent IDs",
17
+ "help": "TGCC agent IDs to subscribe to (default: all)"
18
+ },
19
+ "telegramChatId": {
20
+ "label": "Telegram Chat ID",
21
+ "help": "Chat ID for permission request buttons"
22
+ }
23
+ },
24
+ "configSchema": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "properties": {
28
+ "enabled": {
29
+ "type": "boolean"
30
+ },
31
+ "socketDir": {
32
+ "type": "string",
33
+ "description": "Directory containing TGCC control sockets (default: /tmp/tgcc/ctl)"
34
+ },
35
+ "defaultAgent": {
36
+ "type": "string",
37
+ "description": "Default TGCC agent to use for spawns (e.g. 'tgcc')"
38
+ },
39
+ "agents": {
40
+ "type": "array",
41
+ "items": {
42
+ "type": "string"
43
+ },
44
+ "description": "TGCC agent IDs to subscribe to (default: all)"
45
+ },
46
+ "telegramChatId": {
47
+ "type": "string",
48
+ "description": "Telegram chat ID for permission request buttons"
49
+ }
50
+ }
51
+ },
52
+ "skills": [
53
+ "skills/tgcc-agents"
54
+ ]
55
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "tgcc",
3
+ "openclaw": {
4
+ "extensions": ["./index.js"]
5
+ }
6
+ }
@@ -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