MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / maybeBuildAcpKaos

Method maybeBuildAcpKaos

packages/acp-adapter/src/server.ts:535–545  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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) {

Callers 2

newSessionMethod · 0.95

Calls 1

ensureInnerKaosMethod · 0.95

Tested by

no test coverage detected