collavre_openclaw 0.6.1 → 0.6.2

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: '09c2c291bce3fdf441d7c93dacf44883ca47804db6abb38d78b3ea70a412deaf'
4
- data.tar.gz: 8bd10b6c57adedb5e655b23688088a1be0d8c2e97dca6300ef7470b1a28c8c33
3
+ metadata.gz: bd95c0741d901e7dd551d64362a7cce7d0b0f7f9b4a87a3469990ccc1479e340
4
+ data.tar.gz: 7db937c777a492b23e19037e83bf3dd4245a46ff8333e9de6c6e9e55e2960f81
5
5
  SHA512:
6
- metadata.gz: ba347bb7844c93e96b5601f728267df346ba28b78458d77e0ea8a8f83ceb77fc83127ddad0dd164704f8bad95701df1838ac636e8c59aaa356bab07c63e5d58d
7
- data.tar.gz: 90b4555d3b69f2f0489dff54e6f326b4ee57404989e1ef7068a2b91d8761541ddf42be7154ed6e0a7b8e5f536d6408441b3412997731c3868c603fb3e25a7122
6
+ metadata.gz: 701cfb138ae6d0f25da60fcea13e56970647490ec32ab24cb6ec26e06c93ea250f9af1efed0fc9ddc7790b4f8d703e5ca7b2c8730902720e1a0e2d061216c6f9
7
+ data.tar.gz: 53315260ffb37347b9289080de544e65b19b207943d8784a341eeda0d042175e80753d3a43bf70f42b0ec087ba919827ed7fc50338dbf5d68d63a6daafd40039
@@ -571,8 +571,16 @@ module CollavreOpenclaw
571
571
 
572
572
  host = options[:host]
573
573
  host ||= Rails.application.config.action_controller.default_url_options&.dig(:host)
574
- host ||= ENV["APP_HOST"]
575
- host ||= ENV["RAILS_HOST"]
574
+ # When the engine is mounted without core Collavre (gemspec has no `collavre`
575
+ # dependency), `IntegrationSettings` is undefined — fall back to the ENV
576
+ # path the previous code used so standalone deployments still resolve a host.
577
+ if defined?(Collavre::IntegrationSettings)
578
+ host ||= Collavre::IntegrationSettings.fetch(:app_host)
579
+ host ||= Collavre::IntegrationSettings.fetch(:rails_host)
580
+ else
581
+ host ||= ENV["APP_HOST"]
582
+ host ||= ENV["RAILS_HOST"]
583
+ end
576
584
 
577
585
  result = { host: host }
578
586
  result[:protocol] = options[:protocol] || "https"
@@ -0,0 +1,13 @@
1
+ # Register collavre_openclaw integration setting keys with the central registry.
2
+ # Registered eagerly because `CollavreOpenclaw::Configuration#initialize` reads
3
+ # them at boot via `Collavre::IntegrationSettings.fetch`.
4
+ if defined?(Collavre::IntegrationSettings::Registry)
5
+ registry = Collavre::IntegrationSettings::Registry.instance
6
+ registry.register(:openclaw_open_timeout, category: "openclaw", sensitive: false, requires_restart: true)
7
+ registry.register(:openclaw_max_retries, category: "openclaw", sensitive: false, requires_restart: true)
8
+ registry.register(:openclaw_ws_idle_timeout, category: "openclaw", sensitive: false, requires_restart: true)
9
+ registry.register(:openclaw_ws_reconnect_max, category: "openclaw", sensitive: false, requires_restart: true)
10
+ registry.register(:openclaw_ws_reconnect_base, category: "openclaw", sensitive: false, requires_restart: true)
11
+ registry.register(:openclaw_ws_connect_timeout, category: "openclaw", sensitive: false, requires_restart: true)
12
+ registry.register(:openclaw_transport, category: "openclaw", sensitive: false, requires_restart: true)
13
+ end
@@ -26,18 +26,18 @@ module CollavreOpenclaw
26
26
  attr_accessor :transport
27
27
 
28
28
  def initialize
29
- @open_timeout = ENV.fetch("OPENCLAW_OPEN_TIMEOUT", 10).to_i
29
+ @open_timeout = fetch_int(:openclaw_open_timeout, 10)
30
30
  @read_timeout = begin
