Class: Ace::LLM::Providers::CLI::Molecules::SessionFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/llm/providers/cli/molecules/session_finder.rb

Overview

Dispatches session detection to the appropriate provider-specific finder.

Used as a fallback when a provider doesn’t natively return a session_id. Each finder scans the provider’s local session storage and matches by prompt.

Constant Summary collapse

FINDERS =
{
  "claude" => Atoms::SessionFinders::ClaudeSessionFinder,
  "codex" => Atoms::SessionFinders::CodexSessionFinder,
  "pi" => Atoms::SessionFinders::PiSessionFinder,
  "gemini" => Atoms::SessionFinders::GeminiSessionFinder,
  "opencode" => Atoms::SessionFinders::OpenCodeSessionFinder
}.freeze

Class Method Summary collapse

Class Method Details

.call(provider:, working_dir:, prompt:) ⇒ Hash?

Returns { session_id:, session_path: } or nil.

Parameters:

  • provider (String)

    provider name

  • working_dir (String)

    project directory

  • prompt (String)

    the prompt sent to the provider

Returns:

  • (Hash, nil)

    { session_id:, session_path: } or nil



31
32
33
34
35
36
37
38
# File 'lib/ace/llm/providers/cli/molecules/session_finder.rb', line 31

def self.call(provider:, working_dir:, prompt:)
  finder = FINDERS[provider]
  return nil unless finder

  finder.call(working_dir: working_dir, prompt: prompt)
rescue
  nil
end