Intelligence · function
applyCommand
Run an accepted command at a tick boundary, revalidating on the way in.
Explained in Agents and behaviour.
function applyCommand<W>(registry: ToolRegistry<W>, world: W, command: AiCommand, _tick: number): ApplyOutcomeimport { applyCommand } from '@driftengine/ai';Parameters
| Parameter | Type | Description |
|---|---|---|
registry | ToolRegistry<W> | |
world | W | |
command | AiCommand | |
_tick | number |
In depth
The tool's own guard ran once already, when the buffered intent drained. It runs again here, because those are two different moments and a snapshot is never authority — the buffer widens the gap on purpose, and admission proves the plan was true when it was taken up rather than that it is true now.
Not the execution policy, which ran at acceptance. Running that twice would charge the rate limit twice for one call.
Returns on every path. A caller inside fixedUpdate never needs a try, and a
consumer's tool throwing must not become an exception halfway through a tick.