anixcode 0.12.4__tar.gz → 0.12.6__tar.gz

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.
Files changed (59) hide show
  1. {anixcode-0.12.4 → anixcode-0.12.6}/PKG-INFO +1 -1
  2. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/__init__.py +1 -1
  3. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/commands.py +4 -4
  4. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/i18n_en.py +12 -0
  5. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tui/anim.py +3 -2
  6. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tui/app.py +39 -7
  7. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tui/app.tcss +8 -1
  8. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tui/screens.py +111 -0
  9. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode.egg-info/PKG-INFO +1 -1
  10. {anixcode-0.12.4 → anixcode-0.12.6}/pyproject.toml +1 -1
  11. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_v011_features.py +23 -1
  12. {anixcode-0.12.4 → anixcode-0.12.6}/LICENSE +0 -0
  13. {anixcode-0.12.4 → anixcode-0.12.6}/README.md +0 -0
  14. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/__main__.py +0 -0
  15. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/agent.py +0 -0
  16. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/airpc.py +0 -0
  17. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/browser.py +0 -0
  18. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/checkpoints.py +0 -0
  19. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/cli.py +0 -0
  20. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/compaction.py +0 -0
  21. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/danger.py +0 -0
  22. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/i18n.py +0 -0
  23. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/images.py +0 -0
  24. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/llm.py +0 -0
  25. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/mcp.py +0 -0
  26. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/mentions.py +0 -0
  27. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/projects.py +0 -0
  28. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/prompts.py +0 -0
  29. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/providers.py +0 -0
  30. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/settings.py +0 -0
  31. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/storage.py +0 -0
  32. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tools/__init__.py +0 -0
  33. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tools/base.py +0 -0
  34. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tools/browser.py +0 -0
  35. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tools/files.py +0 -0
  36. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tools/search.py +0 -0
  37. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tools/shell.py +0 -0
  38. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tools/todo.py +0 -0
  39. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tools/web.py +0 -0
  40. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tui/__init__.py +0 -0
  41. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode/tui/widgets.py +0 -0
  42. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode.egg-info/SOURCES.txt +0 -0
  43. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode.egg-info/dependency_links.txt +0 -0
  44. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode.egg-info/entry_points.txt +0 -0
  45. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode.egg-info/requires.txt +0 -0
  46. {anixcode-0.12.4 → anixcode-0.12.6}/anixcode.egg-info/top_level.txt +0 -0
  47. {anixcode-0.12.4 → anixcode-0.12.6}/setup.cfg +0 -0
  48. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_agent.py +0 -0
  49. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_commands.py +0 -0
  50. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_i18n.py +0 -0
  51. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_images.py +0 -0
  52. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_llm.py +0 -0
  53. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_mcp.py +0 -0
  54. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_projects.py +0 -0
  55. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_providers.py +0 -0
  56. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_reliability.py +0 -0
  57. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_safety_mentions.py +0 -0
  58. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_settings.py +0 -0
  59. {anixcode-0.12.4 → anixcode-0.12.6}/tests/test_tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anixcode
3
- Version: 0.12.4
3
+ Version: 0.12.6
4
4
  Summary: AI coding agent for the terminal. Bring your own API key.
5
5
  Author: an1zy
6
6
  License-Expression: MIT
@@ -1,3 +1,3 @@
1
1
  """ANIX Code: an AI coding agent for your terminal. Bring your own API key."""
2
2
 
