Skip to content

Commit d6e3ba3

Browse files
committed
Add a separate tool call restriction requirement allowing file changes for agentic CLI edit-files prompts
- [Fragment] should only apply to 'edit' prompt type └── apps └── editor └── src ├── constants │ └── instructions.ts └── views └── prompt └── backend └── message-handlers ├── handle-invoke-agentic-cli.ts ├── handle-preview-prompt.ts └── utils └── build-cli-prompt.ts
1 parent 2da1025 commit d6e3ba3

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎apps/editor/src/constants/instructions.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,7 @@ export const cli_edit_ask_requirements = {
7777
'Begin by looking at [files](#files) section for referenced files (### File: `[PROJECT-RELATIVE PATH]`) and read them one-by-one.',
7878
read_images: 'If [task](#task) section includes *.png image paths, read them.',
7979
restrict_tool_calls:
80-
'Further tool calling (e.g. running commands like ls, git, etc.) is forbidden, with exceptions: explicit file CREATION, DELETION or UPDATES to complete the [task](#task).'
80+
'Further tool calling (e.g. running commands like ls, git, etc.) is forbidden.',
81+
restrict_tool_calls_with_exceptions:
82+
'Further tool calling (e.g. running commands like ls, git, etc.) is forbidden, with exceptions: explicit file CREATIONS, DELETIONS or UPDATES to complete the [task](#task).'
8183
}

‎apps/editor/src/views/prompt/backend/message-handlers/utils/build-cli-prompt.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ export const build_cli_prompt = async (params: {
127127
? cli_edit_ask_requirements.referenced_files_with_some_preloaded
128128
: cli_edit_ask_requirements.referenced_files_only,
129129
cli_edit_ask_requirements.read_images,
130-
cli_edit_ask_requirements.restrict_tool_calls
130+
prompt_view_provider.cli_prompt_type == 'edit-files'
131+
? cli_edit_ask_requirements.restrict_tool_calls_with_exceptions
132+
: cli_edit_ask_requirements.restrict_tool_calls
131133
]
132134

133135
const requirements = requirements_list.map((r) => `- ${r}`).join('\n')

0 commit comments

Comments
 (0)