Module: AgentCliRuntime::OpenCode::Inspection

Defined in:
lib/agent_cli_runtime/opencode/inspection.rb

Class Method Summary collapse

Class Method Details

.compile(prepared, parsed_run) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/agent_cli_runtime/opencode/inspection.rb', line 6

def compile(prepared, parsed_run)
  unless prepared.is_a?(PreparedInvocation)
    raise ArgumentError,
          "prepared must be an AgentCliRuntime::PreparedInvocation"
  end
  unless parsed_run.is_a?(ParsedRun)
    raise ArgumentError, "parsed_run must be an AgentCliRuntime::ParsedRun"
  end
  unless prepared.invocation.provider == :opencode
    raise ConfigurationError,
          "sanitized export inspection requires an OpenCode invocation"
  end

  InspectionCommand.new(
    argv: [
      prepared.executable, "export", parsed_run.session_id, "--sanitize"
    ],
    stdin_data: nil,
    environment: prepared.environment,
    credential_environment_keys: prepared.credential_environment_keys,
    session_id: parsed_run.session_id,
    message_id: parsed_run.terminal_message_id
  )
end