Expand description
@-prefix context references in user messages.
Lets the user write @file:src/main.rs, @folder:src/, @diff, @staged,
or @url:https://example.com and have those expand server-side into an
attached context block before the LLM sees the message. Avoids round-trips
through read_file / web_fetch for trivial cases that the user clearly
intends.
Hermes reference: agent/context_references.py. This is a focused port:
we cover file (with optional :line or :start-end suffix), folder
(1-deep listing), diff/staged, and url. We don’t yet implement quoted
values (@file:"path with spaces") or @git: refs.
Sensitive-path guard: refuses to read out of ~/.ssh, ~/.aws, ~/.gnupg,
~/.kube, ~/.docker, dotfiles like ~/.bashrc/~/.netrc/~/.npmrc.
The existing path_guard module catches these too, but enforcing here
avoids spending time fetching only to reject.
URL fetching delegates to crate::internal::tool_runtime::web_fetch::fetch_url_with_timeout,
which already enforces the SSRF guard from PR #335.
Structs§
- Expansion
Result - Result of reference expansion.
Functions§
- expand_
references - Expand all
@-prefix references inmessageagainstcwd. URL fetches honor the same SSRF guardweb_fetchuses.