respondAll(
responsesById: Record<string, unknown>,
options: StreamRespondAllOptions<ConfigurableType>
): | Name | Type | Description |
|---|---|---|
responsesById* | Record<string, unknown> | |
options | StreamRespondAllOptions<ConfigurableType> |
Resume several pending interrupts at the same checkpoint in a single command.
Required when a run pauses on multiple interrupts simultaneously
(e.g. parallel tool-authorization prompts): a single
Command({ resume }) carrying every interrupt's payload resumes them
together. Sequential respond calls would fail because the
first resume starts a run, leaving the rest with no interrupted run to
respond to.
responsesById maps each pending interruptId to the payload sent
back to it, so different interrupts can receive different responses
(approve one, deny another). To send the same payload to several
interrupts, build the map with that value for each id, e.g.
Object.fromEntries(ids.map((id) => [id, response])).
The server resumes by interruptId, so namespaces are resolved
internally from getThread()?.interrupts and need not be supplied.
Map of pending interruptId to its response
payload. Must contain at least one entry.
Optional run-level config / metadata folded into
the single run that services the batched resume. Equivalent to the
same fields on StreamSubmitOptions.
await stream.respondAll({
[interruptA.id]: { approved: true },
[interruptB.id]: { approved: false },
});await stream.respondAll(
Object.fromEntries(stream.interrupts.map((i) => [i.id!, { approved: true }])),
);