main
md 44 lines 1.57 KB
Rendered Raw
1 # Text Editor
2
3 Provide an LLM-friendly file editing tool for reading, writing, and patching text files.
4
5 ## What It Does
6
7 This plugin exposes a native text editing tool that agents can use to inspect files, write complete contents, and apply validated patch operations while tracking file freshness between reads and edits.
8
9 ## Main Behavior
10
11 - **Read**
12 - Reads whole files or line ranges with token-aware limits.
13 - Records file metadata so later patch operations can detect stale edits.
14 - **Write**
15 - Writes full file contents and then re-reads the resulting file for confirmation.
16 - **Patch**
17 - Validates edit structures before applying them.
18 - Rejects edits if the file changed since it was last observed.
19 - Reads back the affected patch region after applying changes.
20 - **Extension hooks**
21 - Exposes before and after extension points for read, write, and patch operations.
22
23 ## Key Files
24
25 - **Tool**
26 - `tools/text_editor.py` implements method dispatch, stale-file checks, patching flow, and prompt responses.
27 - **Helpers**
28 - `helpers/file_ops.py` provides file info, read/write helpers, edit validation, and patch application.
29 - **Configuration**
30 - `default_config.yaml` defines read limits and token budgets.
31 - **Prompts**
32 - `prompts/` contains the agent-facing success and error messages.
33
34 ## Configuration Scope
35
36 - **Settings section**: `agent`
37 - **Per-project config**: `true`
38 - **Per-agent config**: `true`
39
40 ## Plugin Metadata
41
42 - **Name**: `_text_editor`
43 - **Title**: `Text Editor`
44 - **Description**: Native tool to read, write, and patch text files in an LLM-friendly way.