Skip to main content

extract_opencode_session_id

Function extract_opencode_session_id 

Source
pub fn extract_opencode_session_id(
    log_path: &Path,
    workspace: &dyn Workspace,
) -> Option<String>
Expand description

Extract session ID from an OpenCode log file.

OpenCode outputs NDJSON with session IDs in the format:

{"type":"step_start","timestamp":1234567890,"sessionID":"ses_44f9562d4ffe",...}

We look for the first sessionID field and return it.

§Arguments

  • log_path - Path to the log file containing OpenCode NDJSON output
  • workspace - Workspace for file operations

§Returns

  • Some(session_id) if a valid session ID was found
  • None if no session ID could be extracted