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

Method onQuestionAsked

packages/server-e2e/src/client.ts:581–599  ·  view source on GitHub ↗

* Install a handler invoked on every `event.question.requested` frame. * Returns an unsubscribe handle (also auto-disposed by `close()`).

(
    handler: (req: QuestionRequest) => Promise<QuestionResponse> | QuestionResponse,
  )

Source from the content-addressed store, hash-verified

579 * Returns an unsubscribe handle (also auto-disposed by `close()`).
580 */
581 onQuestionAsked(
582 handler: (req: QuestionRequest) => Promise<QuestionResponse> | QuestionResponse,
583 ): () => void {
584 const ws = this._requireWs();
585 const unsubscribe = installReverseRpcHandler<QuestionRequest, QuestionResponse>(ws, {
586 requestEventType: 'event.question.requested',
587 idField: 'question_id',
588 buildPath: (sid, qid) => `/sessions/${sid}/questions/${qid}`,
589 handler,
590 postResolve: (sid, qid, body) => this.http.resolveQuestion(sid, qid, body),
591 logger: this._logger,
592 });
593 this._disposers.push(unsubscribe);
594 return () => {
595 const idx = this._disposers.indexOf(unsubscribe);
596 if (idx >= 0) this._disposers.splice(idx, 1);
597 unsubscribe();
598 };
599 }
600
601 // ── High-level convenience ──────────────────────────────────────────────
602 /**

Callers

nothing calls this directly

Calls 4

_requireWsMethod · 0.95
installReverseRpcHandlerFunction · 0.85
resolveQuestionMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected