Module: RubyLlmMesh::NativeCore::Fallback

Defined in:
lib/ruby_llm_mesh/native_core.rb

Overview

Pure-Ruby stand-in when the native library is not compiled.

Class Method Summary collapse

Class Method Details

.execute_wasm_payload(intent) ⇒ Object



176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/ruby_llm_mesh/native_core.rb', line 176

def execute_wasm_payload(intent)
  port = @mutex.synchronize { @port }
  alive = @mutex.synchronize { @alive }
  JSON.generate(
    ok: true,
    engine: "ruby_fallback",
    mode: "pure_ruby",
    alive: alive,
    port: port,
    intent: intent.to_s,
    output: "Fallback mesh executed intent (#{intent.to_s[0, 64]})"
  )
end

.node_alive?Boolean

Returns:

  • (Boolean)


172
173
174
# File 'lib/ruby_llm_mesh/native_core.rb', line 172

def node_alive?
  @mutex.synchronize { @alive }
end

.reset!Object



190
191
192
193
194
195
# File 'lib/ruby_llm_mesh/native_core.rb', line 190

def reset!
  @mutex.synchronize do
    @alive = false
    @port = nil
  end
end

.start_node(port) ⇒ Object



156
157
158
159
160
161
162
# File 'lib/ruby_llm_mesh/native_core.rb', line 156

def start_node(port)
  @mutex.synchronize do
    @port = Integer(port)
    @alive = true
  end
  true
end

.stop_nodeObject



164
165
166
167
168
169
170
# File 'lib/ruby_llm_mesh/native_core.rb', line 164

def stop_node
  @mutex.synchronize do
    @alive = false
    @port = nil
  end
  true
end