Releases: OpenRouterTeam/typescript-agent
Releases · OpenRouterTeam/typescript-agent
@openrouter/agent@0.5.0
Minor Changes
-
Add human-in-the-loop (HITL) tool type, a new
ClientToolvariant that sits
between regularexecutetools andmanualtools. HITL tools define two
async hooks:onToolCalled(input, context)runs when the model invokes the tool.
Return a value to feed the model directly (like a regularexecutetool),
or returnnullto pause the conversation so the caller can supply the
output later — the same flow used by manual tools.onResponseReceived(rawResult, context)runs on the next turn when an
incomingfunction_call_outputmatches a prior call of this tool. It lets
the caller transform or validate the raw response before it reaches the
model. Throwing surfaces as a tool error to the model.
HITL tools require an
outputSchema, which is used to validate both the
onToolCalledreturn value (when non-null) and caller-supplied responses
(after anyonResponseReceivedtransform, or as-is when no hook is defined).New
ConversationStatusvalue'awaiting_hitl'is emitted when one or more
HITL tools returnnullfromonToolCalled, signaling that the caller
should resume with outputs for the paused calls.New public exports:
- Types:
HITLTool,HITLToolFunction - Guards:
isHITLTool,isAutoResolvableTool(true for execute / generator
/ HITL tools — i.e. anything that can resolve within a turn)
isManualToolnow returnsfalsefor HITL tools, so existing manual-tool
branches continue to behave correctly.