3
- __version__ = "0.12.4"
3
+ __version__ = "0.12.6"
@@ -79,9 +79,8 @@ ACTIONS: tuple[Command, ...] = (
79
79
  Command("undo", tr("откатить правки файлов из последнего ответа"), action="undo"),
80
80
  Command("redo", tr("вернуть то, что откатили /undo"), action="redo"),
81
81
  Command("compact", tr("сжать историю, чтобы освободить контекст"), action="compact"),
82
- Command("model", tr("модель, провайдер и API-ключ"), action="connect"),
83
- Command("models", tr("модель, провайдер и API-ключ"), action="connect"),
84
- Command("connect", tr("подключить провайдера"), action="connect"),
82
+ Command("model", tr("быстро переключить модель текущего провайдера"), action="model", args_hint=tr("[имя]")),
83
+ Command("connect", tr("подключить провайдера и API-ключ"), action="connect"),
85
84
  Command("project", tr("выбрать проект или склонировать репозиторий"), action="project"),
86
85
  Command("theme", tr("выбрать тему"), action="theme"),
87
86
  Command("themes", tr("выбрать тему"), action="theme"),
@@ -159,7 +158,8 @@ def all_commands(root: Path | None = None, config_dir: Path | None = None) -> li
159
158
 
160
159
 
161
160
  def find(name: str, commands: list[Command]) -> Command | None:
162
- return next((c for c in commands if c.name == name.lower()), None)
161
+ target = "model" if name.lower() == "models" else name.lower()
162
+ return next((c for c in commands if c.name == target), None)
163
163
 
164
164
 
165
165
  def parse(text: str) -> tuple[str, str]:
@@ -529,4 +529,16 @@ EN: dict[str, str] = {
529
529
  '✓ Подключение работает! Найдено моделей: {0}. Можно нажимать «Сохранить и начать».':
530
530
  '✓ Connection works! Found {0} models. Click “Save & start”.',
531
531
  '✓ Цель достигнута ({0}/{1})': '✓ Goal achieved ({0}/{1})',
532
+ # v0.12.5: quick model picker (/model & clicking model in statusbar)
533
+ '[имя]': '[name]',
534
+ 'Выбрать': 'Select',
535
+ 'Моделей: {0} · ↑↓ и Enter для выбора': 'Models: {0} · ↑↓ and Enter to pick',
536
+ 'Модель · {0}': 'Model · {0}',
537
+ 'Модель: {0}': 'Model: {0}',
538
+ 'Поиск или название модели…': 'Search or enter a model name…',
539
+ 'Провайдер и ключ': 'Provider & key',
540
+ 'Сервер не вернул список — введите название модели и нажмите Enter.':
541
+ 'Server returned no list — type a model name and press Enter.',
542
+ 'быстро переключить модель текущего провайдера': 'quickly switch model for the current provider',
543
+ 'подключить провайдера и API-ключ': 'connect a provider and API key',
532
544
  }
@@ -172,8 +172,9 @@ class AnimatedLogo(Static):
172
172
  line = sub[:shown].ljust(len(sub))
173
173
  for i, ch in enumerate(line):
174
174
  text.append(ch, _style(self._gradient.at(i / len(sub) * 0.4 - t * 0.07)))
175
- text.append("\n")
176
- text.append_text(self.logo_footer)
175
+ if self.logo_footer.plain:
176
+ text.append("\n")
177
+ text.append_text(self.logo_footer)
177
178
  self.update(text)
178
179
 
179
180
 
@@ -37,7 +37,7 @@ from ..settings import Credentials, Settings, config_dir, load_auth, load_projec
37
37
  from ..storage import Session, Store
38
38
  from ..tools import ToolContext, ToolResult, default_tools
39
39
  from .anim import THEME_LABELS, ActivityIndicator, AnimatedLogo, Gradient, make_themes, palette
40
- from .screens import HelpScreen, ProjectScreen, SessionsScreen, SetupScreen, ThemeScreen
40
+ from .screens import HelpScreen, ModelPickerScreen, ProjectScreen, SessionsScreen, SetupScreen, ThemeScreen
41
41
  from .widgets import (
42
42
  AssistantMessage, AttachmentBar, BrowserPane, BtwCard, Chip, ErrorMessage, MentionList, Notice, PermissionBar,
43
43
  PromptInput, ReasoningBlock, TodoBar, ToolCard, UserMessage,
@@ -119,16 +119,12 @@ class AnixApp(App):
119
119
  yield MentionList(id="mentions")
120
120
  yield PromptInput(id="prompt")
121
121
  with Horizontal(id="statusbar"):
122
- yield Chip("", self.action_connect, id="status-model")
122
+ yield Chip("", self.action_model, id="status-model")
123
123
  yield Static(id="status-usage")
124
124
  yield Chip("", self.action_toggle_access, id="status-access")
125
125
 
126
126
  def _welcome(self) -> Static:
127
- footer = Text()
128
- footer.append(f"v{__version__}\n\n", style="dim")
129
- footer.append(tr("Опишите задачу: агент сам прочитает код, внесёт правки и запустит команды.\n"), style="dim")
130
- footer.append(tr("Tab: Build/Plan · Ctrl+O: модель · F1: все клавиши"), style="dim")
131
- return AnimatedLogo(footer, animate=self.settings.animations, id="welcome")
127
+ return AnimatedLogo(Text(), animate=self.settings.animations, id="welcome")
132
128
 
133
129
  def on_mount(self) -> None:
134
130
  import contextlib
@@ -534,6 +530,9 @@ class AnixApp(App):
534
530
  if cmd.action == "browser":
535
531
  self.action_browser(args)
536
532
  return
533
+ if cmd.action == "model":
534
+ self.action_model(args)
535
+ return
537
536
  if cmd.action == "reasoning":
538
537
  self.action_reasoning(args)
539
538
  return
@@ -1203,6 +1202,39 @@ class AnixApp(App):
1203
1202
  self.notify(tr("Plan: агент только читает и планирует") if self._agent_mode == "plan"
1204
1203
  else tr("Build: агент может править код"), timeout=2)
1205
1204
 
1205
+ def action_model(self, args: str = "") -> None:
1206
+ if isinstance(self.screen, (ModelPickerScreen, SetupScreen)):
1207
+ return
1208
+ if not self.settings.provider or self._llm_client is None:
1209
+ self.action_connect()
1210
+ return
1211
+ direct = args.strip()
1212
+ if direct:
1213
+ self._switch_model(direct)
1214
+ return
1215
+ provider_name = providers.get(self.settings.provider, self.settings).name
1216
+
1217
+ def done(choice: str | None) -> None:
1218
+ if choice == "__connect__":
1219
+ self.action_connect()
1220
+ return
1221
+ if choice:
1222
+ self._switch_model(choice)
1223
+ self.query_one(PromptInput).focus()
1224
+
1225
+ self.push_screen(ModelPickerScreen(provider_name, self.settings.model, self._llm_client), done)
1226
+
1227
+ def _switch_model(self, model_id: str) -> None:
1228
+ self.settings.model = model_id
1229
+ save_settings(self.settings, self.config_base)
1230
+ if self.agent is not None:
1231
+ self.agent.model = model_id
1232
+ else:
1233
+ self._build_agent()
1234
+ self.session.model = model_id
1235
+ self._refresh_bars()
1236
+ self.notify(tr("Модель: {0}", model_id), timeout=3)
1237
+
1206
1238
  def action_connect(self) -> None:
1207
1239
  if isinstance(self.screen, SetupScreen):
1208
1240
  return
@@ -121,7 +121,10 @@ Screen {
121
121
  }
122
122
  #welcome {
123
123
  width: 100%;
124
- margin: 3 0 1 0;
124
+ height: 1fr;
125
+ min-height: 9;
126
+ margin: 0;
127
+ content-align: center middle;
125
128
  text-align: center;
126
129
  color: $accent;
127
130
  }
@@ -260,6 +263,10 @@ ModalScreen {
260
263
  #models.visible {
261
264
  display: block;
262
265
  }
266
+ #model-picker-list {
267
+ height: 14;
268
+ margin: 1 0 0 0;
269
+ }
263
270
  #session-list {
