# Class StreamController<T>

Controller for managing stream lifecycle. Provides push/complete/error methods and cancellation support.

#### Type Parameters

- T

- Defined in packages/nexus-agents/src/adapters/streaming-types.ts:50

##### Index

### Constructors

constructor

### Accessors

state
isActive
bufferSize

### Methods

push
complete
error
cancel
getIterable

## Constructors

### constructor

- new StreamController<T>(options?: CreateStreamOptions): StreamController<T>

  Creates a new StreamController.

  #### Type Parameters

  - T

  #### Parameters

  - options: CreateStreamOptions = {}

    Stream creation options

  #### Returns StreamController<T>

  - Defined in packages/nexus-agents/src/adapters/streaming-types.ts:67

## Accessors

### state

- get state(): StreamState

  Current state of the stream.

  #### Returns StreamState

  - Defined in packages/nexus-agents/src/adapters/streaming-types.ts:82

### isActive

- get isActive(): boolean

  Whether the stream is still active (can receive chunks).

  #### Returns boolean

  - Defined in packages/nexus-agents/src/adapters/streaming-types.ts:89

### bufferSize

- get bufferSize(): number

  Current buffer size.

  #### Returns number

  - Defined in packages/nexus-agents/src/adapters/streaming-types.ts:96

## Methods

### push

- push(chunk: T): Result<void, StreamError>

  Push a chunk to the stream.

  #### Parameters

  - chunk: T

    The chunk to push

  #### Returns Result<void, StreamError>

  Result indicating success or backpressure

  - Defined in packages/nexus-agents/src/adapters/streaming-types.ts:105

### complete

- complete(): void

  Complete the stream successfully.

  #### Returns void

  - Defined in packages/nexus-agents/src/adapters/streaming-types.ts:138

### error

- error(error: Error): void

  Complete the stream with an error.

  #### Parameters

  - error: Error

    The error that occurred

  #### Returns void

  - Defined in packages/nexus-agents/src/adapters/streaming-types.ts:152

### cancel

- cancel(reason?: string): void

  Cancel the stream.

  #### Parameters

  - `Optional` reason: string

    Optional reason for cancellation

  #### Returns void

  - Defined in packages/nexus-agents/src/adapters/streaming-types.ts:167

### getIterable

- getIterable(): AsyncIterable<T>

  Get the AsyncIterable for consuming the stream.

  #### Returns AsyncIterable<T>

  - Defined in packages/nexus-agents/src/adapters/streaming-types.ts:181