Module: Harnex::Adapters

Defined in:
lib/harnex/adapters.rb,
lib/harnex/adapters/base.rb,
lib/harnex/adapters/codex.rb,
lib/harnex/adapters/claude.rb,
lib/harnex/adapters/generic.rb,
lib/harnex/adapters/codex_appserver.rb

Defined Under Namespace

Classes: Base, Claude, Codex, CodexAppServer, Generic

Class Method Summary collapse

Class Method Details

.build(key, extra_args = [], legacy_pty: false) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/harnex/adapters.rb', line 27

def build(key, extra_args = [], legacy_pty: false)
  key_str = key.to_s
  if key_str == "codex"
    return legacy_pty ? Codex.new(extra_args) : CodexAppServer.new(extra_args)
  end

  adapter_class = registry[key_str]
  return adapter_class.new(extra_args) if adapter_class

  Generic.new(key_str, extra_args)
end

.codex_appserver_enabled?Boolean

Phase 3 flipped the default — ‘codex` resolves to CodexAppServer. Legacy PTY adapter is reachable via `legacy_pty: true` (driven by `harnex run codex –legacy-pty`); kept as a long-term supported fallback for interactive/TUI use cases.

Returns:

  • (Boolean)


23
24
25
# File 'lib/harnex/adapters.rb', line 23

def codex_appserver_enabled?
  true
end

.knownObject



11
12
13
# File 'lib/harnex/adapters.rb', line 11

def known
  registry.keys.sort
end

.registryObject



39
40
41
42
43
44
# File 'lib/harnex/adapters.rb', line 39

def registry
  @registry ||= {
    "claude" => Claude,
    "codex" => Codex
  }
end

.supported?(key) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/harnex/adapters.rb', line 15

def supported?(key)
  !key.to_s.strip.empty?
end