brainiac-zoho 0.0.1 → 0.0.3

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: 386e959b01ecbdba6859b7256d0af025b4f76efe95c77e497ff78a761ee5fd5e
4
- data.tar.gz: e035b1208494431bf24a56891fc998000567e4c49bae08edbe1b24b4145d816a
3
+ metadata.gz: f3acff47990af640d828a95ba79aea6c15e1e16bbe76239fe9ea74ec9f529bfb
4
+ data.tar.gz: 948fa2fee5a0a56d12bc18fcc229202c7bfabd010ca35c7b3556bbdbb4be5c87
5
5
  SHA512:
6
- metadata.gz: 2bf6504d360b62f1626d6fd2db180be29fd24e2efa16a47e1fa04a7e9731af005bd223e61a46eeff4eab9c36489477435debcd0b79e31ab64c8b642297cef8d7
7
- data.tar.gz: ebc6c1dd39d5d79601da0a58ae9b07612159cbbb49a281a7b0276be6cf2930bdf0ebfb8fd33db1d970f5ca594336e6626754203fb2bcad27ef123642e5feddf0
6
+ metadata.gz: b179cea2f12b99817495762ad360125915dcd7908500a485310cfeafdf74ff47211d6ef44d5a0af2e419580aaec4e1e6b8f3b40af1484cdbb64d4c66ea32e3e0
7
+ data.tar.gz: 68670e1a970f8401105fd0b8ec9af379bd1b72d0038dabdadd8c6a3c8fd8d2540faa33cb8dac645b33102d793cbce674d29ab59cfc6cf3c3c74e832c62ce50df
@@ -32,7 +32,8 @@ module Brainiac
32
32
  puts "Created #{config_file} from template"
33
33
  else
34
34
  puts "Template not found — creating minimal config"
35
- default_config = { "hook_secret" => nil, "default_discord_channel_id" => "", "rules" => [], "fallback" => { "enabled" => true } }
35
+ default_config = { "hook_secret" => nil, "default_notify_target" => "", "notify_channel" => "discord", "rules" => [],
36
+ "fallback" => { "enabled" => true } }
36
37
  File.write(config_file, JSON.pretty_generate(default_config))
37
38
  puts "Created #{config_file}"
38
39
  end
@@ -54,7 +55,8 @@ module Brainiac
54
55
  puts "Zoho Configuration:"
55
56
  puts " Config file: #{config_file}"
56
57
  puts " Hook secret: #{config["hook_secret"] ? "captured" : "(pending — waiting for first webhook)"}"
57
- puts " Default channel: #{config["default_discord_channel_id"] || "(not set)"}"
58
+ puts " Default channel: #{config["default_notify_target"] || "(not set)"}"
59
+ puts " Notify channel: #{config["notify_channel"] || "discord"}"
58
60
  puts " Notify as: #{config["notify_as"] || "(default)"}"
59
61
  puts " Rules: #{rules.size} configured"
60
62
  rules.each { |r| puts " - #{r["label"]} (#{r["enabled"] == false ? "disabled" : "enabled"})" }
@@ -36,7 +36,7 @@ module Brainiac
36
36
  end
37
37
 
38
38
  def default_notify_target
39
- @config["default_notify_target"] || @config["default_discord_channel_id"]
39
+ @config["default_notify_target"]
40
40
  end
41
41
 
42
42
  def notify_channel
@@ -70,7 +70,7 @@ module Brainiac
70
70
  end
71
71
 
72
72
  def notify_match(email, rule)
73
- target = rule["notify_target"] || rule["discord_channel_id"] || Config.default_notify_target
73
+ target = rule["notify_target"] || Config.default_notify_target
74
74
  channel = rule["notify_channel"] || Config.notify_channel
75
75
 
76
76
  unless target
@@ -107,7 +107,8 @@ module Brainiac
107
107
 
108
108
  { "label" => fallback["label"] || "Unmatched Email",
109
109
  "emoji" => fallback["emoji"] || "📬",
110
- "discord_channel_id" => fallback["discord_channel_id"],
110
+ "notify_target" => fallback["notify_target"],
111
+ "notify_channel" => fallback["notify_channel"],
111
112
  "notify_as" => fallback["notify_as"] }
112
113
  end
113
114
 
@@ -68,6 +68,13 @@ module Brainiac
68
68
  class << self
69
69
  def dispatch(email, rule)
70
70
  agent_name = rule["dispatch_agent"]
71
+
72
+ email_message = "#{email["subject"]} #{email["fromAddress"]}"
73
+ if intent_skip?(email_message, agent_name: agent_name, source: :zoho, channel: "Zoho email triage")
74
+ LOG.info "[Zoho:Triage] Intent skip — not dispatching #{agent_name} for: #{email["subject"]}" if defined?(LOG)
75
+ return nil
76
+ end
77
+
71
78
  timestamp = Time.now.strftime("%Y%m%d-%H%M%S")
72
79
  triage_dir = File.join(ENV.fetch("BRAINIAC_DIR", File.join(Dir.home, ".brainiac")), "tmp", "zoho", "triage")
73
80
  FileUtils.mkdir_p(triage_dir)
@@ -171,7 +178,7 @@ module Brainiac
171
178
  end
172
179
 
173
180
  def execute_decision(decision, email, rule)
174
- channel_id = rule["notify_target"] || rule["discord_channel_id"] || Config.default_notify_target
181
+ channel_id = rule["notify_target"] || Config.default_notify_target
175
182
  notify_channel = rule["notify_channel"] || Config.notify_channel
176
183
  bot_name = rule["notify_as"] || Config.notify_as
177
184
 
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Zoho
6
- VERSION = "0.0.1"
6
+ VERSION = "0.0.3"
7
7
  end
8
8
  end
9
9
  end
@@ -37,7 +37,8 @@ module Brainiac
37
37
  else
38
38
  default_config = {
39
39
  "hook_secret" => nil,
40
- "default_discord_channel_id" => "",
40
+ "default_notify_target" => "",
41
+ "notify_channel" => "discord",
41
42
  "notify_as" => "merlin",
42
43
  "rules" => [],
43
44
  "fallback" => { "enabled" => true, "label" => "Unmatched Email", "emoji" => "📬" }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainiac-zoho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 0.0.9
18
+ version: 0.0.14
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 0.0.9
25
+ version: 0.0.14
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: minitest
28
28
  requirement: !ruby/object:Gem::Requirement