blob: bfa9c2f58a57b6c6d69298bbb46f50a03e7c0068 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# Improve edit_file tool prompts, empty-file support, and approval details
## Files Changed
- `src/ollama-client.ts`
- `src/tools.ts`
- `src/chat-view.ts`
- `styles.css`
## Changes
### Improved system prompt for edit_file workflow (`ollama-client.ts`)
- Expanded `TOOL_SYSTEM_PROMPT` with a mandatory numbered workflow: get path, read file, copy exact text, then edit.
- Added explicit rules: never skip reading, never guess file contents, never leave old_text empty on non-empty files.
- Documented the empty-file exception: old_text may be empty only when the file itself is empty.
### Improved edit_file tool description and parameters (`tools.ts`)
- Updated the `edit_file` function description to instruct the model to call `read_file` first.
- Documented the empty-file special case in both the function description and the `old_text` parameter description.
- Updated `executeEditFile` to allow empty `old_text` when the file is truly empty (writes initial content).
- When `old_text` is empty but the file has content, returns a descriptive error guiding the model to read the file first.
- Improved error messages on match failure to remind the model to read the file first.
### Added edit details to approval prompt (`chat-view.ts`)
- The `edit_file` approval prompt now includes a collapsible "Review changes" section (expanded by default).
- Shows labeled "Old text" and "New text" blocks so the user can review the full change before approving.
- Empty old_text displays "(empty — new file)" placeholder.
### Added edit details to tool call summary (`chat-view.ts`)
- The `edit_file` tool call details section now shows structured "File", "Old text", and "New text" labels instead of raw JSON args.
### Added CSS for tool call labels (`styles.css`)
- Added `.ai-organizer-tool-call-label` styling for the labeled sections in edit_file details.
|