markMiddlewareInjected
markMiddlewareInjected<
T>(message):T
Defined in: packages/agent/src/middleware/middlewareInjectedMarker.ts:56
Mark a message as appended to state by a middleware in this step, and return it.
Call it on a message you are about to append from a beforeModel hook, at the point of
construction. Mutates the message rather than copying it: the caller has just built it and owns
it, and a copy would lose whatever subclass it is.
Do NOT mark a message that is added to a REQUEST only (the wrapModelCall shape) — it never
enters state, so nothing downstream can meet it, and marking it would mean that if it ever did
leak into state a later adjacency walk would step straight over it instead of stopping. Unmarked
fails safe in that direction; marked does not.
Type Parameters
Section titled “Type Parameters”T extends BaseMessage<MessageStructure<MessageToolSet>, MessageType>
Parameters
Section titled “Parameters”message
Section titled “message”T
Returns
Section titled “Returns”T