description: "File-reference discovery and @file mention grammar for host-backed UIs, for users and maintainers choosing the seam or pairing it with a provider."
English | 中文
Host-backed user interfaces use dsh-file-reference to offer @file completion: a UI asks for path candidates for the addressed agent, the model types @path or @"path with spaces", and picking a candidate inserts the matching mention as ordinary prompt text. The seam itself owns no filesystem access — a concrete provider such as @deepseek-ai/dsh-file-reference-local supplies candidates, ranking, caching, and invalidation. Selecting a candidate never reads or attaches file contents; the model must call a filesystem tool to inspect a file. Session Controller exposes the same discovery to browser consumers through the fileReferences/list Remote.
Choose this package when a host-backed UI (web or terminal) should offer @file completion, and pair it with a provider whose namespace matches the agent's effective read tool. Mounting the seam without a provider gives the UI an empty completion surface.
An @path token at the start of input or after whitespace triggers completion; an @ inside another token, such as an email address, does not. @"path with spaces" opens a quoted mention, and a directory candidate keeps that quote open after its trailing slash so completion can descend another level. The formatter rejects paths with control characters or embedded quotes that the grammar cannot represent safely.
ctx.fileReferences.list(agent, query, signal) returns path-only file and directory candidates for one agent's working directory, deterministically ranked by the provider. Directory mentions render with a trailing / so completion can descend another level. Browser consumers call the Session Controller adapter as ctx.remote.fileReferences.list; the trailing signal cancels a slow autocomplete.
For a local filesystem, mount @deepseek-ai/dsh-file-reference-local; other namespaces (remote or virtual filesystems) need a provider whose discovery matches the effective tool. When the addressed agent can call read, a provider may install the stable FILE_REFERENCE_PROMPT guidance that tells the model to read a referenced file before claiming to have inspected it.
Read these pages when the package-level contract is not enough. They move from the shipped provider to the shared reference surface and the tools the candidates point at.
read tool that referenced paths are meant for.Indirectly, through the composed provider, which owns the file-reference guidance that this package's discovery seam and grammar delegate to it.
The interface and grammar add no request tokens; a provider-owned prompt section determines whether the reusable prefix changes.
These limits define when the seam is a poor fit. They are current package constraints.
read implementation.