# Interface ICliResponseParser<T>

Response parser interface for defensive parsing. (Source: docs/research/cli-integration-architecture.md)

interface ICliResponseParser<T = unknown> {
name: string;
supportedVersionRange: string;
parse(raw: string): T | null;
extractResponse(raw: string): string | null;
extractUsage(raw: string): CliTokenUsage | null;
extractSessionId(raw: string): string | null;
}

#### Type Parameters

- T = unknown

#### Implemented by

- ClaudeResponseParser
- CodexResponseParser
- GeminiResponseParser

- Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:188

##### Index

### Properties

name
supportedVersionRange

### Methods

parse
extractResponse
extractUsage
extractSessionId

## Properties

### `Readonly` name

name: string

Parser name (for logging)

- Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:190

### `Readonly` supportedVersionRange

supportedVersionRange: string

Supported version range (semver)

- Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:192

## Methods

### parse

- parse(raw: string): T | null

  Parses raw CLI output to typed response.

  #### Parameters

  - raw: string

    Raw CLI output

  #### Returns T | null

  Parsed response or null if unrecognized

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:200

### extractResponse

- extractResponse(raw: string): string | null

  Extracts just the response text (most stable field).

  #### Parameters

  - raw: string

    Raw CLI output

  #### Returns string | null

  Response text or null

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:208

### extractUsage

- extractUsage(raw: string): CliTokenUsage | null

  Extracts token usage (may not be present).

  #### Parameters

  - raw: string

    Raw CLI output

  #### Returns CliTokenUsage | null

  Token usage or null

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:216

### extractSessionId

- extractSessionId(raw: string): string | null

  Extracts session ID (for resumption).

  #### Parameters

  - raw: string

    Raw CLI output

  #### Returns string | null

  Session ID or null

  - Defined in packages/nexus-agents/src/cli-adapters/types-capability.ts:224