tunacode-cli 0.0.77.1__py3-none-any.whl → 0.0.77.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tunacode-cli might be problematic. Click here for more details.

tunacode/cli/repl.py CHANGED
@@ -394,7 +394,8 @@ async def execute_repl_request(text: str, state_manager: StateManager, output: b
394
394
  except CancelledError:
395
395
  await ui.muted(MSG_REQUEST_CANCELLED)
396
396
  except UserAbortError:
397
- await ui.muted(MSG_OPERATION_ABORTED)
397
+ # CLAUDE_ANCHOR[7b2c1d4e]: Guided aborts inject user instructions; skip legacy banner.
398
+ pass
398
399
  except UnexpectedModelBehavior as e:
399
400
  await ui.muted(str(e))
400
401
  patch_tool_messages(str(e), state_manager)
tunacode/constants.py CHANGED
@@ -9,7 +9,7 @@ from enum import Enum
9
9
 
10
10
  # Application info
11
11
  APP_NAME = "TunaCode"
12
- APP_VERSION = "0.0.77.1"
12
+ APP_VERSION = "0.0.77.3"
13
13
 
14
14
 
15
15
  # File patterns
@@ -5,6 +5,7 @@ from typing import Any, Awaitable, Callable, Optional, Tuple
5
5
 
6
6
  from tunacode.core.logging.logger import get_logger
7
7
  from tunacode.core.state import StateManager
8
+ from tunacode.exceptions import UserAbortError
8
9
  from tunacode.types import AgentState, UsageTrackerProtocol
9
10
  from tunacode.ui.tool_descriptions import get_batch_description, get_tool_description
10
11
 
@@ -472,6 +473,8 @@ async def _process_tool_calls(
472
473
  # Execute the tool with robust error handling so one failure doesn't crash the run
473
474
  try:
474
475
  await tool_callback(part, node)
476
+ except UserAbortError:
477
+ raise
475
478
  except Exception as tool_err:
476
479
  logger.error(
477
480
  "Tool callback failed: tool=%s iter=%s err=%s",
@@ -5,6 +5,7 @@ Tool handling business logic, separated from UI concerns.
5
5
  from typing import Optional
6
6
 
7
7
  from tunacode.constants import READ_ONLY_TOOLS
8
+ from tunacode.core.agents.agent_components.agent_helpers import create_user_message
8
9
  from tunacode.core.state import StateManager
9
10
  from tunacode.templates.loader import Template
10
11
  from tunacode.types import (
@@ -86,6 +87,21 @@ class ToolHandler:
86
87
  if response.skip_future:
87
88
  self.state.session.tool_ignore.append(tool_name)
88
89
 
90
+ if not response.approved or response.abort:
91
+ guidance = getattr(response, "instructions", "").strip()
92
+ # CLAUDE_ANCHOR[3c8b1f70]: Route user rejection guidance back to the agent.
93
+ if guidance:
94
+ guidance_section = f"User guidance:\n{guidance}"
95
+ else:
96
+ guidance_section = "User cancelled without additional instructions."
97
+
98
+ message = (
99
+ f"Tool '{tool_name}' execution cancelled before running.\n"
100
+ f"{guidance_section}\n"
101
+ "Do not assume the operation succeeded; request updated guidance or offer alternatives."
102
+ )
103
+ create_user_message(message, self.state)
104
+
89
105
  return response.approved and not response.abort
90
106
 
91
107
  def create_confirmation_request(
tunacode/types.py CHANGED
@@ -129,6 +129,7 @@ class ToolConfirmationResponse:
129
129
  approved: bool
130
130
  skip_future: bool = False
131
131
  abort: bool = False
132
+ instructions: str = ""
132
133
 
133
134
 
134
135
  # =============================================================================
tunacode/ui/console.py CHANGED
@@ -3,14 +3,12 @@
3
3
  Provides high-level console functions and coordinates between different UI components.
4
4
  """
5
5
 
6
- from rich.console import Console as RichConsole
7
- from rich.markdown import Markdown
8
-
9
6
  # Import and re-export all functions from specialized modules
7
+ # Lazy loading of Rich components
8
+ from typing import TYPE_CHECKING, Any, Optional
9
+
10
10
  from .input import formatted_text, input, multiline_input
11
11
  from .keybindings import create_key_bindings
12
-
13
- # Unified UI logger compatibility layer
14
12
  from .logging_compat import ui_logger
15
13
  from .output import (
16
14
  banner,
@@ -40,6 +38,29 @@ from .panels import (
40
38
  from .prompt_manager import PromptConfig, PromptManager
41
39
  from .validators import ModelValidator
42
40
 
41
+ if TYPE_CHECKING:
42
+ from rich.console import Console as RichConsole
43
+
44
+ _console: Optional["RichConsole"] = None
45
+ _keybindings: Optional[Any] = None
46
+
47
+
48
+ def get_console() -> "RichConsole":
49
+ """Get or create the Rich console instance lazily."""
50
+ global _console
51
+ if _console is None:
52
+ from rich.console import Console as RichConsole
53
+
54
+ _console = RichConsole(force_terminal=True, legacy_windows=False)
55
+ return _console
56
+
57
+
58
+ def get_markdown() -> type:
59
+ """Get the Markdown class lazily."""
60
+ from rich.markdown import Markdown
61
+
62
+ return Markdown
63
+
43
64
 
44
65
  # Async wrappers for UI logging
45
66
  async def info(message: str) -> None:
@@ -62,16 +83,45 @@ async def success(message: str) -> None:
62
83
  await ui_logger.success(message)
63
84
 
64
85
 
65
- # Create console object for backward compatibility
66
- console = RichConsole(force_terminal=True, legacy_windows=False)
86
+ # Create lazy console object for backward compatibility
87
+ class _LazyConsole:
88
+ """Lazy console accessor."""
89
+
90
+ def __str__(self):
91
+ return str(get_console())
92
+
93
+ def __getattr__(self, name):
94
+ return getattr(get_console(), name)
95
+
96
+
97
+ # Create lazy key bindings object for backward compatibility
98
+ class _LazyKeyBindings:
99
+ """Lazy key bindings accessor."""
100
+
101
+ def __str__(self):
102
+ return str(get_keybindings())
103
+
104
+ def __getattr__(self, name):
105
+ return getattr(get_keybindings(), name)
106
+
107
+
108
+ def get_keybindings() -> Any:
109
+ """Get key bindings lazily."""
110
+ global _keybindings
111
+ if _keybindings is None:
112
+ _keybindings = create_key_bindings()
113
+ return _keybindings
114
+
67
115
 
68
- # Create key bindings object for backward compatibility
69
- kb = create_key_bindings()
116
+ # Module-level lazy instances
117
+ console = _LazyConsole()
118
+ kb = _LazyKeyBindings()
70
119
 
71
120
 
72
121
  # Re-export markdown utility for backward compatibility
73
- def markdown(text: str) -> Markdown:
74
- """Create a Markdown object."""
122
+ def markdown(text: str) -> Any:
123
+ """Create a Markdown object lazily."""
124
+ Markdown = get_markdown()
75
125
  return Markdown(text)
76
126
 
77
127
 
tunacode/ui/output.py CHANGED
@@ -1,12 +1,10 @@
1
1
  """Output and display functions for TunaCode UI."""
2
2
 
3
- from typing import Optional
3
+ from typing import TYPE_CHECKING, Any, Optional
4
4
 
5
5
  from prompt_toolkit.application import run_in_terminal
6
- from rich.console import Console
7
6
  from rich.padding import Padding
8
7
 
9
- from tunacode.configuration.settings import ApplicationSettings
10
8
  from tunacode.constants import (
11
9
  MSG_UPDATE_AVAILABLE,
12
10
  MSG_UPDATE_INSTRUCTION,
@@ -22,7 +20,34 @@ from .constants import SPINNER_TYPE
22
20
  from .decorators import create_sync_wrapper
23
21
  from .logging_compat import ui_logger
24
22
 
25
- console = Console()
23
+ # Lazy console initialization
24
+ if TYPE_CHECKING:
25
+ from rich.console import Console
26
+
27
+ _console: Optional["Console"] = None
28
+
29
+
30
+ def get_console() -> "Console":
31
+ """Get console instance lazily."""
32
+ from rich.console import Console
33
+
34
+ global _console
35
+ if _console is None:
36
+ _console = Console()
37
+ return _console
38
+
39
+
40
+ class _LazyConsole:
41
+ """Lightweight proxy that defers Console creation."""
42
+
43
+ def __getattr__(self, name: str) -> Any:
44
+ return getattr(get_console(), name)
45
+
46
+ def __str__(self) -> str:
47
+ return str(get_console())
48
+
49
+
50
+ console = _LazyConsole()
26
51
  colors = DotDict(UI_COLORS)
27
52
 
28
53
  BANNER = """[bold cyan]
@@ -72,6 +97,8 @@ async def usage(usage: str) -> None:
72
97
 
73
98
  async def version() -> None:
74
99
  """Print version information."""
100
+ from tunacode.configuration.settings import ApplicationSettings
101
+
75
102
  app_settings = ApplicationSettings()
76
103
  await info(MSG_VERSION_DISPLAY.format(version=app_settings.version))
77
104
 
tunacode/ui/panels.py CHANGED
@@ -2,15 +2,14 @@
2
2
 
3
3
  import asyncio
4
4
  import time
5
- from typing import Any, Optional, Union
5
+ from typing import TYPE_CHECKING, Any, Mapping, Optional, Union
6
6
 
7
- from rich.box import ROUNDED
8
- from rich.live import Live
9
- from rich.markdown import Markdown
10
- from rich.padding import Padding
11
- from rich.panel import Panel
12
- from rich.pretty import Pretty
13
- from rich.table import Table
7
+ if TYPE_CHECKING:
8
+ from rich.markdown import Markdown
9
+ from rich.padding import Padding
10
+ from rich.pretty import Pretty
11
+ from rich.table import Table
12
+ from rich.text import Text
14
13
 
15
14
  from tunacode.configuration.models import ModelRegistry
16
15
  from tunacode.constants import (
@@ -45,11 +44,44 @@ from .output import print
45
44
 
46
45
  colors = DotDict(UI_COLORS)
47
46
 
47
+ RenderableContent = Union["Text", "Markdown"]
48
+
49
+ _rich_components: Optional[Mapping[str, Any]] = None
50
+
51
+
52
+ def get_rich_components() -> Mapping[str, Any]:
53
+ """Get Rich components lazily with caching."""
54
+
55
+ global _rich_components
56
+ if _rich_components is not None:
57
+ return _rich_components
58
+
59
+ from rich.box import ROUNDED
60
+ from rich.live import Live
61
+ from rich.markdown import Markdown
62
+ from rich.padding import Padding
63
+ from rich.panel import Panel
64
+ from rich.pretty import Pretty
65
+ from rich.table import Table
66
+ from rich.text import Text
67
+
68
+ _rich_components = {
69
+ "ROUNDED": ROUNDED,
70
+ "Live": Live,
71
+ "Markdown": Markdown,
72
+ "Padding": Padding,
73
+ "Panel": Panel,
74
+ "Pretty": Pretty,
75
+ "Table": Table,
76
+ "Text": Text,
77
+ }
78
+ return _rich_components
79
+
48
80
 
49
81
  @create_sync_wrapper
50
82
  async def panel(
51
83
  title: str,
52
- text: Union[str, Markdown, Pretty, Table],
84
+ text: Union[str, "Markdown", "Pretty", "Table"],
53
85
  top: int = DEFAULT_PANEL_PADDING["top"],
54
86
  right: int = DEFAULT_PANEL_PADDING["right"],
55
87
  bottom: int = DEFAULT_PANEL_PADDING["bottom"],
@@ -58,26 +90,28 @@ async def panel(
58
90
  **kwargs: Any,
59
91
  ) -> None:
60
92
  """Display a rich panel with modern styling."""
93
+ rich = get_rich_components()
61
94
  border_style = border_style or kwargs.get("style") or colors.border
62
95
 
63
- panel_obj = Panel(
64
- Padding(text, (0, 1, 0, 1)),
96
+ panel_obj = rich["Panel"](
97
+ rich["Padding"](text, (0, 1, 0, 1)),
65
98
  title=f"[bold]{title}[/bold]",
66
99
  title_align="left",
67
100
  border_style=border_style,
68
101
  padding=(0, 1),
69
- box=ROUNDED, # Use ROUNDED box style
102
+ box=rich["ROUNDED"], # Use ROUNDED box style
70
103
  )
71
104
 
72
- final_padding = Padding(panel_obj, (top, right, bottom, left))
105
+ final_padding = rich["Padding"](panel_obj, (top, right, bottom, left))
73
106
 
74
107
  await print(final_padding, **kwargs)
75
108
 
76
109
 
77
110
  async def agent(text: str, bottom: int = 1) -> None:
78
111
  """Display an agent panel with modern styling."""
112
+ rich = get_rich_components()
79
113
  title = f"[bold {colors.primary}]●[/bold {colors.primary}] {APP_NAME}"
80
- await panel(title, Markdown(text), bottom=bottom, border_style=colors.primary)
114
+ await panel(title, rich["Markdown"](text), bottom=bottom, border_style=colors.primary)
81
115
 
82
116
 
83
117
  class StreamingAgentPanel:
@@ -86,7 +120,7 @@ class StreamingAgentPanel:
86
120
  bottom: int
87
121
  title: str
88
122
  content: str
89
- live: Optional[Live]
123
+ live: Optional[Any]
90
124
  _last_update_time: float
91
125
  _dots_task: Optional[asyncio.Task]
92
126
  _dots_count: int
@@ -120,13 +154,12 @@ class StreamingAgentPanel:
120
154
  line = f"[ui] {label} ts_ns={ts}{(' ' + payload) if payload else ''}"
121
155
  self._debug_events.append(line)
122
156
 
123
- def _create_panel(self) -> Padding:
157
+ def _create_panel(self) -> "Padding":
124
158
  """Create a Rich panel with current content."""
125
- # Use the UI_THINKING_MESSAGE constant instead of hardcoded text
126
- from rich.text import Text
127
-
128
159
  from tunacode.constants import UI_THINKING_MESSAGE
129
160
 
161
+ rich = get_rich_components()
162
+
130
163
  # Show "Thinking..." only when no content has arrived yet
131
164
  if not self.content:
132
165
  # Apply dots animation to "Thinking..." message too
@@ -137,7 +170,7 @@ class StreamingAgentPanel:
137
170
  dots_patterns = ["", ".", "..", "..."]
138
171
  dots = dots_patterns[self._dots_count % len(dots_patterns)]
139
172
  thinking_msg = base_msg + dots
140
- content_renderable: Union[Text, Markdown] = Text.from_markup(thinking_msg)
173
+ content_renderable: RenderableContent = rich["Text"].from_markup(thinking_msg)
141
174
  else:
142
175
  # Once we have content, show it with optional dots animation
143
176
  display_content = self.content
@@ -147,16 +180,16 @@ class StreamingAgentPanel:
147
180
  dots_patterns = ["", ".", "..", "..."]
148
181
  dots = dots_patterns[self._dots_count % len(dots_patterns)]
149
182
  display_content = self.content.rstrip() + dots
150
- content_renderable = Markdown(display_content)
151
- panel_obj = Panel(
152
- Padding(content_renderable, (0, 1, 0, 1)),
183
+ content_renderable = rich["Markdown"](display_content)
184
+ panel_obj = rich["Panel"](
185
+ rich["Padding"](content_renderable, (0, 1, 0, 1)),
153
186
  title=f"[bold]{self.title}[/bold]",
154
187
  title_align="left",
155
188
  border_style=colors.primary,
156
189
  padding=(0, 1),
157
- box=ROUNDED,
190
+ box=rich["ROUNDED"],
158
191
  )
159
- return Padding(
192
+ return rich["Padding"](
160
193
  panel_obj,
161
194
  (
162
195
  DEFAULT_PANEL_PADDING["top"],
@@ -195,9 +228,11 @@ class StreamingAgentPanel:
195
228
 
196
229
  async def start(self):
197
230
  """Start the live streaming display."""
198
- from .output import console
231
+ from .output import get_console
232
+
233
+ rich = get_rich_components()
199
234
 
200
- self.live = Live(self._create_panel(), console=console, refresh_per_second=4)
235
+ self.live = rich["Live"](self._create_panel(), console=get_console(), refresh_per_second=4)
201
236
  self.live.start()
202
237
  self._log_debug("start")
203
238
  # For "Thinking...", set time in past to trigger dots immediately
@@ -373,14 +408,15 @@ async def error(text: str) -> None:
373
408
 
374
409
  async def dump_messages(messages_list=None, state_manager: StateManager = None) -> None:
375
410
  """Display message history panel."""
411
+ rich = get_rich_components()
376
412
  if messages_list is None and state_manager:
377
413
  # Get messages from state manager
378
- messages = Pretty(state_manager.session.messages)
414
+ messages = rich["Pretty"](state_manager.session.messages)
379
415
  elif messages_list is not None:
380
- messages = Pretty(messages_list)
416
+ messages = rich["Pretty"](messages_list)
381
417
  else:
382
418
  # No messages available
383
- messages = Pretty([])
419
+ messages = rich["Pretty"]([])
384
420
  await panel(PANEL_MESSAGE_HISTORY, messages, style=colors.muted)
385
421
 
386
422
 
@@ -396,7 +432,8 @@ async def models(state_manager: StateManager = None) -> None:
396
432
 
397
433
  async def help(command_registry=None) -> None:
398
434
  """Display the available commands organized by category."""
399
- table = Table(show_header=False, box=None, padding=(0, 2, 0, 0))
435
+ rich = get_rich_components()
436
+ table = rich["Table"](show_header=False, box=None, padding=(0, 2, 0, 0))
400
437
  table.add_column("Command", style=f"bold {colors.primary}", justify="right", min_width=18)
401
438
  table.add_column("Description", style=colors.muted)
402
439
 
@@ -456,7 +493,7 @@ async def help(command_registry=None) -> None:
456
493
 
457
494
  @create_sync_wrapper
458
495
  async def tool_confirm(
459
- title: str, content: Union[str, Markdown], filepath: Optional[str] = None
496
+ title: str, content: Union[str, "Markdown"], filepath: Optional[str] = None
460
497
  ) -> None:
461
498
  """Display a tool confirmation panel."""
462
499
  bottom_padding = 0 if filepath else 1
tunacode/ui/tool_ui.py CHANGED
@@ -25,6 +25,11 @@ if TYPE_CHECKING:
25
25
  class ToolUI:
26
26
  """Handles tool confirmation UI presentation."""
27
27
 
28
+ REJECTION_FEEDBACK_SESSION = "tool_rejection_feedback"
29
+ REJECTION_GUIDANCE_PROMPT = (
30
+ " Describe what the agent should do instead (leave blank to skip): "
31
+ )
32
+
28
33
  def __init__(self):
29
34
  self.colors = DotDict(UI_COLORS)
30
35
 
@@ -133,10 +138,14 @@ class ToolUI:
133
138
 
134
139
  if resp == "2":
135
140
  return ToolConfirmationResponse(approved=True, skip_future=True)
136
- elif resp == "3":
137
- return ToolConfirmationResponse(approved=False, abort=True)
138
- else:
139
- return ToolConfirmationResponse(approved=True)
141
+ if resp == "3":
142
+ instructions = await self._prompt_rejection_feedback(state_manager)
143
+ return ToolConfirmationResponse(
144
+ approved=False,
145
+ abort=True,
146
+ instructions=instructions,
147
+ )
148
+ return ToolConfirmationResponse(approved=True)
140
149
 
141
150
  def show_sync_confirmation(self, request: ToolConfirmationRequest) -> ToolConfirmationResponse:
142
151
  """
@@ -189,10 +198,23 @@ class ToolUI:
189
198
 
190
199
  if resp == "2":
191
200
  return ToolConfirmationResponse(approved=True, skip_future=True)
192
- elif resp == "3":
193
- return ToolConfirmationResponse(approved=False, abort=True)
194
- else:
195
- return ToolConfirmationResponse(approved=True)
201
+ if resp == "3":
202
+ instructions = self._prompt_rejection_feedback_sync()
203
+ return ToolConfirmationResponse(approved=False, abort=True, instructions=instructions)
204
+ return ToolConfirmationResponse(approved=True)
205
+
206
+ async def _prompt_rejection_feedback(self, state_manager: Optional["StateManager"]) -> str:
207
+ guidance = await ui.input(
208
+ session_key=self.REJECTION_FEEDBACK_SESSION,
209
+ pretext=self.REJECTION_GUIDANCE_PROMPT,
210
+ state_manager=state_manager,
211
+ )
212
+ return guidance.strip() if guidance else ""
213
+
214
+ def _prompt_rejection_feedback_sync(self) -> str:
215
+ guidance = input(self.REJECTION_GUIDANCE_PROMPT).strip()
216
+ ui.console.print()
217
+ return guidance
196
218
 
197
219
  async def log_mcp(self, title: str, args: ToolArgs) -> None:
198
220
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tunacode-cli
3
- Version: 0.0.77.1
3
+ Version: 0.0.77.3
4
4
  Summary: Your agentic CLI developer.
5
5
  Project-URL: Homepage, https://tunacode.xyz/
6
6
  Project-URL: Repository, https://github.com/alchemiststudiosDOTai/tunacode
@@ -23,7 +23,7 @@ Requires-Python: <3.14,>=3.10
23
23
  Requires-Dist: click<8.2.0,>=8.0.0
24
24
  Requires-Dist: defusedxml
25
25
  Requires-Dist: prompt-toolkit==3.0.51
26
- Requires-Dist: pydantic-ai[logfire]==0.2.6
26
+ Requires-Dist: pydantic-ai==0.2.6
27
27
  Requires-Dist: pygments==2.19.1
28
28
  Requires-Dist: rich==14.0.0
29
29
  Requires-Dist: tiktoken>=0.5.2
@@ -1,13 +1,12 @@
1
1
  tunacode/__init__.py,sha256=yUul8igNYMfUrHnYfioIGAqvrH8b5BKiO_pt1wVnmd0,119
2
- tunacode/constants.py,sha256=my0w0CGjHBr32c9QDlNDMpTqiBJExfTg9qNi61w82M0,6168
3
- tunacode/context.py,sha256=4xMzqhSBqtTLuXnPBkJzn0SA61G5kAQytFvVY8TDnYY,2395
2
+ tunacode/constants.py,sha256=4R41mrExdN-66GmxdgKDO8DI9YgeXVn8V1eBxmNrpm8,6168
4
3
  tunacode/exceptions.py,sha256=m80njR-LqBXhFAEOPqCE7N2QPU4Fkjlf_f6CWKO0_Is,8479
5
4
  tunacode/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
5
  tunacode/setup.py,sha256=1GXwD1cNDkGcmylZbytdlGnnHzpsGIwnGpnN0OFp1F0,2022
7
- tunacode/types.py,sha256=xNpDRjIRYg4qGNbl3EG8B13CWAWBoob9ekVm8_6dvnc,10496
6
+ tunacode/types.py,sha256=ofclq3gZF9xnd0WFaSNqC4OKaKX6kgdqznkNPIpG3cM,10523
8
7
  tunacode/cli/__init__.py,sha256=zgs0UbAck8hfvhYsWhWOfBe5oK09ug2De1r4RuQZREA,55
9
8
  tunacode/cli/main.py,sha256=MAKPFA4kGSFciqMdxnyp2r9XzVp8TfxvK6ztt7dvjwM,3445
10
- tunacode/cli/repl.py,sha256=QBw05NNypxuTYoV51FVoTfujJfiOTCIYzAr_1uoi0YA,23515
9
+ tunacode/cli/repl.py,sha256=XzCb6Xx6-uwsTNcaJ2PP6w4Xwc7jY0GpidV1ZWDNpHU,23577
11
10
  tunacode/cli/commands/__init__.py,sha256=J7MZofTaSgspAKP64OavPukj4l53qvkv_-sCfYEUi10,1794
12
11
  tunacode/cli/commands/base.py,sha256=Ge_lNQA-GDfcb1Ap1oznCH3UrifBiHH3bA9DNL-tCDw,2519
13
12
  tunacode/cli/commands/registry.py,sha256=J2zS2QZmVaUyOA6GEgYwKqh1bZ9QBbsuuxMYniF7YSA,15139
@@ -42,7 +41,7 @@ tunacode/configuration/settings.py,sha256=9wtIWBlLhW_ZBlLx-GA4XDfVZyGj2Gs6Zk49vk
42
41
  tunacode/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
42
  tunacode/core/code_index.py,sha256=2qxEn2eTIegV4F_gLeZO5lAOv8mkf4Y_t21whZ9F2Fk,17370
44
43
  tunacode/core/state.py,sha256=4SzI_OPiL2VIDywtUavtE6jZnIJS7K2IVgj8AYcawW0,8706
45
- tunacode/core/tool_handler.py,sha256=42yUfnq5jgk-0LK93JoJgtsXfVDTf-7hNXyKEfH2FM0,3626
44
+ tunacode/core/tool_handler.py,sha256=ImCqzq5NflovKSkrnUzf26I4E_orFt6K_vCU06Ex12Q,4426
46
45
  tunacode/core/agents/__init__.py,sha256=ZOSvWhqBWX3ADzTUZ7ILY92xZ7VMXanjPQ_Sf37WYmU,1005
47
46
  tunacode/core/agents/main.py,sha256=IFKuGy-3t9XJDAs4rO0oTPZ1xGkZAXxoK1efdgIN15Q,23251
48
47
  tunacode/core/agents/utils.py,sha256=cQJbpXzMcixJ1TKdLsEcpJHMMMXiH6_qcT3wbnSQ9gc,9411
@@ -51,7 +50,7 @@ tunacode/core/agents/agent_components/agent_config.py,sha256=X4S5PCsndoHBd7EHHuN
51
50
  tunacode/core/agents/agent_components/agent_helpers.py,sha256=m0sB0_ztHhRJYFnG2tmQyNmyZk_WnZExBE5jKIHN5lA,9121
52
51
  tunacode/core/agents/agent_components/json_tool_parser.py,sha256=HuyNT0rs-ppx_gLAI2e0XMVGbR_F0WXZfP3sx38VoMg,3447
53
52
  tunacode/core/agents/agent_components/message_handler.py,sha256=KJGOtb9VhumgZpxxwO45HrKLhU9_MwuoWRsSQwJviNU,3704
54
- tunacode/core/agents/agent_components/node_processor.py,sha256=oOi3Yuccpdmnlza6vZRr_wB2_OczV0OLcqvs0a3BJcA,24734
53
+ tunacode/core/agents/agent_components/node_processor.py,sha256=WnN3K7d2V1B7VZ_qlEh94qY1V6a9y4NAzPdeAi0qucU,24854
55
54
  tunacode/core/agents/agent_components/response_state.py,sha256=qnjRSQCYZzac04CcVc4gTvW8epxl4w-Vz0kPjsvM_Qg,4482
56
55
  tunacode/core/agents/agent_components/result_wrapper.py,sha256=9CFK0wpsfZx2WT4PBHfkSv22GxL1gAQuUYVMlmYtCJU,1761
57
56
  tunacode/core/agents/agent_components/state_transition.py,sha256=uyvLJriexosBDQIrxbVDLR_luvXAMG6tnDsX10mbZcI,4077
@@ -125,7 +124,7 @@ tunacode/tutorial/steps.py,sha256=l2bbRVJuYlC186A-U1TIoMPBtLl4j053h4Wlzo1VO8c,43
125
124
  tunacode/ui/__init__.py,sha256=aRNE2pS50nFAX6y--rSGMNYwhz905g14gRd6g4BolYU,13
126
125
  tunacode/ui/completers.py,sha256=2VLVu5Nsl9LT34KcZ6zsKiEfZkgzVNcbt4vx6jw8MpQ,19548
127
126
  tunacode/ui/config_dashboard.py,sha256=FhfWwEzPTNjvornTb0njxv_o2SavoEW4EXqyOCrbqk0,21657
128
- tunacode/ui/console.py,sha256=HfE30vUy8ebXCobP7psFNJc17-dvH6APChg2tbi7aTw,2632
127
+ tunacode/ui/console.py,sha256=XiM1km8-vPEXoAp70Qx2dRxu4mrIitm9UqdI97vKANY,3777
129
128
  tunacode/ui/constants.py,sha256=A76B_KpM8jCuBYRg4cPmhi8_j6LLyWttO7_jjv47r3w,421
130
129
  tunacode/ui/decorators.py,sha256=jJDNztO8MyX_IG1nqXAL8-sQUFjaAzBnc5BsM3ioX24,1955
131
130
  tunacode/ui/input.py,sha256=8C8xPcM_RccEbpw5tgcjlKSYDbS3dlA0ngTPrUKIonk,3554
@@ -133,12 +132,12 @@ tunacode/ui/keybindings.py,sha256=8j58NN432XyawffssFNe86leXaPur12qBX3O7hOOGsc,23
133
132
  tunacode/ui/lexers.py,sha256=tmg4ic1enyTRLzanN5QPP7D_0n12YjX_8ZhsffzhXA4,1340
134
133
  tunacode/ui/logging_compat.py,sha256=5v6lcjVaG1CxdY1Zm9FAGr9H7Sy-tP6ihGfhP-5YvAY,1406
135
134
  tunacode/ui/model_selector.py,sha256=07kV9v0VWFgDapiXTz1_BjzHF1AliRq24I9lDq-hmHc,13426
136
- tunacode/ui/output.py,sha256=YW0ABzZQbIE_jkDdrWVIeinTPuQUTnl-W638RUAqeoA,5569
137
- tunacode/ui/panels.py,sha256=6XGOeax4m-yQvwP1iML67GK10AKlDLD46dB522gcNPU,17236
135
+ tunacode/ui/output.py,sha256=iOQRPfgfgMICPrACe940AGAdxiYGkIYVlidU5j2iEZg,6131
136
+ tunacode/ui/panels.py,sha256=DQETEuP2LnliXGWSXKIqtmA3qUD5uJD4hB05XMPikFQ,18319
138
137
  tunacode/ui/path_heuristics.py,sha256=SkhGaM8WCRuK86vLwypbfhtI81PrXtOsWoz-P0CTsmQ,2221
139
138
  tunacode/ui/prompt_manager.py,sha256=HUL6443pFPb41uDAnAKD-sZsrWd_VhWYRGwvrFH_9SI,5618
140
139
  tunacode/ui/tool_descriptions.py,sha256=vk61JPIXy7gHNfJ--77maXgK6WwNwxqY47QYsw_a2uw,4126
141
- tunacode/ui/tool_ui.py,sha256=MVmBLXx6OTJVFLl58SpoW0KoStOrbAY9sc6XXMKgWtQ,7216
140
+ tunacode/ui/tool_ui.py,sha256=tB1w01ffPVtWJn1veutcUrOZE6yb7t7kMqzxVNPfZZs,8132
142
141
  tunacode/ui/utils.py,sha256=yvoCTz8AOdRfV0XIqUX3sgg88g_wntV9yhnQP6WzAVs,114
143
142
  tunacode/ui/validators.py,sha256=MMIMT1I2v0l2jIy-gxX_4GSApvUTi8XWIOACr_dmoBA,758
144
143
  tunacode/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -158,8 +157,8 @@ tunacode/utils/system.py,sha256=J8KqJ4ZqQrNSnM5rrJxPeMk9z2xQQp6dWtI1SKBY1-0,1112
158
157
  tunacode/utils/text_utils.py,sha256=HAwlT4QMy41hr53cDbbNeNo05MI461TpI9b_xdIv8EY,7288
159
158
  tunacode/utils/token_counter.py,sha256=dmFuqVz4ywGFdLfAi5Mg9bAGf8v87Ek-mHU-R3fsYjI,2711
160
159
  tunacode/utils/user_configuration.py,sha256=OA-L0BgWNbf9sWpc8lyivgLscwJdpdI8TAYbe0wRs1s,4836
161
- tunacode_cli-0.0.77.1.dist-info/METADATA,sha256=64_1eQhSU7--GGUc5RVSArPEfWhD0sJKAYmwuDF7dQs,8913
162
- tunacode_cli-0.0.77.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
163
- tunacode_cli-0.0.77.1.dist-info/entry_points.txt,sha256=hbkytikj4dGu6rizPuAd_DGUPBGF191RTnhr9wdhORY,51
164
- tunacode_cli-0.0.77.1.dist-info/licenses/LICENSE,sha256=Btzdu2kIoMbdSp6OyCLupB1aRgpTCJ_szMimgEnpkkE,1056
165
- tunacode_cli-0.0.77.1.dist-info/RECORD,,
160
+ tunacode_cli-0.0.77.3.dist-info/METADATA,sha256=5JwyUQ4xJE5g5G60hnV1JaoFmd14KERAXjjXSA0ADzg,8904
161
+ tunacode_cli-0.0.77.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
162
+ tunacode_cli-0.0.77.3.dist-info/entry_points.txt,sha256=hbkytikj4dGu6rizPuAd_DGUPBGF191RTnhr9wdhORY,51
163
+ tunacode_cli-0.0.77.3.dist-info/licenses/LICENSE,sha256=Btzdu2kIoMbdSp6OyCLupB1aRgpTCJ_szMimgEnpkkE,1056
164
+ tunacode_cli-0.0.77.3.dist-info/RECORD,,
tunacode/context.py DELETED
@@ -1,71 +0,0 @@
1
- import logging
2
- import subprocess
3
- from pathlib import Path
4
- from typing import Dict, List
5
-
6
- from tunacode.utils.ripgrep import ripgrep
7
- from tunacode.utils.system import list_cwd
8
-
9
- logger = logging.getLogger(__name__)
10
-
11
-
12
- async def get_git_status() -> Dict[str, object]:
13
- """Return git branch and dirty state information."""
14
- try:
15
- result = subprocess.run(
16
- ["git", "status", "--porcelain", "--branch"],
17
- capture_output=True,
18
- text=True,
19
- check=True,
20
- timeout=5,
21
- )
22
- lines = result.stdout.splitlines()
23
- branch_line = lines[0][2:] if lines else ""
24
- branch = branch_line.split("...")[0]
25
- ahead = behind = 0
26
- if "[" in branch_line and "]" in branch_line:
27
- bracket = branch_line.split("[", 1)[1].split("]", 1)[0]
28
- for part in bracket.split(","):
29
- if "ahead" in part:
30
- ahead = int(part.split("ahead")[1].strip().strip(" ]"))
31
- if "behind" in part:
32
- behind = int(part.split("behind")[1].strip().strip(" ]"))
33
- dirty = any(line for line in lines[1:])
34
- return {"branch": branch, "ahead": ahead, "behind": behind, "dirty": dirty}
35
- except Exception as e:
36
- logger.warning(f"Failed to get git status: {e}")
37
- return {}
38
-
39
-
40
- async def get_directory_structure(max_depth: int = 3) -> str:
41
- """Return a simple directory tree string."""
42
- files = list_cwd(max_depth=max_depth)
43
- lines: List[str] = []
44
- for path in files:
45
- depth = path.count("/")
46
- indent = " " * depth
47
- name = path.split("/")[-1]
48
- lines.append(f"{indent}{name}")
49
- return "\n".join(lines)
50
-
51
-
52
- async def get_code_style() -> str:
53
- """Concatenate contents of all AGENTS.md files up the directory tree."""
54
- parts: List[str] = []
55
- current = Path.cwd()
56
- while True:
57
- file = current / "AGENTS.md"
58
- if file.exists():
59
- try:
60
- parts.append(file.read_text(encoding="utf-8"))
61
- except Exception as e:
62
- logger.debug(f"Failed to read AGENTS.md at {file}: {e}")
63
- if current == current.parent:
64
- break
65
- current = current.parent
66
- return "\n".join(parts)
67
-
68
-
69
- async def get_claude_files() -> List[str]:
70
- """Return a list of additional AGENTS.md files in the repo."""
71
- return ripgrep("AGENTS.md", ".")