Skip to main content

Module path_resolve

Module path_resolve 

Source
Expand description

Shared path-resolution for tool handlers.

Previously two near-identical resolve_path_sync implementations lived in tools/registered/mod.rs (SessionState-based) and server/tool_trait.rs (ToolContext-based), plus several copies of the project-marker test. This module is the single source of truth: resolve_tool_path for jailed path resolution and a re-export of has_project_marker for marker detection.

Structs§

PathRefusal
A path that did not resolve: the message the caller returns, and the boundary class when the I/O boundary refused it (None for a path that is merely missing or malformed). The class is what the audit trail records.

Functions§

has_project_marker
Returns true if dir contains at least one known project marker.
resolve_tool_path
Resolve a (possibly relative) tool path to a normalized, jail-checked, secret-screened absolute path.
resolve_tool_path_refusing
resolve_tool_path_with_roots, saying which boundary refused the path.
resolve_tool_path_with_roots
Like resolve_tool_path, but also permits paths under any of extra_roots (session-scoped trusted roots from session.extra_roots).
unbound_relative_path
Refusal for a relative path that cannot mean anything yet: the session has no project, the host started lean-ctx in a broad directory (OpenCode launched from ~), and nothing exists at resolved. Without it agents got “file not found: ~/src/main.rs” and searched the wrong tree. None when the path is absolute, exists, or base is an ordinary working directory.