264
271
  height: auto;
265
272
  max-height: 20;
@@ -270,6 +270,117 @@ class SetupScreen(ModalScreen[bool]):
270
270
  self.dismiss(False)
271
271
 
272
272
 
273
+ class ModelPickerScreen(ModalScreen[str | None]):
274
+ """Quick model switcher for the active provider: live fetch + search filter.
275
+
276
+ Returns:
277
+ - chosen model id (str)
278
+ - "__connect__" if the user wants to switch provider / edit API key
279
+ - None on cancel
280
+ """
281
+
282
+ BINDINGS = [("escape", "cancel", tr("Отмена"))]
283
+
284
+ def __init__(self, provider_name: str, current_model: str, client) -> None:
285
+ super().__init__()
286
+ self._provider_name = provider_name
287
+ self._current_model = current_model
288
+ self._client = client
289
+ self._all_models: list[str] = []
290
+ self._filtered: list[str] = []
291
+
292
+ def compose(self) -> ComposeResult:
293
+ with Vertical(id="dialog"):
294
+ yield Label(tr("Модель · {0}", self._provider_name), classes="dialog-title")
295
+ yield Input(placeholder=tr("Поиск или название модели…"), id="model-filter")
296
+ yield Static(tr("Загружаю список моделей…"), id="model-picker-status", classes="hint")
297
+ yield OptionList(id="model-picker-list")
298
+ with Horizontal(classes="buttons"):
299
+ yield Button(tr("Выбрать"), id="mp-pick", variant="primary")
300
+ yield Button(tr("Провайдер и ключ"), id="mp-connect")
301
+ yield Button(tr("Отмена"), id="mp-cancel")
302
+
303
+ def on_mount(self) -> None:
304
+ self.query_one("#model-filter", Input).focus()
305
+ self._load_models()
306
+
307
+ @work(exclusive=True, group="model-picker")
308
+ async def _load_models(self) -> None:
309
+ status = self.query_one("#model-picker-status", Static)
310
+ try:
311
+ models = await self._client.list_models()
312
+ except LLMError as e:
313
+ status.update(Text(str(e).splitlines()[0], style="red"))
314
+ return
315
+ self._all_models = models
316
+ if not models:
317
+ status.update(tr("Сервер не вернул список — введите название модели и нажмите Enter."))
318
+ return
319
+ self._render_list(self.query_one("#model-filter", Input).value)
320
+
321
+ def _render_list(self, query: str) -> None:
322
+ q = query.strip().lower()
323
+ self._filtered = [m for m in self._all_models if not q or q in m.lower()]
324
+ box = self.query_one("#model-picker-list", OptionList)
325
+ box.clear_options()
326
+ for m in self._filtered:
327
+ if m == self._current_model:
328
+ box.add_option(Text.assemble(("● ", "bold"), (m, "bold")))
329
+ else:
330
+ box.add_option(Text(f" {m}"))
331
+ status = self.query_one("#model-picker-status", Static)
332
+ status.update(tr("Моделей: {0} · ↑↓ и Enter для выбора", len(self._filtered)))
333
+ if self._filtered:
334
+ if self._current_model in self._filtered and not q:
335
+ box.highlighted = self._filtered.index(self._current_model)
336
+ else:
337
+ box.highlighted = 0
338
+
339
+ @on(Input.Changed, "#model-filter")
340
+ def _filter_changed(self, event: Input.Changed) -> None:
341
+ if self._all_models:
342
+ self._render_list(event.value)
343
+
344
+ @on(Input.Submitted, "#model-filter")
345
+ def _filter_submitted(self) -> None:
346
+ self._confirm()
347
+
348
+ @on(OptionList.OptionSelected, "#model-picker-list")
349
+ def _option_picked(self, event: OptionList.OptionSelected) -> None:
350
+ if 0 <= event.option_index < len(self._filtered):
351
+ self.dismiss(self._filtered[event.option_index])
352
+
353
+ def _confirm(self) -> None:
354
+ box = self.query_one("#model-picker-list", OptionList)
355
+ typed = self.query_one("#model-filter", Input).value.strip()
356
+ if self._filtered and box.highlighted is not None and 0 <= box.highlighted < len(self._filtered):
357
+ self.dismiss(self._filtered[box.highlighted])
358
+ elif typed:
359
+ self.dismiss(typed)
360
+
361
+ def on_key(self, event) -> None:
362
+ if event.key in ("down", "up") and self._filtered:
363
+ box = self.query_one("#model-picker-list", OptionList)
364
+ if event.key == "down":
365
+ box.action_cursor_down()
366
+ else:
367
+ box.action_cursor_up()
368
+ event.stop()
369
+ event.prevent_default()
370
+
371
+ @on(Button.Pressed, "#mp-pick")
372
+ def _pick_pressed(self) -> None:
373
+ self._confirm()
374
+
375
+ @on(Button.Pressed, "#mp-connect")
376
+ def _connect_pressed(self) -> None:
377
+ self.dismiss("__connect__")
378
+
379
+ @on(Button.Pressed, "#mp-cancel")
380
+ def action_cancel(self) -> None:
381
+ self.dismiss(None)
382
+
383
+
273
384
  class ThemeScreen(ModalScreen[str | None]):
