@goodandready/dsh-messenger-gateway 0.1.0 → 0.3.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.
package/README.md CHANGED
@@ -1,26 +1,24 @@
1
1
  # @goodandready/dsh-messenger-gateway
2
2
 
3
- Messenger transport for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness).
3
+ Telegram messenger bridge for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness).
4
4
 
5
- ## 0.1.0 scope (Telegram)
5
+ Talk to your Harness agent from Telegram: text, voice, photos, documents, inline buttons, named homes, and optional spoken replies.
6
6
 
7
- - Long-poll Telegram bot
8
- - Text, voice (`dsh-voice`), photos (`attachments` + `dsh-vision-bridge`), documents
9
- - Outbound images from tool results
10
- - `messenger` service: HTTP `/messenger/send`, `/ask`, `/progress` and `ctx.provide('messenger')`
11
- - Forum topics = separate agent sessions (`message_thread_id`)
12
- - Optional spoken replies (`dsh-tts`)
13
- - Commands: `/start` `/help` `/new` `/whoami` `/stop`
7
+ ## Features
14
8
 
15
- Discord adapter is a stub; full Discord support comes after 0.1.0.
9
+ - Long-poll or webhook Telegram bot
10
+ - Allowlist + pairing codes
11
+ - Per-user or per-chat sessions (`sessionScope`)
12
+ - Forum topics as separate sessions
13
+ - Steer: follow-up messages while the agent is busy (instead of aborting)
14
+ - `/stop`, `/new`, `/model`, `/status`, `/voice`, `/sethome`, `/home`
15
+ - Agent tool `messenger_ask` (inline keyboard answers return to the agent)
16
+ - Named homes for outbound notify / `messenger.send`
17
+ - Optional notify bridge: web session events → Telegram home (excludes messenger sessions)
18
+ - Inbound voice → STT (`dsh-voice`), photos → vision (`dsh-vision-bridge`)
19
+ - Optional TTS replies (`dsh-tts`); mp3 is converted to OGG/Opus via `ffmpeg` for Telegram voice notes
16
20
 
17
- ## Profile dependencies
18
-
19
- Install these plugins in the same Harness profile (they are not npm dependencies):
20
-
21
- - `dsh-voice` — inbound voice transcription
22
- - `dsh-tts` — optional spoken replies
23
- - `dsh-vision-bridge` — inbound photo understanding
21
+ Discord is listed in settings as a placeholder only — the Discord adapter is not implemented yet.
24
22
 
25
23
  ## Install
26
24
 
@@ -28,8 +26,59 @@ Install these plugins in the same Harness profile (they are not npm dependencies
28
26
  dsh plugin --profile web add @goodandready/dsh-messenger-gateway
29
27
  ```
30
28
 
31
- Settings **Messenger gateway** enable Telegram, paste bot token, set allowed user IDs.
29
+ Then open **SettingsPlugins Messenger gateway**:
30
+
31
+ 1. Enable Telegram
32
+ 2. Paste the BotFather token (write-only; leave blank to keep the current token)
33
+ 3. Set allowed Telegram user IDs (or use pairing)
34
+
35
+ ### Optional companion plugins (same profile)
36
+
37
+ | Plugin | Role |
38
+ |--------|------|
39
+ | `@goodandready/dsh-voice` | Transcribe inbound voice messages |
40
+ | `@goodandready/dsh-tts` | Speak agent replies |
41
+ | `@goodandready/dsh-vision-bridge` | Describe inbound photos |
42
+
43
+ They are **not** npm dependencies of this package — install them separately if you want those features.
44
+
45
+ ### Voice notes
46
+
47
+ Spoken replies use Telegram `sendVoice`. If TTS returns MP3 (or other non-Opus audio), the gateway runs `ffmpeg` (`libopus`) to produce OGG. If `ffmpeg` is missing or conversion fails, the audio is sent as a regular audio file instead of a voice note.
48
+
49
+ ## Commands (Telegram)
50
+
51
+ | Command | Description |
52
+ |---------|-------------|
53
+ | `/start` `/help` | Help |
54
+ | `/whoami` | Your Telegram user id |
55
+ | `/new` | New agent session |
56
+ | `/stop` | Abort the current turn |
57
+ | `/model` `/status` | Model / gateway status |
58
+ | `/voice on\|off` | Per-user spoken replies |
59
+ | `/sethome [name]` | Bind current chat/topic as a named home |
60
+ | `/home` | List homes |
61
+
62
+ ## Agent tools & HTTP
63
+
64
+ - Tool: `messenger_ask` — ask the user with inline buttons; choice is fed back into the turn
65
+ - HTTP (when enabled): `/messenger/send`, `/messenger/ask`, `/messenger/progress`
66
+ - Cordis service: `ctx.messenger` for other plugins
67
+
68
+ ## Configuration notes
69
+
70
+ - `sessionScope`: `user` (default) or `chat` — how group chats isolate sessions
71
+ - `voiceMode`: `mirror` / `always` / `off` — when to speak replies (also `/voice`)
72
+ - `tts.enabled` / `tts.maxChars` — TTS gate and length cap
73
+ - `notifyBridge` — forward non-messenger web session events to a home
74
+ - Bot token is a DSH secret field — never commit it
75
+
76
+ ## Requirements
77
+
78
+ - DeepSeek Harness web (or compatible) profile
79
+ - Node.js matching your Harness install
80
+ - For voice notes from non-Opus TTS: `ffmpeg` on the host `PATH`
32
81
 
33
- See `docs/deployment/0.1.0-install.md` for staging smoke and prod swap vs legacy hub-media.
82
+ ## License
34
83
 
35
84
  MIT
@@ -1,7 +1,7 @@
1
1
  import { TelegramAdapter } from './telegram.js'
2
2
 
3
3
  export default function createAdapters(deps) {
4
- const { config, onMessage, onCallback, logger } = deps
4
+ const { config, onMessage, onCallback, onUnauthorized, isUserAllowed, logger } = deps
5
5
  const list = []
6
6
  const tg = config.telegram || {}
7
7
  if (config.enabled !== false && tg.enabled && String(tg.botToken || '').trim()) {
@@ -10,9 +10,22 @@ export default function createAdapters(deps) {
10
10
  allowedUserIds: tg.allowedUserIds,
11
11
  timeoutSeconds: tg.pollTimeoutSeconds,
12
12
  pollIntervalMs: tg.pollIntervalMs,
13
+ commands: tg.commands,
14
+ textFormat: tg.textFormat,
15
+ groupsEnabled: tg.groupsEnabled,
16
+ groupRequireMention: tg.groupRequireMention,
17
+ reactionsEnabled: tg.reactionsEnabled,
18
+ statusIndicator: tg.statusIndicator,
19
+ statusOnline: tg.statusOnline,
20
+ statusOffline: tg.statusOffline,
21
+ transport: tg.transport,
22
+ webhookUrl: tg.webhookUrl,
23
+ webhookSecret: tg.webhookSecret,
13
24
  media: config.media,
14
25
  onMessage,
15
26
  onCallback,
27
+ onUnauthorized,
28
+ isUserAllowed,
16
29
  logger,
17
30
  }))
18
31
  }
@@ -21,4 +34,4 @@ export default function createAdapters(deps) {
21
34
  logger?.warn?.('dsh-messenger-gateway: discord adapter is not implemented yet')
22
35
  }
23
36
  return list
24
- }
37
+ }