Class: Ace::Hitl::Molecules::ResumeDispatcher
- Inherits:
-
Object
- Object
- Ace::Hitl::Molecules::ResumeDispatcher
- Defined in:
- lib/ace/hitl/molecules/resume_dispatcher.rb
Overview
Dispatches resume signals to waiting agents. Primary path is provider/session resume; fallback path executes resume instructions.
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
Instance Method Details
#dispatch(event:, answer:, now: Time.now.utc) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ace/hitl/molecules/resume_dispatcher.rb', line 14 def dispatch(event:, answer:, now: Time.now.utc) session_id = event.["requester_session_id"].to_s.strip provider = event.["requester_provider"].to_s.strip instructions = event.["resume_instructions"].to_s.strip payload = build_payload(event: event, answer: answer, now: now) if !session_id.empty? && !provider.empty? resumed = dispatch_to_session(provider: provider, session_id: session_id, payload: payload) return resumed if resumed.success? end return failed("No resume instructions available") if instructions.empty? shell = run_shell(instructions) return ok(mode: "command", details: "resume_instructions") if shell[:status].success? failed("Resume command failed: #{stderr_or_stdout(shell)}") rescue StandardError => e failed("Resume dispatch exception: #{e.class}: #{e.}") end |