Skip to main content

Module write

Module write 

Source
Expand description

Mirrors packages/agent/src/harness/tools/write.ts — the built-in write AgentTool. Writes content to a file (creating parent dirs), serialized per canonical path via the file-mutation-queue, with pre/post abort bracketing.

Invariant (plan §5.4): abort does NOT unblock the queue — the caller still waits for its turn, then the closure observes the token and returns Err(Aborted). The pre/post abort checks around write_file mirror the TS if (signal?.aborted) throw lines.

Structs§

WriteInput
Input for the write tool. Mirrors TS WriteToolInput.
WriteTool
The built-in write tool. Holds the mutating env (for the queue + writes).

Functions§

create_write_tool
Build the write tool from a context. Requires a mutation-capable env. Mirrors TS createWriteTool.