Request Coordinator#

class RequestCoordinator#

The canonical owner of resident identity under the stepped control plane, and the single point where a StepResult becomes fact.

The runtime’s dense execution layout (which row a sequence occupies) is transient and runner-private; this table maps each live ResidentRef to its request record, updated only inside commit(). Thread-free by design: the engine’s actor thread pumps it, and every transition is deterministic, so the whole scheduling state machine is testable without a thread. One table serves one batch; the engine builds a fresh one per founding.

Public Functions

void add(
ResidentRef ref,
std::shared_ptr<RequestRecord> record,
std::vector<std::string> stopStrings
)#

Seat one resident (the founder at adoption, a joiner after its admission).

std::vector<TerminalOutcome> commit(
StepResult const &result,
SteppedExecution &stepped
)#

Fold one StepResult into the table: turn every finished snapshot into a TerminalOutcome (materializing through stepped). Refs are stable handles, so there is nothing to re-key; deltas need no handling either &#8212; token delivery flows through the runtime’s own stream channels.

std::vector<TerminalOutcome> failEverything()#

Every remaining resident owes its caller an outcome; a dead batch pays that debt here.

inline bool empty() const noexcept#
template<typename Visitor>
inline void forEachRecord(
Visitor &&visit
) const#

Visit every resident’s record, founder and joiners alike. The cancelling shutdown plants its flag through this rather than through a second ledger.

inline void clear() noexcept#

Forget every resident without producing outcomes: only for reuse between batches, after every outcome of the previous one was published.

struct TerminalOutcome#

What commit() decided a record’s fate is. The engine publishes these (terminate, counters, pending-count release) &#8212; publication is actor-side policy, the decision is made here.

Public Members

std::shared_ptr<RequestRecord> record#
FinishReason reason = {FinishReason::kNotFinished}#
std::optional<LLMGenerationResponse> response#

Present for a completed sequence: the materialized response.

struct TerminalOutcome

What commit() decided a record’s fate is. The engine publishes these (terminate, counters, pending-count release) &#8212; publication is actor-side policy, the decision is made here.

Public Members

std::shared_ptr<RequestRecord> record
FinishReason reason = {FinishReason::kNotFinished}
std::optional<LLMGenerationResponse> response

Present for a completed sequence: the materialized response.