(
readonly conn: AgentSideConnection,
readonly session: Session,
/**
* Capabilities the client declared during `initialize`. Passed in
* by `AcpServer.newSession` so `prompt()` can decide whether to
* route file I/O through ACP reverse-RPC (`fs.readTextFile` /
* `fs.writeTextFile`) or fall back to local FS. Optional because
* adapter-level unit tests still construct `AcpSession` with the
* two-arg form; absence means "no FS reverse-RPC".
*/
private readonly clientCapabilities?: ClientCapabilities,
/**
* Optional telemetry sink. `AcpServer` threads in
* `harness.track?.bind(harness)` (Phase 11.2 PII-free pattern); unit
* tests that construct `AcpSession` with a stub session leave this
* undefined and the bridges become silent. Internal emits use the
* {@link safeTrack} guard so a missing or throwing sink can never
* crash a reverse-RPC handler.
*/
private readonly track?: TelemetryTrackFn,
/**
* Initial value of the adapter-side current BASE model id, supplied by
* the server when creating / loading the session so the first
* `config_option_update` snapshot matches the response's
* `configOptions.model.currentValue`. Defaults to empty string when
* absent (adapter-level unit tests). Phase 15: must be the bare model
* key (no `,thinking` suffix); thinking is carried separately by
* {@link initialThinkingEnabled}.
*/
initialModelId?: string,
/**
* Harness reference used by {@link emitConfigOptionUpdate} to
* re-list available models when emitting the post-change snapshot.
* Optional because adapter-level unit tests build `AcpSession`
* without a harness; when absent, `emitConfigOptionUpdate` is a
* silent no-op (matches the {@link safeTrack} pattern). Phase 14.3
* introduces this so the model + mode picker funnel can refresh
* the full SessionConfigOption[] snapshot on every change.
*/
private readonly harness?: KimiHarness,
/**
* Initial value of the adapter-side thinking-toggle state, supplied
* by the server when creating / loading the session. Phase 15
* introduces this so resumed sessions whose persisted
* `thinkingEffort` was non-`'off'` start with the toggle on.
* Defaults to `false` when absent.
*/
initialThinkingEnabled?: boolean,
)
| 164 | private availableCommands: readonly AvailableCommand[] = []; |
| 165 | |
| 166 | constructor( |
| 167 | readonly conn: AgentSideConnection, |
| 168 | readonly session: Session, |
| 169 | /** |
| 170 | * Capabilities the client declared during `initialize`. Passed in |
| 171 | * by `AcpServer.newSession` so `prompt()` can decide whether to |
| 172 | * route file I/O through ACP reverse-RPC (`fs.readTextFile` / |
| 173 | * `fs.writeTextFile`) or fall back to local FS. Optional because |
| 174 | * adapter-level unit tests still construct `AcpSession` with the |
| 175 | * two-arg form; absence means "no FS reverse-RPC". |
| 176 | */ |
| 177 | private readonly clientCapabilities?: ClientCapabilities, |
| 178 | /** |
| 179 | * Optional telemetry sink. `AcpServer` threads in |
| 180 | * `harness.track?.bind(harness)` (Phase 11.2 PII-free pattern); unit |
| 181 | * tests that construct `AcpSession` with a stub session leave this |
| 182 | * undefined and the bridges become silent. Internal emits use the |
| 183 | * {@link safeTrack} guard so a missing or throwing sink can never |
| 184 | * crash a reverse-RPC handler. |
| 185 | */ |
| 186 | private readonly track?: TelemetryTrackFn, |
| 187 | /** |
| 188 | * Initial value of the adapter-side current BASE model id, supplied by |
| 189 | * the server when creating / loading the session so the first |
| 190 | * `config_option_update` snapshot matches the response's |
| 191 | * `configOptions.model.currentValue`. Defaults to empty string when |
| 192 | * absent (adapter-level unit tests). Phase 15: must be the bare model |
| 193 | * key (no `,thinking` suffix); thinking is carried separately by |
| 194 | * {@link initialThinkingEnabled}. |
| 195 | */ |
| 196 | initialModelId?: string, |
| 197 | /** |
| 198 | * Harness reference used by {@link emitConfigOptionUpdate} to |
| 199 | * re-list available models when emitting the post-change snapshot. |
| 200 | * Optional because adapter-level unit tests build `AcpSession` |
| 201 | * without a harness; when absent, `emitConfigOptionUpdate` is a |
| 202 | * silent no-op (matches the {@link safeTrack} pattern). Phase 14.3 |
| 203 | * introduces this so the model + mode picker funnel can refresh |
| 204 | * the full SessionConfigOption[] snapshot on every change. |
| 205 | */ |
| 206 | private readonly harness?: KimiHarness, |
| 207 | /** |
| 208 | * Initial value of the adapter-side thinking-toggle state, supplied |
| 209 | * by the server when creating / loading the session. Phase 15 |
| 210 | * introduces this so resumed sessions whose persisted |
| 211 | * `thinkingEffort` was non-`'off'` start with the toggle on. |
| 212 | * Defaults to `false` when absent. |
| 213 | */ |
| 214 | initialThinkingEnabled?: boolean, |
| 215 | ) { |
| 216 | this.currentModelIdInternal = initialModelId ?? ''; |
| 217 | this.currentThinkingEnabledInternal = initialThinkingEnabled ?? false; |
| 218 | // Register the approval bridge once, at session-construction time — |
| 219 | // NOT per-prompt — because `setApprovalHandler` is scoped to the |
| 220 | // SDK session, not the individual turn. The handler captures `this` |
| 221 | // lexically; the arrow form avoids re-binding on every event. |
| 222 | // |
| 223 | // Defensive: the real `Session` class always provides this method, |
nothing calls this directly
no test coverage detected