31
31
  Collavre::SystemSetting.llm_request_timeout_seconds
32
32
  rescue StandardError
33
33
  1800
34
34
  end
35
- @max_retries = ENV.fetch("OPENCLAW_MAX_RETRIES", 2).to_i
36
- @ws_idle_timeout = ENV.fetch("OPENCLAW_WS_IDLE_TIMEOUT", 1800).to_i # 30 minutes
37
- @ws_reconnect_max = ENV.fetch("OPENCLAW_WS_RECONNECT_MAX", 10).to_i
38
- @ws_reconnect_base_delay = ENV.fetch("OPENCLAW_WS_RECONNECT_BASE", 1).to_f
39
- @ws_connect_timeout = ENV.fetch("OPENCLAW_WS_CONNECT_TIMEOUT", 10).to_i
40
- @transport = ENV.fetch("OPENCLAW_TRANSPORT", "auto")
35
+ @max_retries = fetch_int(:openclaw_max_retries, 2)
36
+ @ws_idle_timeout = fetch_int(:openclaw_ws_idle_timeout, 1800) # 30 minutes
37
+ @ws_reconnect_max = fetch_int(:openclaw_ws_reconnect_max, 10)
38
+ @ws_reconnect_base_delay = fetch_float(:openclaw_ws_reconnect_base, 1)
39
+ @ws_connect_timeout = fetch_int(:openclaw_ws_connect_timeout, 10)
40
+ @transport = fetch_string(:openclaw_transport, "auto")
41
41
  end
42
42
 
43
43
  # Legacy accessor for backward compatibility
@@ -48,5 +48,30 @@ module CollavreOpenclaw
48
48
  def request_timeout=(value)
49
49
  @read_timeout = value
50
50
  end
51
+
52
+ private
53
+
54
+ def fetch_raw(key)
55
+ if defined?(Collavre::IntegrationSettings)
56
+ Collavre::IntegrationSettings.fetch(key)
57
+ else
58
+ ENV[key.to_s.upcase]
59
+ end
60
+ end
61
+
62
+ def fetch_string(key, default)
63
+ raw = fetch_raw(key)
64
+ raw.presence || default
65
+ end
66
+
67
+ def fetch_int(key, default)
68
+ raw = fetch_raw(key)
69
+ raw.present? ? raw.to_i : default
70
+ end
71
+
72
+ def fetch_float(key, default)
73
+ raw = fetch_raw(key)
74
+ raw.present? ? raw.to_f : default
75
+ end
51
76
  end
52
77
  end
@@ -33,6 +33,18 @@ module CollavreOpenclaw
33
33
  end
34
34
  end
35
35
 
36
+ # Register host keys consumed by `OpenclawAdapter#default_url_options` so
37
+ # the umbrella app's `integration_settings_app.rb` initializer is not
38
+ # required for ENV fallback to work. `register` is idempotent — the
39
+ # umbrella app may re-register without conflict.
40
+ initializer "collavre_openclaw.integration_settings_registry", before: :load_config_initializers do
41
+ if defined?(Collavre::IntegrationSettings::Registry)
42
+ registry = Collavre::IntegrationSettings::Registry.instance
43
+ registry.register(:app_host, category: "mail", sensitive: false, requires_restart: false)
44
+ registry.register(:rails_host, category: "mail", sensitive: false, requires_restart: false)
45
+ end
46
+ end
47
+
36
48
  initializer "collavre_openclaw.migrations" do |app|
37
49
  unless app.root.to_s.match?(root.to_s)
38
50
  config.paths["db/migrate"].expanded.each do |expanded_path|
@@ -1,3 +1,3 @@
1
1
  module CollavreOpenclaw
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collavre_openclaw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Collavre
@@ -88,6 +88,7 @@ files:
88
88
  - app/services/collavre_openclaw/proactive_message_handler.rb
89
89
  - app/services/collavre_openclaw/websocket_client.rb
90
90
  - config/initializers/ai_client_extension.rb
91
+ - config/initializers/integration_settings.rb
91
92
  - config/locales/en.yml
92
93
  - config/locales/ko.yml
93
94
  - config/routes.rb