Skip to main content

Module path_utils

Module path_utils 

Source
Expand description

Mirrors packages/agent/src/harness/tools/path-utils.ts — tool-path normalization + resolution, including the read tool’s fuzzy-existence lookup of typographic variants the model commonly emits.

resolve_tool_path (write/edit) normalizes unicode spaces + strips a leading @, then delegates to env.absolute_path. resolve_read_tool_path (read) additionally tries NFKC-ish/typographic variants (smart quotes, narrow spaces in AM/PM timestamps, NFD decomposition) and returns the first that actually exists on disk — falling back to the original resolved path when none do.

Functions§

normalize_tool_path
Replace unicode spaces with ASCII space and strip a leading @. Mirrors normalizeToolPath.
resolve_read_tool_path
Resolve a read tool path: try the normalized-resolved path first, and if it doesn’t exist, try typographic variants (smart quotes, narrow spaces in AM/PM timestamps, NFD decomposition) — returning the first that exists. Falls back to the original resolved path when none exist. Mirrors resolveReadToolPath.
resolve_tool_path
Resolve a tool path for write/edit: normalize, then env.absolute_path. Mirrors resolveToolPath.