polygram 0.3.0 → 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.
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
3
+ "name": "shumkov",
4
+ "description": "Ivan Shumkov's Claude Code plugins.",
5
+ "owner": {
6
+ "name": "Ivan Shumkov",
7
+ "email": "ivanshumkov@gmail.com"
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "polygram",
12
+ "description": "Telegram integration for Claude Code that preserves the OpenClaw per-chat session model. Migration target for OpenClaw users. Bundles /polygram:status|logs|pair-code|approvals admin commands and a history skill.",
13
+ "category": "integration",
14
+ "source": "./",
15
+ "homepage": "https://github.com/shumkov/polygram"
16
+ }
17
+ ]
18
+ }
@@ -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.0",
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",
package/README.md CHANGED
@@ -120,23 +120,40 @@ For production, LaunchAgent plists are in `ops/`. See `ops/README.md`.
120
120
  polygram also ships as a Claude Code plugin — adds admin slash commands
121
121
  and bundles the transcript-query skill for use inside your Claude sessions.
122
122
 
123
+ The repo doubles as a single-plugin marketplace. Two commands at your
124
+ Claude Code `/` prompt:
125
+
126
+ ```
127
+ /plugin marketplace add https://github.com/shumkov/polygram.git
128
+ /plugin install polygram@shumkov
123
129
  ```
124
- /plugin install https://github.com/shumkov/polygram.git
130
+
131
+ The first registers the marketplace (`shumkov`). The second installs the
132
+ `polygram` plugin from it.
133
+
134
+ To enable in a specific Claude project, add to `.claude/settings.json`:
135
+
136
+ ```json
137
+ {
138
+ "enabledPlugins": {
139
+ "polygram@shumkov": true
140
+ }
141
+ }
125
142
  ```
126
143
 
127
- Once installed:
144
+ Once enabled:
128
145
 
129
- - `/polygram:status` — running bots, IPC health, recent events, one-line verdict
146
+ - `/polygram:status` — running bots, IPC health, recent events
130
147
  - `/polygram:logs <bot>` — tail `~/polygram/logs/<bot>.log`
131
148
  - `/polygram:pair-code` — walks you through issuing a pairing code (in-band via Telegram)
132
149
  - `/polygram:approvals [bot]` — pending and recent tool-approval rows
133
150
 
134
- The bundled **`telegram-history` skill** lets Claude query the transcript
135
- directly:
151
+ The bundled **`history` skill** lets Claude query the transcript directly
152
+ when you ask about past chat activity:
136
153
 
137
154
  ```
138
155
  "Summarise the Orders topic today" →
139
- uses skills/history to run `recent <chat> --since 24h`
156
+ Claude invokes the history skill runs `recent <chat> --since 24h`
140
157
  ```
141
158
 
142
159
  Scope is derived from `process.cwd()`: the skill refuses to run from an
@@ -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.0",
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",