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 +4 -4
- data/lib/brainiac/plugins/zoho/cli.rb +4 -2
- data/lib/brainiac/plugins/zoho/config.rb +1 -1
- data/lib/brainiac/plugins/zoho/handler.rb +3 -2
- data/lib/brainiac/plugins/zoho/triage.rb +8 -1
- data/lib/brainiac/plugins/zoho/version.rb +1 -1
- data/lib/brainiac/plugins/zoho.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f3acff47990af640d828a95ba79aea6c15e1e16bbe76239fe9ea74ec9f529bfb
|
|
4
|
+
data.tar.gz: 948fa2fee5a0a56d12bc18fcc229202c7bfabd010ca35c7b3556bbdbb4be5c87
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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, "
|
|
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["
|
|
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"})" }
|
|
@@ -70,7 +70,7 @@ module Brainiac
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def notify_match(email, rule)
|
|
73
|
-
target = rule["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
|
-
"
|
|
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"] ||
|
|
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
|
|
|
@@ -37,7 +37,8 @@ module Brainiac
|
|
|
37
37
|
else
|
|
38
38
|
default_config = {
|
|
39
39
|
"hook_secret" => nil,
|
|
40
|
-
"
|
|
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.
|
|
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.
|
|
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.
|
|
25
|
+
version: 0.0.14
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: minitest
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|