MCPcopy Create free account
hub / github.com/apache/maka / requireTurnForAction

Method requireTurnForAction

packages/runtime/src/session-manager.ts:5390–5404  ·  view source on GitHub ↗
(
    sessionId: string,
    turnId: string,
    allowed: readonly TurnRecord['status'][],
    action: string,
  )

Source from the content-addressed store, hash-verified

5388 }
5389
5390 private async requireTurnForAction(
5391 sessionId: string,
5392 turnId: string,
5393 allowed: readonly TurnRecord['status'][],
5394 action: string,
5395 ): Promise<TurnRecord> {
5396 const turn = (await this.getSessionView(sessionId)).turns.find(
5397 (candidate) => candidate.turnId === turnId,
5398 );
5399 if (!turn) throw new Error(`Cannot ${action}: unknown turn ${turnId}`);
5400 if (!allowed.includes(turn.status)) {
5401 throw new Error(`Cannot ${action}: turn ${turnId} is ${turn.status}`);
5402 }
5403 return turn;
5404 }
5405
5406 private async getSessionView(
5407 sessionId: string,

Callers

nothing calls this directly

Calls 1

getSessionViewMethod · 0.95

Tested by

no test coverage detected