Files
deepseek-harness/packages/fs/tool-str-replace-editor
imccyu ec601ca13d build(vendor): rescope the vendored Cordis packages into @deepseek-ai
Machine-produced by `pnpm run rescope-vendor --apply` plus the regeneration it
prints: `pnpm install` for the lockfile, `pnpm run gen-third-party-notices`,
`verify-translation-pairing --write` for the touched bilingual pairs,
`gen-doc-graphs`, and one typert snapshot whose ids embed character offsets.
`pnpm run rescope-vendor --check` verifies the result.

Renames nine vendored packages (cordis, cosmokit, schemastery and the six
@cordisjs plugins) and every reference that resolves them: manifest names and
dependency keys, module specifiers including declare-module merges, cordis.yml
plugin names, tsconfig paths, every Markdown fence, and `docs/` prose.
Directory names, upstream versions, and dependency ranges are unchanged, so
vendor/README.md still reads as an upstream snapshot; its manifest table gains
an upstream-name column so THIRD_PARTY_NOTICES keeps MIT attribution pointed
at each fork's origin.

The tutorial tier follows the rename end to end: its yaml fences named plugins
the Loader can no longer resolve, its `ts ignore-check` fences disagreed with
the compiled fences beside them, and its prose quoted both. The contracts that
told readers to keep upstream names — the root convention and the vendoring
cookbook's tree comment and manifest invariant — now say to rescope instead.

Two rules read `@deepseek-ai/` as "another workspace plugin": the client bundle
purity gate now names the vendored libraries a browser bundle inlines, and the
files where a bare `cordis` is an agent-preset id keep that product data.
2026-08-10 22:04:13 +08:00
..

@deepseek-ai/dsh-tool-str-replace-editor

English | 中文

Standalone model-facing str_replace_editor over ctx.fs. It can be composed with persistent Bash, one-shot Bash, sandboxed Bash, or another terminal surface.

Config

Key Default Meaning
maxOutputChars 16000 Prefix characters retained for file and directory views.
description Editor command guide Model-facing tool description.

Tool

The schema provides view, create, str_replace, and insert over absolute paths. File views use one-based line numbers and preserve content tabs, so displayed text remains valid literal replacement input; directory views omit hidden, dependency, and Python-cache entries and descend two levels. A metadata miss from view, str_replace, or insert records confirmed absence before returning FS_NOT_FOUND, so a later create can recover an externally deleted path through the mounted policy's guarded-create flow; absence never authorizes str_replace or insert. Replacement requires one unique literal match and reports errors only in the public old_str vocabulary. Insert follows the selected zero-based insertion boundary without adding an implicit trailing newline. Mutations preserve tabs outside the requested edit.

Model Experience

Tool schema

What the model sees

The generated str_replace_editor schema, including the configured description. The plugin contributes no standalone system-prompt section.

Token effect

Fixed schema cost while str_replace_editor is visible.

KV Cache effect

Prefix-stable while the configured description and schema remain unchanged.

Tool results

What the model sees

Views return numbered text or a shallow directory listing. Calls expose file locations, and create/replace calls expose diff cards to presentation surfaces. Mutations return concise confirmations. Long views keep their prefix and append a clipping notice.

Token effect

Data-dependent and bounded by maxOutputChars plus the fixed clipping notice.

KV Cache effect

Append-only tool results follow the reusable request prefix.

Known Limitations and Deferred Work

  • Operations target UTF-8 text; binary files are unsupported.
  • str_replace intentionally rejects zero or multiple matches and has no replace_all argument.
  • Every mutation goes through fs/write-intent or fs/edit-intent, resolves the current session sandbox policy, and delegates enforcement to the mounted filesystem and policy plugins.