console_agent 0.11.0 → 0.12.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +3 -0
- data/lib/console_agent/configuration.rb +2 -1
- data/lib/console_agent/slack_bot.rb +8 -0
- data/lib/console_agent/version.rb +1 -1
- data/lib/generators/console_agent/templates/initializer.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4605d79e21eecd9bdcc4d48ffee20e04f3881dbe285201887f997aefaefd13e6
|
|
4
|
+
data.tar.gz: f6b0f23b20d640d9f0e8d266f41a9c88dc6e1eb76c2d5185a5f05d30dae17890
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28c4cb1aeef7d423f014c1fab6737f7dee89cd68a2a38380b708312c16d2f7c069d645078c013fc770fae005d8eb7e4bd118120aca0aac3eb7a22bafedecb995
|
|
7
|
+
data.tar.gz: 42b4f79d3d649a985c68d694fd390cc97f34982f5c4ea6c790845336e8723ab646eff7f814c56eed4a21c1946db8671b71564ffab25d609796a4f6595a0da5ed
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -232,6 +232,9 @@ ConsoleAgent.configure do |config|
|
|
|
232
232
|
|
|
233
233
|
# Optional: restrict to specific Slack channel IDs
|
|
234
234
|
# config.slack_channel_ids = 'C1234567890,C0987654321'
|
|
235
|
+
|
|
236
|
+
# Required: which users the bot responds to (by display name)
|
|
237
|
+
config.slack_allowed_usernames = ['alice', 'bob'] # or 'ALL' for everyone
|
|
235
238
|
end
|
|
236
239
|
```
|
|
237
240
|
|
|
@@ -21,7 +21,7 @@ module ConsoleAgent
|
|
|
21
21
|
:session_logging, :connection_class,
|
|
22
22
|
:admin_username, :admin_password,
|
|
23
23
|
:authenticate,
|
|
24
|
-
:slack_bot_token, :slack_app_token, :slack_channel_ids,
|
|
24
|
+
:slack_bot_token, :slack_app_token, :slack_channel_ids, :slack_allowed_usernames,
|
|
25
25
|
:local_url, :local_model, :local_api_key
|
|
26
26
|
|
|
27
27
|
def initialize
|
|
@@ -46,6 +46,7 @@ module ConsoleAgent
|
|
|
46
46
|
@slack_bot_token = nil
|
|
47
47
|
@slack_app_token = nil
|
|
48
48
|
@slack_channel_ids = nil
|
|
49
|
+
@slack_allowed_usernames = nil
|
|
49
50
|
@local_url = 'http://localhost:11434'
|
|
50
51
|
@local_model = 'qwen2.5:7b'
|
|
51
52
|
@local_api_key = nil
|
|
@@ -17,6 +17,7 @@ module ConsoleAgent
|
|
|
17
17
|
|
|
18
18
|
raise ConfigurationError, "SLACK_BOT_TOKEN is required" unless @bot_token
|
|
19
19
|
raise ConfigurationError, "SLACK_APP_TOKEN is required (Socket Mode)" unless @app_token
|
|
20
|
+
raise ConfigurationError, "slack_allowed_usernames must be configured (e.g. ['alice'] or 'ALL')" unless ConsoleAgent.configuration.slack_allowed_usernames
|
|
20
21
|
|
|
21
22
|
@bot_user_id = nil
|
|
22
23
|
@sessions = {} # thread_ts → { channel:, engine:, thread: }
|
|
@@ -241,6 +242,13 @@ module ConsoleAgent
|
|
|
241
242
|
user_id = event[:user]
|
|
242
243
|
user_name = resolve_user_name(user_id)
|
|
243
244
|
|
|
245
|
+
allowed_list = Array(ConsoleAgent.configuration.slack_allowed_usernames).map(&:to_s).map(&:downcase)
|
|
246
|
+
unless allowed_list.include?('all') || allowed_list.include?(user_name.to_s.downcase)
|
|
247
|
+
puts "[#{channel_id}/#{thread_ts}] @#{user_name} << (ignored — not in allowed usernames)"
|
|
248
|
+
post_message(channel: channel_id, thread_ts: thread_ts, text: "Sorry, I don't recognize your username (@#{user_name}). Ask an admin to add you to the allowed usernames list.")
|
|
249
|
+
return
|
|
250
|
+
end
|
|
251
|
+
|
|
244
252
|
puts "[#{channel_id}/#{thread_ts}] @#{user_name} << #{text.strip}"
|
|
245
253
|
|
|
246
254
|
session = @mutex.synchronize { @sessions[thread_ts] }
|
|
@@ -29,6 +29,10 @@ ConsoleAgent.configure do |config|
|
|
|
29
29
|
# config.local_model = 'qwen2.5:7b'
|
|
30
30
|
# config.local_api_key = nil
|
|
31
31
|
|
|
32
|
+
# Slack: which users the bot responds to (required for Slack mode)
|
|
33
|
+
# config.slack_allowed_usernames = ['alice', 'bob'] # specific users
|
|
34
|
+
# config.slack_allowed_usernames = 'ALL' # everyone
|
|
35
|
+
|
|
32
36
|
# Debug mode: prints full API requests/responses and tool calls to stderr
|
|
33
37
|
# config.debug = true
|
|
34
38
|
|