Files
deepseek-harness/packages/context/file-reference-local
Turtle 38c7a9fbf4 feat(release): publish package source, declaration maps, and documentation (#5884)
* feat(release): publish package source, declaration maps, and documentation

Every release member publishes its TypeScript source and the declaration
maps that resolve into it, and @deepseek-ai/dsh publishes the repository
Markdown documentation staged from docs/ at prepack time.

The ./src/* export most members already declared now resolves for an
installed consumer, and a consumer editor follows a declaration to the
implementation. Bundled JavaScript maps stay unpublished; the vendored
family and the Desktop runtime file policy are unchanged.

Rationale: .agents/notes/implemented/process/2026-10-08-published-source-and-docs.md

* feat(release): publish JavaScript maps and compress bundles

Every emitted JavaScript map ships beside the bundle it describes, and the
workspace build and the client preset compress bundles without mangling
identifiers.

The documentation payload now mirrors the website publication manifest and
is removed again by `postpack`; Desktop and the Python executable exclude
the published source, documentation, and maps; `clean` removes a staged
copy. Typert's publication contract gains the Remote declaration map.

* fix(release): keep node bundles readable for the worker image

The browser worker image lowers `yield*` only as a whole statement and
rewrites `for await` loops by their source layout, so compressed node-side
entries either fail that lowering or lower to unparseable code. Only the
browser bundles keep compression, which removes about a third of their text.

The bundle-purity assertion now matches the module-loader call regardless of
the quote style compression picks, and the release-pack fixture exercises
the installed package's new documentation requirement.

* feat(release): publish the whole documentation tree

`@deepseek-ai/dsh` copies `docs/` in full instead of the website's page
set: the maintainer documents, the generated migration records, the
translation guidelines, and the `*.i18n.yaml` consistency records ship
with the installed package, so the documentation's own links resolve
without a checkout.

* feat(release): publish the upgrade guides with the documentation

The staged documentation keeps the website's page set and adds every
`docs/upgrade-guide/` document, which is what an installed reader consults
when a released change breaks something. The rest of the maintainer tree
stays out.

* test(release): expect source and maps in master's new payload cases

* feat(release): keep installed docs and source readable in Desktop

Desktop keeps the published src/ and docs/ trees inside app.asar, and
every model shell call receives DSH_INSTALL_DIR and DSH_NODE_EXECUTABLE
so an agent can read them through Electron's Node mode. Staging also
generates docs/upgrade-guide/README.md, an index of the upgrade guides
grouped by the release they upgrade from.

Minified client bundles print string literals with backticks: the
worker image packer now recognizes those chunk requests, client license
banners are prepended after minification so their text survives, and
the affected artifact tests accept either quote.

* test(desktop): read archived docs through the Windows PowerShell form

Regenerate the config catalog for the shifted shell-env source line.

* test(desktop): wait for the GUI-subsystem Electron process from PowerShell

* build(release): publish source and maps from the message-quotes package

* build(release): publish source and maps from packages new on master

* build(release): publish source and maps from the tool-office package
2026-11-05 00:22:36 +08:00
..

description, kind
description kind
Local-workspace @file completion provider for users and maintainers enabling, sizing, or debugging ctx.fileReferences discovery. package-reference

@deepseek-ai/dsh-file-reference-local

English | 中文

Summary

Agents and host UIs can complete @file mentions with ranked paths from each agent's local workspace, with bounded discovery that stays responsive in large repositories. Results refresh after tool activity without blocking completion, and directory symlinks are never followed. When read is available, the model also receives stable guidance for interpreting referenced paths. Choose this package when read uses the Harness host filesystem; remote or virtual namespaces need matching discovery.

Table of Contents


Use this package

Changing the Session's working directory discards the previous directory's search index; the next completion searches the new directory.

Mount this provider when @file completion should discover the Harness host's own filesystem — the namespace the shipped read tool operates on. Each agent's workspace is indexed from its Session's current working directory.

Enabling the provider

The defaults suit a typical workspace, so the minimal mount needs no configuration:

- name: '@deepseek-ai/dsh-file-reference-local'
  config:
    maxResults: 20

What you get

Typing @ in a host UI returns up to maxResults ranked path candidates for the addressed agent. A query containing / lists the matching directory's entries directly; a bare query fuzzy-ranks the bounded recursive index. Directory candidates keep the mention open with a trailing slash. After any tool result the agent's index is marked stale: the next query still answers from it and its replacement builds in the background, so a rebuild never sits in front of the caret.

Configuration

Field Default Meaning
maxResults 20 Maximum ranked candidates returned for one query
maxEntries 50000 Maximum files and directories indexed per agent workspace
excludedDirectories ['.git', 'node_modules', 'dist', 'build', 'out', 'coverage', 'target', '.next', '.nuxt', '.turbo', '.venv', '__pycache__', '.pytest_cache', '.mypy_cache', '.gradle'] Directory basenames omitted from traversal and candidates

Every numeric value must be a positive safe integer, and every excluded name must be a non-empty basename without / or \.


Understand the implementation

Implementation internals — click to expand

This section explains the design of the provider; the observable behavior is covered in Use this package.

Design concept

The provider maintains one reusable WorkspaceFileSearch per agent, rooted at that session's cwd. Directory-scoped queries (a/b/...) list live directory state, while bare fuzzy queries share one bounded recursive traversal. Only a workspace's first bare query waits for that traversal; a tool/result event marks the settled entries stale, and the next bare query serves them while the replacement builds. The model guidance is a per-agent prompt section contributed only while the addressed agent has a read tool; creation awaits prompt installation and rolls back on failure; agent disposal releases both the index and the prompt fiber.

Source map

File Role
src/index.ts LocalFileReferenceService: config validation, per-agent searches, prompt install
src/search.ts WorkspaceFileSearch: traversal, ranking, exclusion, staleness and background rebuild

Main flow

A list(agent, query, signal) call either lists one directory's entries or reads the shared bounded index, ranks the candidates (exact, prefix, substring, then subsequence scores with directory bonuses), and returns at most maxResults in deterministic order. tool/result events mark the addressed agent's index stale so a later bare query observes a fresh tree. An unreadable or excluded subtree contributes no candidates, while an unreadable root fails its traversal instead: a transient failure must not replace still-good entries with an empty index.


Further Exploration

Read these pages when the package-level contract is not enough. They move from the seam this provider implements to the tools its candidates point at.


Model Experience

File-reference guidance when read is available

What the model sees

When the addressed agent has an effective read tool, the provider contributes this stable system-prompt section:

File-reference instruction
Tokens prefixed with @ are paths the user explicitly referenced. Relative paths resolve from the workspace root; absolute paths identify files or directories on the host. A trailing slash marks a directory: list it when its contents matter. Anything else is a file: use the read tool when its contents are needed, and do not claim to have inspected it before reading. @"..." quotes a path containing spaces.

Token effect

Conditional and fixed: the one sentence is present while read is visible to the addressed agent; candidate lookup itself adds no tokens, and a selected path contributes only its ordinary user-message characters.

KV Cache effect

The stable sentence joins the system-prompt prefix. Mounting or removing this provider, or changing whether read is visible, changes that prefix; queries, candidates, and index staleness do not.

Known Limitations and Deferred Work

These limits define when the provider is a poor fit. They are current package constraints.

  • Host-local namespace — the provider scans the Harness host filesystem, so remote or virtual read implementations require a provider whose namespace matches the tool.
  • Bounded advisory index — very large workspaces may omit paths after maxEntries, and excluded or unreadable directories do not appear. The default exclusions name only build outputs no ecosystem also uses for sources; lib is deliberately absent, so a workspace that builds into it adds that name through excludedDirectories.
  • One invalidation of staleness — a bare query answered right after a tool result reflects the tree as of the previous traversal; the following query sees the rebuild.
  • No ignore-file semantics — .gitignore and other project ignore files do not influence discovery; only configured directory basenames are excluded.

Dev Note

Working context for maintainers — click to expand

None.