polygram 0.3.1 → 0.3.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
3
  "name": "polygram",
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "description": "Telegram integration for Claude Code that preserves the OpenClaw per-chat session model. Migration target for OpenClaw users. Multi-bot, multi-chat, per-topic isolation; SQLite transcripts; inline-keyboard approvals. Bundles /polygram:status|logs|pair-code|approvals admin commands and a history skill.",
6
6
  "keywords": [
7
7
  "telegram",
@@ -2,39 +2,66 @@
2
2
  description: Show polygram daemon health — running bots, IPC sockets, recent events.
3
3
  ---
4
4
 
5
- You are asked to report the current health of the polygram Telegram daemon.
6
-
7
- Do these checks, in order, using the Bash tool, and summarise the results in
8
- a short Markdown table (one row per bot):
9
-
10
- 1. **Which bots are supervised by launchd.** Run:
11
- ```
12
- launchctl list | grep -i polygram || echo "no LaunchAgents loaded"
13
- ```
14
- Parse the output. Each line `<PID>\t<exit>\t<label>` is one bot
15
- (e.g. `com.polygram.my-bot`). The PID column tells you whether it is
16
- running; `-` means loaded but not currently running.
17
-
18
- 2. **Is each bot's Unix socket alive?** For every bot you identified, run:
19
- ```
20
- node ~/polygram/scripts/ipc-smoke.js <bot-name>
21
- ```
22
- Interpret the result:
23
- - `ping: {"id":null,"ok":true,"pong":true,"bot":"<bot>"}` → socket alive
24
- - `ERR: connect ECONNREFUSED` socket stale (polygram not actually
25
- serving despite plist being loaded)
26
- - `ERR: ENOENT` socket missing (polygram never got that far at boot)
27
-
28
- 3. **Recent events in each bot's DB.** For every bot, run:
29
- ```
30
- sqlite3 ~/polygram/<bot>.db "SELECT ts, kind, detail_json FROM events ORDER BY ts DESC LIMIT 5;"
31
- ```
32
- Call out anything that looks like an error (`-fail`, `-error`,
33
- `crashed-mid-send`, `poll-stalled`, `approval-sweep-failed`).
34
-
35
- 4. **Summarise.** A two-line per-bot summary, plus an overall verdict at
36
- the bottom (✅ healthy / ⚠️ degraded / ❌ broken).
37
-
38
- If the user's polygram install is not at `~/polygram`, they may have set
39
- `POLYGRAM_HOME` or a custom path. Ask them to point you at it rather than
40
- guessing.
5
+ Report the health of the polygram Telegram daemon.
6
+
7
+ Do these checks with the Bash tool and summarise per-bot in a short
8
+ Markdown table. Cover launchd **and** tmux supervision — users run either.
9
+
10
+ ### 1. Discover configured bots
11
+
12
+ Read bot names from `~/polygram/config.json` (or `$POLYGRAM_CONFIG`):
13
+
14
+ ```
15
+ jq -r '.bots | keys[]' ~/polygram/config.json
16
+ ```
17
+
18
+ ### 2. Per bot, check supervisor + process
19
+
20
+ **a) LaunchAgent** — `launchctl list | grep com.polygram.<bot>`. If
21
+ present the bot is under launchd. PID `-` means loaded but not running.
22
+
23
+ **b) tmux** — `tmux list-windows -a 2>/dev/null | grep <bot>`. If
24
+ present the bot is running in a tmux pane (most common during testing).
25
+
26
+ **c) Process** `pgrep -f "polygram --bot <bot>"`. Confirms the Node
27
+ process is actually alive regardless of supervisor.
28
+
29
+ Label supervision as:
30
+ - `launchd` plist loaded
31
+ - `tmux` — window present
32
+ - `foreground` alive but unsupervised (will die on logout/crash)
33
+ - `absent` — no process
34
+
35
+ ### 3. IPC socket liveness
36
+
37
+ ```
38
+ polygram-ipc <bot-name>
39
+ ```
40
+
41
+ That's the `polygram-ipc` bin installed alongside the daemon. Interpret:
42
+ - `ping: {"ok":true,...}` — socket alive ✅
43
+ - `ERR: ECONNREFUSED` — socket stale (supervisor claims running, isn't serving)
44
+ - `ERR: ENOENT` — socket missing
45
+ - `command not found: polygram-ipc` — user has polygram < 0.3.2; tell
46
+ them to `npm install -g polygram@latest`
47
+
48
+ ### 4. Recent events
49
+
50
+ ```
51
+ sqlite3 ~/polygram/<bot>.db "SELECT ts, kind FROM events ORDER BY ts DESC LIMIT 5;"
52
+ ```
53
+
54
+ Flag anything ending in `-failed`, `-error`, `crashed-mid-send`,
55
+ `poll-stalled`, `approval-sweep-failed`.
56
+
57
+ ### 5. Summarise
58
+
59
+ Compact Markdown table + overall verdict:
60
+
61
+ - ✅ **healthy** — every bot supervised, live socket, no recent errors
62
+ - ⚠️ **degraded** — running but not supervised (foreground) OR sweeper
63
+ events present OR stale socket
64
+ - ❌ **broken** — any bot has no live process or no live socket
65
+
66
+ If the install isn't at `~/polygram/`, ask for the data-dir path rather
67
+ than guessing.
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "polygram",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Telegram daemon for Claude Code that preserves the OpenClaw per-chat session model. Migration path for OpenClaw users moving to Claude Code.",
5
5
  "main": "lib/ipc-client.js",
6
6
  "bin": {
7
7
  "polygram": "polygram.js",
8
- "polygram-split-db": "scripts/split-db.js"
8
+ "polygram-split-db": "scripts/split-db.js",
9
+ "polygram-ipc": "scripts/ipc-smoke.js"
9
10
  },
10
11
  "files": [
11
12
  "polygram.js",