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

Method assertRunCanDispatch

packages/runtime/src/runtime-kernel.ts:3044–3058  ·  view source on GitHub ↗
(run: AgentRun, backend: AgentBackend)

Source from the content-addressed store, hash-verified

3042 }
3043
3044 private assertRunCanDispatch(run: AgentRun, backend: AgentBackend): void {
3045 const active = [...this.backendGenerations.values()].find(
3046 (candidate) => candidate.backend === backend,
3047 );
3048 if (
3049 run.isStopped() ||
3050 !active ||
3051 active.phase !== 'active' ||
3052 !this.isCurrentGeneration(active) ||
3053 active.activeRuns.get(run.runId) !== run ||
3054 active.turnToRunId.get(run.turnId) !== run.runId
3055 ) {
3056 throw new Error(`Run ${run.runId} no longer owns an active backend generation`);
3057 }
3058 }
3059
3060 private isCurrentGeneration(active: BackendGeneration): boolean {
3061 return active.route.kind === 'parent'

Callers 3

compactSessionClaimedMethod · 0.95
runAgentTurnMethod · 0.95
runAgentContinuationMethod · 0.95

Calls 4

isCurrentGenerationMethod · 0.95
valuesMethod · 0.80
isStoppedMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected