improve: text_editor include written content in response

linuztx committed Feb 27, 2026 at 21:26 UTC fdfbd6a4b22dbcb8e56c260a3eeb0a1075381ff9
2 files changed +15 -1
plugins/text_editor/prompts/fw.text_editor.write_ok.md
+3
@@ -1 +1,4 @@
1 {{path}} written {{total_lines}} lines
2 +>>>
3 +{{content}}
4 +<<<
plugins/text_editor/tools/text_editor.py
+12 -1
@@ -88,10 +88,21 @@ class TextEditor(Tool):
88 data={"path": path, "total_lines": result.total_lines},
89 )
90
91 + expanded = os.path.expanduser(path)
92 + cfg = _get_config(self.agent)
93 + read_result = read_file(
94 + expanded,
95 + line_from=1,
96 + line_to=result.total_lines,
97 + max_line_tokens=cfg["max_line_tokens"],
98 + max_total_read_tokens=cfg["max_total_read_tokens"],
99 + )
100 +
101 msg = self.agent.read_prompt(
102 "fw.text_editor.write_ok.md",
93 - path=os.path.expanduser(path),
103 + path=expanded,
104 total_lines=str(result.total_lines),
105 + content=read_result.content,
106 )
107 return Response(message=msg, break_loop=False)
108