# Class CodexResponseParser

Parser for Codex CLI NDJSON output. Implements defensive parsing - processes stream of events.

#### Implements

- ICliResponseParser<CodexCliResponse>

- Defined in packages/nexus-agents/src/cli-adapters/parsers/codex-parser.ts:79

##### Index

### Constructors

constructor

### Properties

name
supportedVersionRange

### Methods

parse
extractResponse
extractUsage
extractSessionId

## Constructors

### constructor

- new CodexResponseParser(): CodexResponseParser

  #### Returns CodexResponseParser

## Properties

### `Readonly` name

name: "codex-parser" = 'codex-parser'

Parser name (for logging)

Implementation of ICliResponseParser.name

- Defined in packages/nexus-agents/src/cli-adapters/parsers/codex-parser.ts:80

### `Readonly` supportedVersionRange

supportedVersionRange: ">=0.70.0 <1.0.0" = '>=0.70.0 <1.0.0'

Supported version range (semver)

Implementation of ICliResponseParser.supportedVersionRange

- Defined in packages/nexus-agents/src/cli-adapters/parsers/codex-parser.ts:81

## Methods

### parse

- parse(raw: string): CodexCliResponse | null

  Parses complete Codex CLI NDJSON stream.

  #### Parameters

  - raw: string

  #### Returns CodexCliResponse | null

  Implementation of ICliResponseParser.parse

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/codex-parser.ts:86

### extractResponse

- extractResponse(raw: string): string | null

  Extracts just the response text (most stable field). Concatenates all agent_message items.

  #### Parameters

  - raw: string

  #### Returns string | null

  Implementation of ICliResponseParser.extractResponse

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/codex-parser.ts:152

### extractUsage

- extractUsage(raw: string): CliTokenUsage | null

  Extracts token usage from NDJSON stream.

  #### Parameters

  - raw: string

  #### Returns CliTokenUsage | null

  Implementation of ICliResponseParser.extractUsage

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/codex-parser.ts:164

### extractSessionId

- extractSessionId(raw: string): string | null

  Extracts session ID (thread_id) for resumption.

  #### Parameters

  - raw: string

  #### Returns string | null

  Implementation of ICliResponseParser.extractSessionId

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/codex-parser.ts:190