274
385
  """Theme picker with live preview."""
275
386
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anixcode
3
- Version: 0.12.4
3
+ Version: 0.12.6
4
4
  Summary: AI coding agent for the terminal. Bring your own API key.
5
5
  Author: an1zy
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "anixcode"
3
- version = "0.12.4"
3
+ version = "0.12.6"
4
4
  description = "AI coding agent for the terminal. Bring your own API key."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -305,9 +305,16 @@ def test_project_mcp_skills_global_rules_and_wal(tmp_path):
305
305
 
306
306
  def test_tui_boots_with_browser_pane_and_todo_bar(tmp_path):
307
307
  from anixcode.tui.app import AnixApp
308
- from anixcode.tui.screens import SetupScreen
308
+ from anixcode.tui.screens import ModelPickerScreen, SetupScreen
309
309
  from anixcode.tui.widgets import BrowserPane, TodoBar
310
310
 
311
+ class FakeModelClient:
312
+ async def list_models(self):
313
+ return ["deepseek-chat", "deepseek-reasoner", "qwen-coder"]
314
+
315
+ async def aclose(self):
316
+ pass
317
+
311
318
  async def go():
312
319
  store = Store(tmp_path / "tui.db")
313
320
  app = AnixApp(tmp_path, Settings(provider="deepseek", model="deepseek-chat", animations=False),
@@ -326,6 +333,21 @@ def test_tui_boots_with_browser_pane_and_todo_bar(tmp_path):
326
333
  app.action_reasoning("medium")
327
334
  await pilot.pause()
328
335
  assert app.settings.reasoning_effort == "medium"
336
+
337
+ # Direct /model <name> switches immediately
338
+ app._llm_client = FakeModelClient()
339
+ app.action_model("qwen-coder")
340
+ assert app.settings.model == "qwen-coder" and app.agent.model == "qwen-coder"
341
+
342
+ # Clicking model / calling /model opens ModelPickerScreen with live list & filter
343
+ app.action_model()
344
+ await pilot.pause(0.1)
345
+ assert isinstance(app.screen, ModelPickerScreen)
346
+ app.screen._render_list("reasoner")
347
+ app.screen._confirm()
348
+ await pilot.pause()
349
+ assert app.settings.model == "deepseek-reasoner" and app.agent.model == "deepseek-reasoner"
350
+
329
351
  app.action_connect()
330
352
  await pilot.pause()
331
353
  assert isinstance(app.screen, SetupScreen)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes