Skip to content

Commit 0d62827

Browse files
author
Your Name
committed
cli-12: fixed merge conlficts
2 parents 69b4903 + dd5ec67 commit 0d62827

76 files changed

Lines changed: 4008 additions & 1043 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
repos:
22
- repo: https://github.com/PyCQA/isort
3-
rev: 5.12.0
3+
rev: 9.0.0a3
44
hooks:
55
- id: isort
66
args: ["--profile", "black"]
77
- repo: https://github.com/psf/black
8-
rev: 23.3.0
8+
rev: 26.3.1
99
hooks:
1010
- id: black
1111
args: ["--line-length", "100", "--preview"]
1212
- repo: https://github.com/pycqa/flake8
13-
rev: 7.1.0
13+
rev: 7.3.0
1414
hooks:
1515
- id: flake8
1616
args: ["--show-source"]
1717
- repo: https://github.com/codespell-project/codespell
18-
rev: v2.2.6
18+
rev: v2.4.2
1919
hooks:
2020
- id: codespell
2121
args: ["--skip", "cecli/website/docs/languages.md"]

benchmark/benchmark.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ def simple_namespace_to_dict(obj):
292292

293293
if not dry and "CECLI_DOCKER" not in os.environ:
294294
logger.warning("Warning: Benchmarking runs unvetted code. Run in a docker container.")
295-
logger.warning(
296-
"Set CECLI_DOCKER in the environment to by-pass this check at your own risk."
297-
)
295+
logger.warning("Set CECLI_DOCKER in the environment to bypass this check at your own risk.")
298296
return
299297

300298
# Check dirs exist

cecli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from packaging import version
22

3-
__version__ = "0.99.3.dev"
3+
__version__ = "0.99.10.dev"
44
safe_version = __version__
55

66
try:

cecli/change_tracker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def track_change(
2121
2222
Parameters:
2323
- file_path: Path to the file that was changed
24-
- change_type: Type of change (e.g., 'replacetext', 'insertlines')
24+
- change_type: Type of change (e.g., 'edittext', 'insertlines')
2525
- original_content: Original content before the change
2626
- new_content: New content after the change
2727
- metadata: Additional information about the change (line numbers, positions, etc.)

cecli/coders/agent_coder.py

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
from .base_coder import Coder
3333

34+
from cecli.helpers.coroutines import interruptible # isort:skip
35+
3436

3537
class AgentCoder(Coder):
3638
"""Mode where the LLM autonomously manages which files are in context."""
@@ -42,6 +44,9 @@ class AgentCoder(Coder):
4244
stop_on_empty = False
4345

4446
def __init__(self, *args, **kwargs):
47+
if kwargs.get("uuid", None):
48+
self.uuid = kwargs.get("uuid")
49+
4550
self.recently_removed = {}
4651
self.tool_usage_history = []
4752
self.loaded_custom_tools = []
@@ -53,17 +58,17 @@ def __init__(self, *args, **kwargs):
5358
self.read_tools = {
5459
"command",
5560
"commandinteractive",
56-
"exploresymbols",
61+
"explorecode",
5762
"ls",
63+
"readrange",
5864
"grep",
59-
"showcontext",
6065
"thinking",
6166
"updatetodolist",
6267
}
6368
self.write_tools = {
64-
"deletetext",
65-
"inserttext",
66-
"replacetext",
69+
"command",
70+
"commandinteractive",
71+
"edittext",
6772
"undochange",
6873
}
6974
self.edit_allowed = False
@@ -301,8 +306,23 @@ async def _execute_local_tool_calls(self, tool_calls_list):
301306
else:
302307
all_results_content.append(f"Error: Unknown tool name '{tool_name}'")
303308
if tasks:
304-
task_results = await asyncio.gather(*tasks)
305-
all_results_content.extend(str(res) for res in task_results)
309+
310+
async def gather_and_await():
311+
return await asyncio.gather(*tasks, return_exceptions=True)
312+
313+
task_results, interrupted = await interruptible(
314+
gather_and_await(), self.interrupt_event
315+
)
316+
317+
if interrupted:
318+
self.io.tool_warning("Tool execution interrupted.")
319+
all_results_content.append("Tool execution interrupted by user.")
320+
elif task_results:
321+
for res in task_results:
322+
if isinstance(res, Exception):
323+
all_results_content.append(f"Error in tool execution: {res}")
324+
else:
325+
all_results_content.append(str(res))
306326

307327
if not await HookIntegration.call_post_tool_hooks(
308328
self, tool_name, args_string, "\n\n".join(all_results_content)
@@ -393,7 +413,11 @@ async def _exec_async():
393413
""")
394414
return f"Error executing tool call {tool_name}: {e}"
395415

396-
return await _exec_async()
416+
result, interrupted = await interruptible(_exec_async(), self.interrupt_event)
417+
418+
if interrupted:
419+
return "Tool execution interrupted by user."
420+
return result
397421

398422
def _calculate_context_block_tokens(self, force=False):
399423
"""
@@ -582,6 +606,7 @@ def format_chat_chunks(self):
582606

583607
# Add post-message context blocks (priority 250 - between CUR and REMINDER)
584608
ConversationService.get_chunks(self).add_post_message_context_blocks()
609+
ConversationService.get_chunks(self).add_randomized_cta()
585610

586611
return ConversationService.get_manager(self).get_messages_dict()
587612

@@ -617,9 +642,7 @@ def get_context_summary(self):
617642
total_file_tokens += tokens
618643
editable_tokens += tokens
619644
size_indicator = (
620-
"🔴 Large"
621-
if tokens > 5000
622-
else "🟡 Medium" if tokens > 1000 else "🟢 Small"
645+
"Large" if tokens > 5000 else "Medium" if tokens > 1000 else "Small"
623646
)
624647
editable_files.append(
625648
f"- {rel_fname}: {tokens:,} tokens ({size_indicator})"
@@ -641,9 +664,7 @@ def get_context_summary(self):
641664
total_file_tokens += tokens
642665
readonly_tokens += tokens
643666
size_indicator = (
644-
"🔴 Large"
645-
if tokens > 5000
646-
else "🟡 Medium" if tokens > 1000 else "🟢 Small"
667+
"Large" if tokens > 5000 else "Medium" if tokens > 1000 else "Small"
647668
)
648669
readonly_files.append(
649670
f"- {rel_fname}: {tokens:,} tokens ({size_indicator})"
@@ -999,7 +1020,7 @@ def _generate_tool_context(self, repetitive_tools):
9991020
context_parts.append("\n\n")
10001021
context_parts.append("## File Editing Tools Disabled")
10011022
context_parts.append(
1002-
"File editing tools are currently disabled.Use `ShowContext` to determine the"
1023+
"File editing tools are currently disabled.Use `ReadRange` to determine the"
10031024
" current hashline prefixes needed to perform an edit and activate them when you"
10041025
" are ready to edit a file."
10051026
)

0 commit comments

Comments
 (0)