legionio 1.6.29 → 1.6.31

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: f3a73a5c562d8c349f10592682acdfebc23bd0d5bc3cea80286be00d8b72aff4
4
- data.tar.gz: a789defca2fbe696da75046a45f003eb49e6247fb102e5994d3a9bb57c8b9edf
3
+ metadata.gz: 56ff571f5c8480be8a6e783549dd9cd377805dd5590e0e07a7fa60f2f0da39da
4
+ data.tar.gz: 6d6251a3b04602caffb8e76b12fc1677c7caf1981a5e7f9cd73c1bea52bf97d6
5
5
  SHA512:
6
- metadata.gz: 734077acd813bbc111cb6613f8046873370d5db6f1c6208127eefefa318ea4afbe947205f721cbd2d2e08b47166f315735fbdb6fd64a69a376bff8cee9ec7986
7
- data.tar.gz: ed8bbee89db76679597caade809ebc1a6ceb5ac2c7664456f01e693ac3cf899d28716dc493de2911bf723e02c15ec56d135326a8fbdaf4fb7870434b8bfef3a7
6
+ metadata.gz: 9b40b7e385bfa89fd4642ea18bc0bc014ba6407dc182f3ffbb8462963e45c9afffa0471015cda08a77c78ad71eabb31709cfe69a967653ae531c3457e5b90419
7
+ data.tar.gz: c6fa233e90846bf0296f1f9ba3adf171d9ccfa34d224de96fcd721e1e013218c3cfc778988a80d661d57a93ca1002a1b57ffba0a75033aa40b657b1f92c2e9f3
data/CHANGELOG.md CHANGED
@@ -2,8 +2,23 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.6.31] - 2026-03-28
6
+
7
+ ### Fixed
8
+ - `build_hook_list` in `Builders::Hooks` now calls `runner_class` on a hook instance (instance method) instead of the class, preventing the `TypeError: no implicit conversion of nil into String` boot crash caused by `Helpers::Base#runner_class` being inherited at the class level and calling `sub!` on a string that contains no `'Actor'` substring
9
+ - `Helpers::Base#runner_class` changed `sub!` to `sub` (non-destructive) as a defensive fix — `sub!` returns `nil` when no substitution is made, which caused `Kernel.const_get(nil)` to raise `TypeError`
10
+ - Runner reference returned by `hook_class.new.runner_class` is now resolved safely: string class names are resolved via `Kernel.const_defined?` + `Kernel.const_get`; Class objects are used directly; `nil` falls back to `hook_class`
11
+
12
+ ## [1.6.30] - 2026-03-28
13
+
14
+ ### Fixed
15
+ - `Legion::Extensions::Hooks::Base` now defines the `mount(path)` DSL method and `mount_path` reader — fixes `NoMethodError` boot crash in any extension hook that calls `mount` (e.g. `lex-microsoft_teams` `Hooks::Auth`)
16
+
5
17
  ## [1.6.29] - 2026-03-28
6
18
 
19
+ ### Removed
20
+ - `ClassMethods` module (`expose_as_mcp_tool`, `mcp_tool_prefix`) from `Legion::Extensions::Helpers::Lex` — deprecated since the definition DSL was introduced; zero extensions use them
21
+
7
22
  ### Fixed
8
23
  - Fallback route guards in `api.rb` now check `router.library_names.include?` instead of `defined?` — prevents 404s when gem modules are loaded but routes are not yet mounted (fixes #53)
9
24
 
@@ -29,7 +29,7 @@ module Legion
29
29
  next unless hook_class < Legion::Extensions::Hooks::Base
30
30
 
31
31
  route_path = "#{extension_name}/#{hook_name}"
32
- runner = hook_class.respond_to?(:runner_class) ? hook_class.runner_class : nil
32
+ runner = resolve_hook_runner(hook_class)
33
33
 
34
34
  @hooks[hook_name.to_sym] = {
35
35
  extension: lex_class.to_s.downcase,
@@ -61,6 +61,17 @@ module Legion
61
61
  def hook_files
62
62
  @hook_files ||= find_files('hooks')
63
63
  end
64
+
65
+ private
66
+
67
+ def resolve_hook_runner(hook_class)
68
+ ref = hook_class.new.runner_class
69
+ if ref.is_a?(String)
70
+ Kernel.const_defined?(ref) ? Kernel.const_get(ref) : nil
71
+ elsif ref.is_a?(Class)
72
+ ref
73
+ end
74
+ end
64
75
  end
65
76
  end
66
77
  end
@@ -83,7 +83,7 @@ module Legion
83
83
  end
84
84
 
85
85
  def runner_class
86
- @runner_class ||= Kernel.const_get(actor_class.to_s.sub!('Actor', 'Runners'))
86
+ @runner_class ||= Kernel.const_get(actor_class.to_s.sub('Actor', 'Runners'))
87
87
  end
88
88
 
89
89
  def runner_name
@@ -12,32 +12,6 @@ module Legion
12
12
  include Legion::JSON::Helper
13
13
  include Legion::Extensions::Helpers::Secret
14
14
 
15
- module ClassMethods
16
- # @deprecated Use mcp_exposed: flag in definition DSL instead
17
- def expose_as_mcp_tool(value = :_unset)
18
- if value == :_unset
19
- return @expose_as_mcp_tool unless @expose_as_mcp_tool.nil?
20
-
21
- if defined?(Legion::Settings) && Legion::Settings.respond_to?(:dig)
22
- Legion::Settings.dig(:mcp, :auto_expose_runners) || false
23
- else
24
- false
25
- end
26
- else
27
- @expose_as_mcp_tool = value
28
- end
29
- end
30
-
31
- # @deprecated Use mcp_exposed: flag in definition DSL instead
32
- def mcp_tool_prefix(value = :_unset)
33
- if value == :_unset
34
- @mcp_tool_prefix
35
- else
36
- @mcp_tool_prefix = value
37
- end
38
- end
39
- end
40
-
41
15
  def runner_desc(desc)
42
16
  settings[:runners] = {} if settings[:runners].nil?
43
17
  settings[:runners][actor_name.to_sym] = {} if settings[:runners][actor_name.to_sym].nil?
@@ -47,7 +21,6 @@ module Legion
47
21
  def self.included(base)
48
22
  base.send :extend, Legion::Extensions::Helpers::Core if base.instance_of?(Class)
49
23
  base.send :extend, Legion::Extensions::Helpers::Logger if base.instance_of?(Class)
50
- base.extend ClassMethods if base.instance_of?(Class)
51
24
  base.extend base if base.instance_of?(Module)
52
25
  end
53
26
 
@@ -47,8 +47,14 @@ module Legion
47
47
  @verify_config = { header: header.upcase.tr('-', '_'), secret: secret }
48
48
  end
49
49
 
50
+ # DSL: declare a sub-path suffix appended to the auto-generated hook route
51
+ # mount '/callback' # e.g. /api/extensions/microsoft_teams/hooks/auth/callback
52
+ def mount(path)
53
+ @mount_path = path
54
+ end
55
+
50
56
  attr_reader :route_type, :route_header_name, :route_field_name,
51
- :route_mapping, :verify_type, :verify_config
57
+ :route_mapping, :verify_type, :verify_config, :mount_path
52
58
  end
53
59
 
54
60
  # Instance methods called by the API layer
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Legion
4
- VERSION = '1.6.29'
4
+ VERSION = '1.6.31'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legionio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.29
4
+ version: 1.6.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity