* Build an AcpKaos for a given session id if (and only if) * the client advertised any FS reverse-RPC capability. Returns * `undefined` otherwise — the caller then omits the `kaos` field * from `harness.createSession`/`resumeSession`, leaving the kernel * to fall back to its proc
(sessionId: string)
| 533 | * reference — no AsyncLocalStorage involved. |
| 534 | */ |
| 535 | private async maybeBuildAcpKaos(sessionId: string): Promise<AcpKaos | undefined> { |
| 536 | const fs = this.clientCapabilities?.fs; |
| 537 | if (!fs?.readTextFile && !fs?.writeTextFile) { |
| 538 | return undefined; |
| 539 | } |
| 540 | if (!this.conn) { |
| 541 | return undefined; |
| 542 | } |
| 543 | const innerKaos = await this.ensureInnerKaos(); |
| 544 | return new AcpKaos(this.conn, sessionId, innerKaos); |
| 545 | } |
| 546 | |
| 547 | private async ensureInnerKaos(): Promise<Kaos> { |
| 548 | if (!this.innerKaos) { |
no test coverage detected