Interface AiAgentStatsExtractor

All Known Implementing Classes:
ClaudeCodeStatsExtractor, CodexStatsExtractor, CursorStatsExtractor, OpenCodeStatsExtractor

public interface AiAgentStatsExtractor
Strategy interface for extracting usage statistics from a single JSON log line emitted by an AI agent.

Each AiAgentTypeHandler returns its own AiAgentStatsExtractor via AiAgentTypeHandler.getStatsExtractor(), allowing third-party agent handlers to supply custom stats extraction without modifying the core AgentUsageStats class.

Implementations should return true if the JSON line was handled (stats were extracted), or false if the line was not recognised. When false is returned, the shared extractor in AgentUsageStats is used as a fallback.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    extract(net.sf.json.JSONObject json, AgentUsageStats stats)
    Attempt to extract usage statistics from a single JSON line.
  • Method Details

    • extract

      boolean extract(net.sf.json.JSONObject json, AgentUsageStats stats)
      Attempt to extract usage statistics from a single JSON line.
      Parameters:
      json - the parsed JSON object for this line
      stats - the stats accumulator to update
      Returns:
      true if this extractor handled the line, false to fall through to the shared extractor