paperclip-plugin-telegram 0.1.0 → 0.2.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 (48) hide show
  1. package/README.md +19 -3
  2. package/package.json +3 -10
  3. package/src/acp-bridge.ts +1273 -0
  4. package/src/adapter.ts +129 -0
  5. package/src/command-registry.ts +482 -0
  6. package/src/commands.ts +346 -0
  7. package/src/constants.ts +51 -0
  8. package/src/escalation.ts +421 -0
  9. package/src/formatters.ts +148 -0
  10. package/src/index.ts +6 -0
  11. package/src/manifest.ts +246 -0
  12. package/src/media-pipeline.ts +234 -0
  13. package/src/telegram-api.ts +202 -0
  14. package/src/watch-registry.ts +369 -0
  15. package/src/worker.ts +783 -0
  16. package/tests/acp-bridge.test.ts +314 -0
  17. package/tests/command-registry.test.ts +283 -0
  18. package/tests/commands.test.ts +213 -0
  19. package/tests/escalation.test.ts +550 -0
  20. package/tests/formatters.test.ts +185 -0
  21. package/tests/media-pipeline.test.ts +324 -0
  22. package/tests/telegram-api.test.ts +108 -0
  23. package/tests/watch-registry.test.ts +404 -0
  24. package/tsconfig.json +16 -0
  25. package/dist/acp-bridge.d.ts +0 -12
  26. package/dist/acp-bridge.js +0 -166
  27. package/dist/acp-bridge.js.map +0 -1
  28. package/dist/commands.d.ts +0 -10
  29. package/dist/commands.js +0 -212
  30. package/dist/commands.js.map +0 -1
  31. package/dist/constants.d.ts +0 -24
  32. package/dist/constants.js +0 -25
  33. package/dist/constants.js.map +0 -1
  34. package/dist/formatters.d.ts +0 -13
  35. package/dist/formatters.js +0 -130
  36. package/dist/formatters.js.map +0 -1
  37. package/dist/index.d.ts +0 -1
  38. package/dist/index.js +0 -2
  39. package/dist/index.js.map +0 -1
  40. package/dist/manifest.d.ts +0 -3
  41. package/dist/manifest.js +0 -125
  42. package/dist/manifest.js.map +0 -1
  43. package/dist/telegram-api.d.ts +0 -28
  44. package/dist/telegram-api.js +0 -147
  45. package/dist/telegram-api.js.map +0 -1
  46. package/dist/worker.d.ts +0 -1
  47. package/dist/worker.js +0 -300
  48. package/dist/worker.js.map +0 -1
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # paperclip-plugin-telegram
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/paperclip-plugin-telegram)](https://www.npmjs.com/package/paperclip-plugin-telegram)
4
+
3
5
  Bidirectional Telegram integration for [Paperclip](https://github.com/paperclipai/paperclip). Push agent notifications to Telegram, receive bot commands, approve requests with inline buttons, and route forum topics to projects.
4
6
 
5
7
  Built on the Paperclip plugin SDK and the domain event bridge ([PR #909](https://github.com/paperclipai/paperclip/pull/909)).
@@ -14,6 +16,7 @@ Built on the Paperclip plugin SDK and the domain event bridge ([PR #909](https:/
14
16
  - **Forum topic routing**: map Telegram topics to Paperclip projects
15
17
  - **Daily digest**: scheduled summary of agent activity
16
18
  - **MarkdownV2 formatting** with automatic plain text fallback
19
+ - **HITL escalation**: agents that get stuck can escalate to a dedicated channel with full conversation context, suggested replies, and approve/reject/override buttons. Configurable timeouts with automatic default actions.
17
20
 
18
21
  ## Setup
19
22
 
@@ -36,8 +39,15 @@ Find the `chat.id` field in the response. For groups, the ID is a negative numbe
36
39
  ### 3. Install the plugin
37
40
 
38
41
  ```bash
39
- # From your Paperclip directory
40
- pnpm paperclipai plugin install /path/to/paperclip-plugin-telegram
42
+ npm install paperclip-plugin-telegram
43
+ ```
44
+
45
+ Or register with your Paperclip instance directly:
46
+
47
+ ```bash
48
+ curl -X POST http://127.0.0.1:3100/api/plugins/install \
49
+ -H "Content-Type: application/json" \
50
+ -d '{"packageName":"paperclip-plugin-telegram"}'
41
51
  ```
42
52
 
43
53
  ### 4. Configure
@@ -54,6 +64,10 @@ In your Paperclip instance settings, configure:
54
64
  | `enableInbound` | No | Route Telegram replies to issues (default: true) |
55
65
  | `dailyDigestEnabled` | No | Send daily activity summary |
56
66
  | `topicRouting` | No | Map forum topics to projects |
67
+ | `escalationChatId` | No | Dedicated chat/topic for agent escalations |
68
+ | `escalationTimeoutMs` | No | Timeout before default action fires (default: 900000 / 15 min) |
69
+ | `escalationDefaultAction` | No | Action on timeout: `defer`, `close`, `retry`, `escalate_further` (default: `defer`) |
70
+ | `escalationHoldMessage` | No | Message sent to customer while waiting (default: "Let me check on that - I'll get back to you shortly.") |
57
71
 
58
72
  ### 5. Add bot to group (optional)
59
73
 
@@ -111,6 +125,8 @@ MIT
111
125
 
112
126
  ## Credits
113
127
 
114
- This contribution was developed with AI assistance (Claude Code).
128
+ [@MatB57](https://github.com/MatB57) - Escalation channel concept, "Chat OS" vision for turning chat plugins into bidirectional agent command centers, and the HITL suggested-reply flow.
129
+
130
+ [@leeknowsai](https://github.com/leeknowsai) - Worker bootstrap patterns adapted from the Discord plugin.
115
131
 
116
132
  Inspired by [OpenClaw's Telegram integration](https://github.com/openclaw/openclaw) (grammY, bidirectional messaging, inline buttons) and adapted for the Paperclip plugin SDK.
package/package.json CHANGED
@@ -1,15 +1,8 @@
1
1
  {
2
2
  "name": "paperclip-plugin-telegram",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
- "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/mvanhorn/paperclip-plugin-telegram.git"
10
- },
11
- "keywords": ["paperclip", "plugin", "telegram", "bot", "notifications", "acp"],
12
- "files": ["dist", "README.md"],
13
6
  "paperclipPlugin": {
14
7
  "manifest": "./dist/manifest.js",
15
8
  "worker": "./dist/worker.js"
@@ -21,8 +14,8 @@
21
14
  "test": "vitest run"
22
15
  },
23
16
  "peerDependencies": {
24
- "@paperclipai/plugin-sdk": "^1.0.0",
25
- "@paperclipai/shared": "^0.3.0"
17
+ "@paperclipai/plugin-sdk": ">=2026.0.0",
18
+ "@paperclipai/shared": ">=2026.0.0"
26
19
  },
27
20
  "devDependencies": {
28
21
  "@paperclipai/plugin-sdk": "^2026.318.0",