@herdctl/discord 0.1.0 → 0.1.1

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 (2) hide show
  1. package/README.md +181 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,181 @@
1
+ # @herdctl/discord
2
+
3
+ > Discord connector for herdctl fleet management
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@herdctl/discord.svg)](https://www.npmjs.com/package/@herdctl/discord)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ **Documentation**: [herdctl.dev](https://herdctl.dev)
9
+
10
+ ## Overview
11
+
12
+ `@herdctl/discord` enables your herdctl agents to interact via Discord. Users can chat with agents in DMs or channels, and agents can send notifications when jobs complete. The connector handles session management automatically, maintaining conversation context across messages.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @herdctl/discord
18
+ ```
19
+
20
+ > **Note**: This package is typically used automatically by `@herdctl/core` when Discord is configured in your agent YAML. Direct installation is only needed for advanced use cases.
21
+
22
+ ## Configuration
23
+
24
+ Add Discord chat configuration to your agent YAML:
25
+
26
+ ### DM-Only Bot (Simplest Setup)
27
+
28
+ ```yaml
29
+ name: my-assistant
30
+ model: claude-sonnet-4-20250514
31
+
32
+ chat:
33
+ discord:
34
+ bot_token_env: MY_ASSISTANT_DISCORD_TOKEN
35
+ guilds: [] # Empty array = no channel restrictions
36
+ dm:
37
+ enabled: true
38
+ mode: auto # Respond to all DMs automatically
39
+ ```
40
+
41
+ ### Channel-Based Bot
42
+
43
+ ```yaml
44
+ name: support-bot
45
+ model: claude-sonnet-4-20250514
46
+
47
+ chat:
48
+ discord:
49
+ bot_token_env: SUPPORT_BOT_DISCORD_TOKEN
50
+ guilds:
51
+ - id: "123456789012345678" # Your server ID
52
+ channels:
53
+ - id: "987654321098765432"
54
+ name: "#support" # Optional, for logging
55
+ mode: mention # Only respond when @mentioned
56
+ - id: "111222333444555666"
57
+ name: "#general"
58
+ mode: auto # Respond to all messages
59
+ dm:
60
+ enabled: true
61
+ mode: auto
62
+ ```
63
+
64
+ ### Full Configuration Reference
65
+
66
+ ```yaml
67
+ chat:
68
+ discord:
69
+ # Required: Environment variable containing bot token
70
+ bot_token_env: DISCORD_BOT_TOKEN
71
+
72
+ # Optional: Session expiry in hours (default: 24)
73
+ session_expiry_hours: 24
74
+
75
+ # Optional: Log verbosity (default: standard)
76
+ log_level: standard # minimal | standard | verbose
77
+
78
+ # Optional: Bot presence/activity
79
+ presence:
80
+ activity_type: watching # playing | watching | listening | competing
81
+ activity_message: "for support requests"
82
+
83
+ # Required: Guild (server) configurations (can be empty array for DM-only)
84
+ guilds:
85
+ - id: "123456789012345678"
86
+ channels:
87
+ - id: "987654321098765432"
88
+ name: "#support"
89
+ mode: mention # mention | auto
90
+ context_messages: 10 # Messages to include for context
91
+ # Per-guild DM settings (optional, overrides global)
92
+ dm:
93
+ enabled: true
94
+ mode: auto
95
+
96
+ # Optional: Global DM configuration
97
+ dm:
98
+ enabled: true
99
+ mode: auto # mention | auto
100
+ allowlist: ["user-id-1", "user-id-2"] # Only these users can DM
101
+ blocklist: ["blocked-user-id"] # These users cannot DM
102
+ ```
103
+
104
+ ### Chat Modes
105
+
106
+ - **`auto`** - Respond to all messages in allowed channels/DMs
107
+ - **`mention`** - Only respond when the bot is @mentioned
108
+
109
+ ## Multiple Bots / Multiple Agents
110
+
111
+ Each agent can have its own Discord bot with a unique token. Simply use different environment variable names:
112
+
113
+ ```yaml
114
+ # Agent 1: Support Bot
115
+ name: support-bot
116
+ chat:
117
+ discord:
118
+ bot_token_env: SUPPORT_BOT_TOKEN
119
+ # ...
120
+
121
+ # Agent 2: Developer Assistant
122
+ name: dev-assistant
123
+ chat:
124
+ discord:
125
+ bot_token_env: DEV_ASSISTANT_TOKEN
126
+ # ...
127
+ ```
128
+
129
+ Then set both environment variables:
130
+ ```bash
131
+ export SUPPORT_BOT_TOKEN="your-support-bot-token"
132
+ export DEV_ASSISTANT_TOKEN="your-dev-assistant-token"
133
+ ```
134
+
135
+ This allows you to run multiple agents with different Discord identities, each with their own bot user, avatar, and permissions.
136
+
137
+ ## Features
138
+
139
+ - **Conversation Continuity** - Sessions persist across messages using Claude SDK session resumption
140
+ - **DM Support** - Users can chat privately with agents
141
+ - **Channel Support** - Agents can participate in server channels
142
+ - **Per-Agent Bots** - Each agent can have its own Discord bot identity
143
+ - **Slash Commands** - Built-in `/status`, `/reset`, and `/help` commands
144
+ - **Typing Indicators** - Visual feedback while agent is processing
145
+ - **Message Splitting** - Long responses are automatically split to fit Discord's limits
146
+
147
+ ## Slash Commands
148
+
149
+ | Command | Description |
150
+ |---------|-------------|
151
+ | `/help` | Show available commands and usage |
152
+ | `/status` | Show agent status and current session info |
153
+ | `/reset` | Clear conversation context (start fresh) |
154
+
155
+ ## Bot Setup
156
+
157
+ 1. Create a Discord application at [discord.com/developers](https://discord.com/developers/applications)
158
+ 2. Add a bot to your application
159
+ 3. Enable the "Message Content Intent" in bot settings
160
+ 4. Generate an invite URL with these permissions:
161
+ - Send Messages
162
+ - Read Message History
163
+ - Use Slash Commands
164
+ 5. Invite the bot to your server
165
+ 6. Set your bot token as an environment variable (use a unique name per bot)
166
+
167
+ ## Documentation
168
+
169
+ For complete setup instructions, visit [herdctl.dev](https://herdctl.dev):
170
+
171
+ - [Discord Integration Guide](https://herdctl.dev/integrations/discord/)
172
+ - [Chat Configuration](https://herdctl.dev/configuration/agent/#chat)
173
+
174
+ ## Related Packages
175
+
176
+ - [`herdctl`](https://www.npmjs.com/package/herdctl) - CLI for running agent fleets
177
+ - [`@herdctl/core`](https://www.npmjs.com/package/@herdctl/core) - Core library for programmatic use
178
+
179
+ ## License
180
+
181
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herdctl/discord",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Discord connector for herdctl fleet management",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "discord.js": "^14.16.0",
15
15
  "yaml": "^2.3.0",
16
16
  "zod": "^3.22.0",
17
- "@herdctl/core": "1.0.0"
17
+ "@herdctl/core": "1.1.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@vitest/coverage-v8": "^4.0.17",