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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 902a34c15b9fa06e60e4b8eb040d57126bbdf9f725d2e727634ed4e73d8fbaa0
4
- data.tar.gz: cda463c1023ad995a8143d52702a6b8098dbcdd3cde4e2002352c327a536109e
3
+ metadata.gz: 4605d79e21eecd9bdcc4d48ffee20e04f3881dbe285201887f997aefaefd13e6
4
+ data.tar.gz: f6b0f23b20d640d9f0e8d266f41a9c88dc6e1eb76c2d5185a5f05d30dae17890
5
5
  SHA512:
6
- metadata.gz: 6380481f86f277205aa2aadac23745cf7f5fe5785b8f5ce8272c64fd26206166814434f06bbcf97494f6f1d75a08e69657721fd5423e62898a7c1e5d7312347f
7
- data.tar.gz: adffc1e8afa7ad60469c03df75427284c988c8b1e64f954571435441397e66cd3d597906feb2fa953e19575432b27b7583bfcea0e73bc4cbc49cdd19e32bc2d0
6
+ metadata.gz: 28c4cb1aeef7d423f014c1fab6737f7dee89cd68a2a38380b708312c16d2f7c069d645078c013fc770fae005d8eb7e4bd118120aca0aac3eb7a22bafedecb995
7
+ data.tar.gz: 42b4f79d3d649a985c68d694fd390cc97f34982f5c4ea6c790845336e8723ab646eff7f814c56eed4a21c1946db8671b71564ffab25d609796a4f6595a0da5ed
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.12.0]
6
+
7
+ - Add `slack_allowed_usernames` to restrict Slack channel access
8
+
5
9
  ## [0.11.0]
6
10
 
7
11
  - Add Slack channel integration with system instructions and connection pooling
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] }
@@ -1,3 +1,3 @@
1
1
  module ConsoleAgent
2
- VERSION = '0.11.0'.freeze
2
+ VERSION = '0.12.0'.freeze
3
3
  end
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cortfr