janito 3.6.1__py3-none-any.whl → 3.7.0__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.
- janito/README.md +4 -7
- janito/cli/chat_mode/bindings.py +0 -50
- janito/cli/chat_mode/session.py +1 -12
- janito/cli/chat_mode/shell/commands/multi.py +0 -5
- janito/cli/chat_mode/shell/commands/security/allowed_sites.py +33 -47
- janito/cli/cli_commands/list_plugins.py +43 -52
- janito/cli/cli_commands/list_tools.py +1 -6
- janito/cli/core/getters.py +0 -3
- janito/cli/core/model_guesser.py +24 -40
- janito/cli/main_cli.py +13 -10
- janito/cli/prompt_core.py +9 -47
- janito/cli/rich_terminal_reporter.py +4 -4
- janito/docs/GETTING_STARTED.md +9 -8
- janito/drivers/openai/driver.py +0 -1
- janito/drivers/zai/driver.py +0 -1
- janito/i18n/it.py +46 -46
- janito/llm/agent.py +16 -32
- janito/llm/auth_utils.py +5 -14
- janito/llm/driver.py +0 -8
- janito/plugins/__init__.py +12 -31
- janito/plugins/auto_loader.py +11 -12
- janito/plugins/auto_loader_fixed.py +11 -12
- janito/{plugin_system → plugins}/base.py +2 -5
- janito/plugins/builtin.py +1 -15
- janito/plugins/core_adapter.py +11 -89
- janito/plugins/core_loader.py +120 -0
- janito/plugins/core_loader_fixed.py +125 -0
- janito/plugins/discovery.py +5 -5
- janito/plugins/discovery_core.py +9 -14
- janito/plugins/manager.py +1 -1
- janito/providers/__init__.py +0 -1
- janito/providers/moonshot/model_info.py +7 -7
- janito/providers/moonshot/provider.py +1 -1
- janito/tools/__init__.py +7 -41
- janito/tools/adapters/__init__.py +1 -6
- janito/tools/adapters/local/__init__.py +70 -7
- janito/{plugins/tools/core → tools/adapters/local}/ask_user.py +3 -3
- janito/tools/adapters/local/copy_file.py +87 -0
- janito/tools/adapters/local/create_file.py +138 -0
- janito/{plugins/tools/core → tools/adapters/local}/fetch_url.py +23 -20
- janito/tools/adapters/local/move_file.py +131 -0
- janito/{plugins/tools/core → tools/adapters/local}/python_code_run.py +7 -23
- janito/{plugins/tools/core → tools/adapters/local}/python_command_run.py +5 -21
- janito/{plugins/tools/core → tools/adapters/local}/python_file_run.py +5 -21
- janito/tools/adapters/local/remove_file.py +58 -0
- janito/{plugins/tools/core → tools/adapters/local}/replace_text_in_file.py +4 -4
- janito/{plugins/tools/core → tools/adapters/local}/run_bash_command.py +3 -3
- janito/{plugins/tools/core → tools/adapters/local}/run_powershell_command.py +3 -3
- janito/{plugins/tools/core → tools/adapters/local}/show_image.py +6 -15
- janito/{plugins/core/imagedisplay/tools → tools/adapters/local}/show_image_grid.py +5 -13
- janito/tools/adapters/local/view_file.py +172 -0
- janito/tools/function_adapter.py +65 -0
- janito/tools/loop_protection_decorator.py +117 -114
- janito-3.7.0.dist-info/METADATA +84 -0
- janito-3.7.0.dist-info/RECORD +264 -0
- janito/cli/cli_commands/check_tools.py +0 -212
- janito/data/blocked.txt +0 -96
- janito/llm/cancellation_manager.py +0 -63
- janito/llm/enter_cancellation.py +0 -107
- janito/plugin_system/__init__.py +0 -10
- janito/plugin_system/core_loader.py +0 -217
- janito/plugin_system/core_loader_fixed.py +0 -225
- janito/plugins/core/__init__.py +0 -7
- janito/plugins/core/codeanalyzer/__init__.py +0 -43
- janito/plugins/core/filemanager/__init__.py +0 -124
- janito/plugins/core/filemanager/tools/copy_file.py +0 -87
- janito/plugins/core/filemanager/tools/create_file.py +0 -87
- janito/plugins/core/filemanager/tools/move_file.py +0 -131
- janito/plugins/core/filemanager/tools/remove_file.py +0 -58
- janito/plugins/core/filemanager/tools/replace_text_in_file.py +0 -270
- janito/plugins/core/filemanager/tools/view_file.py +0 -172
- janito/plugins/core/imagedisplay/__init__.py +0 -14
- janito/plugins/core/imagedisplay/plugin.py +0 -51
- janito/plugins/core/imagedisplay/tools/__init__.py +0 -1
- janito/plugins/core/imagedisplay/tools/show_image.py +0 -83
- janito/plugins/core/system/__init__.py +0 -23
- janito/plugins/core/system/tools/run_bash_command.py +0 -204
- janito/plugins/core/system/tools/run_powershell_command.py +0 -234
- janito/plugins/dev/__init__.py +0 -7
- janito/plugins/dev/pythondev/__init__.py +0 -37
- janito/plugins/dev/visualization/__init__.py +0 -23
- janito/plugins/example_plugin.py +0 -108
- janito/plugins/tools/__init__.py +0 -39
- janito/plugins/tools/core/__init__.py +0 -65
- janito/plugins/tools/core/copy_file.py +0 -87
- janito/plugins/tools/core/create_directory.py +0 -70
- janito/plugins/tools/core/create_file.py +0 -138
- janito/plugins/tools/core/decorators.py +0 -19
- janito/plugins/tools/core/delete_text_in_file.py +0 -134
- janito/plugins/tools/core/find_files.py +0 -143
- janito/plugins/tools/core/get_file_outline/__init__.py +0 -7
- janito/plugins/tools/core/get_file_outline/core.py +0 -122
- janito/plugins/tools/core/get_file_outline/java_outline.py +0 -47
- janito/plugins/tools/core/get_file_outline/markdown_outline.py +0 -14
- janito/plugins/tools/core/get_file_outline/python_outline.py +0 -303
- janito/plugins/tools/core/get_file_outline/search_outline.py +0 -36
- janito/plugins/tools/core/move_file.py +0 -131
- janito/plugins/tools/core/open_html_in_browser.py +0 -51
- janito/plugins/tools/core/open_url.py +0 -37
- janito/plugins/tools/core/read_chart.py +0 -259
- janito/plugins/tools/core/read_files.py +0 -58
- janito/plugins/tools/core/remove_directory.py +0 -55
- janito/plugins/tools/core/remove_file.py +0 -58
- janito/plugins/tools/core/search_text/__init__.py +0 -7
- janito/plugins/tools/core/search_text/core.py +0 -205
- janito/plugins/tools/core/search_text/match_lines.py +0 -67
- janito/plugins/tools/core/search_text/pattern_utils.py +0 -73
- janito/plugins/tools/core/search_text/traverse_directory.py +0 -145
- janito/plugins/tools/core/show_image_grid.py +0 -85
- janito/plugins/tools/core/validate_file_syntax/__init__.py +0 -7
- janito/plugins/tools/core/validate_file_syntax/core.py +0 -114
- janito/plugins/tools/core/validate_file_syntax/css_validator.py +0 -35
- janito/plugins/tools/core/validate_file_syntax/html_validator.py +0 -100
- janito/plugins/tools/core/validate_file_syntax/jinja2_validator.py +0 -50
- janito/plugins/tools/core/validate_file_syntax/js_validator.py +0 -27
- janito/plugins/tools/core/validate_file_syntax/json_validator.py +0 -6
- janito/plugins/tools/core/validate_file_syntax/markdown_validator.py +0 -109
- janito/plugins/tools/core/validate_file_syntax/ps1_validator.py +0 -32
- janito/plugins/tools/core/validate_file_syntax/python_validator.py +0 -5
- janito/plugins/tools/core/validate_file_syntax/xml_validator.py +0 -11
- janito/plugins/tools/core/validate_file_syntax/yaml_validator.py +0 -6
- janito/plugins/tools/core/view_file.py +0 -172
- janito/plugins/ui/__init__.py +0 -7
- janito/plugins/ui/userinterface/__init__.py +0 -16
- janito/plugins/ui/userinterface/tools/ask_user.py +0 -110
- janito/plugins/web/__init__.py +0 -7
- janito/plugins/web/webtools/__init__.py +0 -23
- janito/providers/together/__init__.py +0 -1
- janito/providers/together/model_info.py +0 -69
- janito/providers/together/provider.py +0 -108
- janito/tools/blocked_sites.py +0 -74
- janito/tools/cli_initializer.py +0 -88
- janito/tools/initialize.py +0 -70
- janito-3.6.1.dist-info/METADATA +0 -228
- janito-3.6.1.dist-info/RECORD +0 -339
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/create_directory.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/delete_text_in_file.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/find_files.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/__init__.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/core.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/java_outline.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/markdown_outline.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/python_outline.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/get_file_outline/search_outline.py +0 -0
- /janito/{plugins/web/webtools/tools → tools/adapters/local}/open_html_in_browser.py +0 -0
- /janito/{plugins/web/webtools/tools → tools/adapters/local}/open_url.py +0 -0
- /janito/{plugins/dev/visualization/tools → tools/adapters/local}/read_chart.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/read_files.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/remove_directory.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/search_text/__init__.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/search_text/core.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/search_text/match_lines.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/search_text/pattern_utils.py +0 -0
- /janito/{plugins/core/codeanalyzer/tools → tools/adapters/local}/search_text/traverse_directory.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/__init__.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/core.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/css_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/html_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/jinja2_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/js_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/json_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/markdown_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/ps1_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/python_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/xml_validator.py +0 -0
- /janito/{plugins/core/filemanager/tools → tools/adapters/local}/validate_file_syntax/yaml_validator.py +0 -0
- {janito-3.6.1.dist-info → janito-3.7.0.dist-info}/WHEEL +0 -0
- {janito-3.6.1.dist-info → janito-3.7.0.dist-info}/entry_points.txt +0 -0
- {janito-3.6.1.dist-info → janito-3.7.0.dist-info}/licenses/LICENSE +0 -0
- {janito-3.6.1.dist-info → janito-3.7.0.dist-info}/top_level.txt +0 -0
janito/README.md
CHANGED
@@ -26,7 +26,7 @@ pip install janito
|
|
26
26
|
janito "Create a Python script that reads a CSV file"
|
27
27
|
|
28
28
|
# Using a specific Moonshot model
|
29
|
-
janito -m kimi-
|
29
|
+
janito -m kimi-k1-8k "Explain quantum computing"
|
30
30
|
```
|
31
31
|
|
32
32
|
**Other Providers**
|
@@ -72,14 +72,14 @@ In chat mode, you can:
|
|
72
72
|
Set default provider and model:
|
73
73
|
```bash
|
74
74
|
janito --set provider=moonshot
|
75
|
-
janito --set model=kimi-
|
75
|
+
janito --set model=kimi-k1-8k
|
76
76
|
```
|
77
77
|
|
78
78
|
## Providers
|
79
79
|
|
80
80
|
### Moonshot (Recommended)
|
81
81
|
|
82
|
-
- **Models**: kimi-
|
82
|
+
- **Models**: kimi-k1-8k, kimi-k1-32k, kimi-k1-128k, kimi-k2-turbo-preview, kimi-k2-0905-preview
|
83
83
|
- **Strengths**: Excellent Chinese/English support, competitive pricing, fast responses
|
84
84
|
- **Setup**: Get API key from [Moonshot AI Platform](https://platform.moonshot.cn/)
|
85
85
|
|
@@ -106,9 +106,6 @@ janito --set model=kimi-k2-0905
|
|
106
106
|
|
107
107
|
## Advanced Features
|
108
108
|
|
109
|
-
### 🚀 New in v3.1.0: Enter Key Cancellation
|
110
|
-
**Chat Mode Enhancement**: Press **Enter** at any time to instantly cancel long-running requests in interactive chat mode. No more waiting for stuck requests!
|
111
|
-
|
112
109
|
### Tool Usage
|
113
110
|
|
114
111
|
Janito includes powerful built-in tools for:
|
@@ -133,7 +130,7 @@ You can also configure via environment variables:
|
|
133
130
|
```bash
|
134
131
|
export MOONSHOT_API_KEY=your_key_here
|
135
132
|
export JANITO_PROVIDER=moonshot
|
136
|
-
export JANITO_MODEL=kimi-
|
133
|
+
export JANITO_MODEL=kimi-k1-8k
|
137
134
|
```
|
138
135
|
|
139
136
|
**OpenAI:**
|
janito/cli/chat_mode/bindings.py
CHANGED
@@ -35,54 +35,4 @@ class KeyBindingsFactory:
|
|
35
35
|
buf.text = "Do It"
|
36
36
|
buf.validate_and_handle()
|
37
37
|
|
38
|
-
@bindings.add("c-c")
|
39
|
-
def _(event):
|
40
|
-
"""Handle Ctrl+C to interrupt current request or exit chat."""
|
41
|
-
# Use global cancellation manager for robust cancellation
|
42
|
-
from janito.llm.cancellation_manager import get_cancellation_manager
|
43
|
-
|
44
|
-
cancel_manager = get_cancellation_manager()
|
45
|
-
|
46
|
-
cancelled = cancel_manager.cancel_current_request()
|
47
|
-
if cancelled:
|
48
|
-
# Provide user feedback
|
49
|
-
from rich.console import Console
|
50
|
-
|
51
|
-
console = Console()
|
52
|
-
console.print("[red]Request cancelled by Ctrl+C[/red]")
|
53
|
-
|
54
|
-
# Prevent the Ctrl+C from being processed as input
|
55
|
-
event.app.output.flush()
|
56
|
-
return
|
57
|
-
else:
|
58
|
-
# No active request to cancel, exit the chat
|
59
|
-
from rich.console import Console
|
60
|
-
console = Console()
|
61
|
-
console.print("[yellow]Goodbye![/yellow]")
|
62
|
-
event.app.exit()
|
63
|
-
|
64
|
-
@bindings.add("escape", eager=True)
|
65
|
-
def _(event):
|
66
|
-
"""Handle ESC key to interrupt current request (like Ctrl+C)."""
|
67
|
-
import threading
|
68
|
-
|
69
|
-
# Use global cancellation manager for robust cancellation
|
70
|
-
from janito.llm.cancellation_manager import get_cancellation_manager
|
71
|
-
|
72
|
-
cancel_manager = get_cancellation_manager()
|
73
|
-
|
74
|
-
cancelled = cancel_manager.cancel_current_request()
|
75
|
-
if cancelled:
|
76
|
-
# Provide user feedback
|
77
|
-
from rich.console import Console
|
78
|
-
|
79
|
-
console = Console()
|
80
|
-
console.print("[red]Request cancelled by ESC key[/red]")
|
81
|
-
|
82
|
-
# Prevent the ESC key from being processed as input
|
83
|
-
event.app.output.flush()
|
84
|
-
return
|
85
|
-
|
86
|
-
# If no active request to cancel, ESC does nothing
|
87
|
-
|
88
38
|
return bindings
|
janito/cli/chat_mode/session.py
CHANGED
@@ -22,7 +22,6 @@ import time
|
|
22
22
|
|
23
23
|
# Shared prompt/agent factory
|
24
24
|
from janito.cli.prompt_setup import setup_agent_and_prompt_handler
|
25
|
-
from janito.llm.cancellation_manager import get_cancellation_manager
|
26
25
|
|
27
26
|
import time
|
28
27
|
|
@@ -114,10 +113,6 @@ class ChatSession:
|
|
114
113
|
|
115
114
|
# Check if multi-line mode should be enabled by default
|
116
115
|
self.multi_line_mode = getattr(args, "multi", False) if args else False
|
117
|
-
|
118
|
-
# Default to single-line mode (Enter submits) unless explicitly enabled
|
119
|
-
if not self.multi_line_mode:
|
120
|
-
self.multi_line_mode = False
|
121
116
|
|
122
117
|
def _select_profile_and_role(self, args, role):
|
123
118
|
profile, role_arg, python_profile, market_profile = self._extract_args(args)
|
@@ -288,13 +283,7 @@ class ChatSession:
|
|
288
283
|
)
|
289
284
|
)
|
290
285
|
|
291
|
-
|
292
|
-
self._prompt_handler.run_prompt(cmd_input)
|
293
|
-
finally:
|
294
|
-
# Ensure cancellation manager is cleared
|
295
|
-
cancel_manager = get_cancellation_manager()
|
296
|
-
cancel_manager.clear_current_request()
|
297
|
-
|
286
|
+
self._prompt_handler.run_prompt(cmd_input)
|
298
287
|
end_time = time.time()
|
299
288
|
elapsed = end_time - start_time
|
300
289
|
self.msg_count += 1
|
@@ -23,11 +23,6 @@ class MultiShellHandler(ShellCmdHandler):
|
|
23
23
|
submitted["value"] = buffer.text
|
24
24
|
event.app.exit(result=buffer.text)
|
25
25
|
|
26
|
-
# Support single ESC to cancel/interrupt (like Ctrl+C)
|
27
|
-
@bindings.add("escape")
|
28
|
-
def _(event):
|
29
|
-
raise KeyboardInterrupt
|
30
|
-
|
31
26
|
# Support Ctrl+D
|
32
27
|
@bindings.add("c-d")
|
33
28
|
def _(event):
|
@@ -59,53 +59,39 @@ Examples:
|
|
59
59
|
command = args[0].lower()
|
60
60
|
whitelist_manager = get_url_whitelist_manager()
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
62
|
+
if command == "list":
|
63
|
+
sites = whitelist_manager.get_allowed_sites()
|
64
|
+
if sites:
|
65
|
+
print("Allowed sites:")
|
66
|
+
for site in sites:
|
67
|
+
print(f" • {site}")
|
68
|
+
else:
|
69
|
+
print("No sites are whitelisted (all sites are allowed)")
|
70
|
+
|
71
|
+
elif command == "add":
|
72
|
+
if len(args) < 2:
|
73
|
+
print("Error: Please specify a site to add")
|
74
|
+
return
|
75
|
+
site = args[1]
|
76
|
+
if whitelist_manager.add_allowed_site(site):
|
77
|
+
print(f"✅ Added '{site}' to allowed sites")
|
78
|
+
else:
|
79
|
+
print(f"ℹ️ '{site}' is already in allowed sites")
|
80
|
+
|
81
|
+
elif command == "remove":
|
82
|
+
if len(args) < 2:
|
83
|
+
print("Error: Please specify a site to remove")
|
84
|
+
return
|
85
|
+
site = args[1]
|
86
|
+
if whitelist_manager.remove_allowed_site(site):
|
87
|
+
print(f"✅ Removed '{site}' from allowed sites")
|
88
|
+
else:
|
89
|
+
print(f"ℹ️ '{site}' was not in allowed sites")
|
90
|
+
|
91
|
+
elif command == "clear":
|
92
|
+
whitelist_manager.clear_whitelist()
|
93
|
+
print("✅ Cleared all allowed sites (all sites are now allowed)")
|
94
|
+
|
72
95
|
else:
|
73
96
|
print(f"Error: Unknown command '{command}'")
|
74
97
|
print(self.get_usage())
|
75
|
-
|
76
|
-
def _handle_list(self, args, whitelist_manager):
|
77
|
-
"""Handle list command."""
|
78
|
-
sites = whitelist_manager.get_allowed_sites()
|
79
|
-
if sites:
|
80
|
-
print("Allowed sites:")
|
81
|
-
for site in sites:
|
82
|
-
print(f" • {site}")
|
83
|
-
else:
|
84
|
-
print("No sites are whitelisted (all sites are allowed)")
|
85
|
-
|
86
|
-
def _handle_add(self, args, whitelist_manager):
|
87
|
-
"""Handle add command."""
|
88
|
-
if len(args) < 2:
|
89
|
-
print("Error: Please specify a site to add")
|
90
|
-
return
|
91
|
-
site = args[1]
|
92
|
-
if whitelist_manager.add_allowed_site(site):
|
93
|
-
print(f"✅ Added '{site}' to allowed sites")
|
94
|
-
else:
|
95
|
-
print(f"ℹ️ '{site}' is already in allowed sites")
|
96
|
-
|
97
|
-
def _handle_remove(self, args, whitelist_manager):
|
98
|
-
"""Handle remove command."""
|
99
|
-
if len(args) < 2:
|
100
|
-
print("Error: Please specify a site to remove")
|
101
|
-
return
|
102
|
-
site = args[1]
|
103
|
-
if whitelist_manager.remove_allowed_site(site):
|
104
|
-
print(f"✅ Removed '{site}' from allowed sites")
|
105
|
-
else:
|
106
|
-
print(f"ℹ️ '{site}' was not in allowed sites")
|
107
|
-
|
108
|
-
def _handle_clear(self, args, whitelist_manager):
|
109
|
-
"""Handle clear command."""
|
110
|
-
whitelist_manager.clear_whitelist()
|
111
|
-
print("✅ Cleared all allowed sites (all sites are now allowed)")
|
@@ -8,11 +8,7 @@ from janito.plugins.discovery import list_available_plugins
|
|
8
8
|
import os
|
9
9
|
from janito.plugins.manager import PluginManager
|
10
10
|
from janito.plugins.builtin import BuiltinPluginRegistry
|
11
|
-
from janito.plugins.auto_loader_fixed import
|
12
|
-
load_core_plugins,
|
13
|
-
get_loaded_core_plugins,
|
14
|
-
is_core_plugin,
|
15
|
-
)
|
11
|
+
from janito.plugins.auto_loader_fixed import load_core_plugins, get_loaded_core_plugins, is_core_plugin
|
16
12
|
from rich.console import Console
|
17
13
|
from rich.table import Table
|
18
14
|
from rich.panel import Panel
|
@@ -55,8 +51,7 @@ def _list_available_plugins():
|
|
55
51
|
console.print(table)
|
56
52
|
|
57
53
|
# Show core plugins
|
58
|
-
from janito.
|
59
|
-
|
54
|
+
from janito.plugins.core_loader_fixed import get_core_plugins
|
60
55
|
core_plugins = get_core_plugins()
|
61
56
|
core_table = Table(title="Core Plugins (Enabled by Default)")
|
62
57
|
core_table.add_column("Plugin Name", style="cyan", no_wrap=True)
|
@@ -67,16 +62,14 @@ def _list_available_plugins():
|
|
67
62
|
|
68
63
|
console.print(core_table)
|
69
64
|
else:
|
70
|
-
console.print(
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
)
|
79
|
-
)
|
65
|
+
console.print(Panel(
|
66
|
+
"No plugins found in search paths\n"
|
67
|
+
f"[dim]Search paths:[/dim]\n"
|
68
|
+
f" • {os.getcwd()}/plugins\n"
|
69
|
+
f" • {os.path.expanduser('~')}/.janito/plugins",
|
70
|
+
title="No Plugins Found",
|
71
|
+
style="yellow"
|
72
|
+
))
|
80
73
|
|
81
74
|
|
82
75
|
def _print_builtin_plugins(builtin_plugins):
|
@@ -99,7 +92,7 @@ def _print_external_plugins(available, builtin_plugins):
|
|
99
92
|
def _list_plugin_resources():
|
100
93
|
"""List all resources from loaded plugins using rich formatting."""
|
101
94
|
from janito.plugins.auto_loader_fixed import get_plugin_manager
|
102
|
-
|
95
|
+
|
103
96
|
console = Console()
|
104
97
|
manager = get_plugin_manager()
|
105
98
|
all_resources = manager.list_all_resources()
|
@@ -107,11 +100,11 @@ def _list_plugin_resources():
|
|
107
100
|
if all_resources:
|
108
101
|
for plugin_name, resources in all_resources.items():
|
109
102
|
metadata = manager.get_plugin_metadata(plugin_name)
|
110
|
-
version = metadata.version if metadata else
|
111
|
-
|
103
|
+
version = metadata.version if metadata else 'unknown'
|
104
|
+
|
112
105
|
# Create panel for each plugin
|
113
106
|
panel_content = []
|
114
|
-
|
107
|
+
|
115
108
|
tools = [r for r in resources if r["type"] == "tool"]
|
116
109
|
commands = [r for r in resources if r["type"] == "command"]
|
117
110
|
configs = [r for r in resources if r["type"] == "config"]
|
@@ -129,25 +122,19 @@ def _list_plugin_resources():
|
|
129
122
|
if configs:
|
130
123
|
panel_content.append("[bold yellow]Configuration:[/bold yellow]")
|
131
124
|
for config in configs:
|
132
|
-
panel_content.append(
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
title=f"{plugin_name} v{version}",
|
140
|
-
style="cyan",
|
141
|
-
)
|
142
|
-
)
|
125
|
+
panel_content.append(f" • {config['name']}: {config['description']}")
|
126
|
+
|
127
|
+
console.print(Panel(
|
128
|
+
"\n".join(panel_content),
|
129
|
+
title=f"{plugin_name} v{version}",
|
130
|
+
style="cyan"
|
131
|
+
))
|
143
132
|
else:
|
144
|
-
console.print(
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
)
|
150
|
-
)
|
133
|
+
console.print(Panel(
|
134
|
+
"No plugins are currently loaded.",
|
135
|
+
title="No Plugin Resources",
|
136
|
+
style="yellow"
|
137
|
+
))
|
151
138
|
|
152
139
|
|
153
140
|
def _print_resources_by_type(resources):
|
@@ -175,7 +162,7 @@ def _print_resources_by_type(resources):
|
|
175
162
|
def _list_loaded_plugins():
|
176
163
|
"""List loaded plugins using rich formatting."""
|
177
164
|
from janito.plugins.auto_loader_fixed import get_plugin_manager
|
178
|
-
|
165
|
+
|
179
166
|
console = Console()
|
180
167
|
manager = get_plugin_manager()
|
181
168
|
loaded = manager.list_plugins()
|
@@ -190,38 +177,42 @@ def _list_loaded_plugins():
|
|
190
177
|
|
191
178
|
core_plugins = []
|
192
179
|
other_plugins = []
|
193
|
-
|
180
|
+
|
194
181
|
for plugin_name in loaded:
|
195
182
|
if is_core_plugin(plugin_name):
|
196
183
|
core_plugins.append(plugin_name)
|
197
184
|
else:
|
198
185
|
other_plugins.append(plugin_name)
|
199
|
-
|
186
|
+
|
200
187
|
# Add core plugins
|
201
188
|
for plugin_name in core_plugins:
|
202
189
|
metadata = manager.get_plugin_metadata(plugin_name)
|
203
190
|
if metadata:
|
204
191
|
table.add_row(
|
205
|
-
metadata.name,
|
192
|
+
metadata.name,
|
193
|
+
metadata.version,
|
194
|
+
metadata.description,
|
195
|
+
"🔵 Core"
|
206
196
|
)
|
207
|
-
|
197
|
+
|
208
198
|
# Add other plugins
|
209
199
|
for plugin_name in other_plugins:
|
210
200
|
metadata = manager.get_plugin_metadata(plugin_name)
|
211
201
|
if metadata:
|
212
202
|
table.add_row(
|
213
|
-
metadata.name,
|
203
|
+
metadata.name,
|
204
|
+
metadata.version,
|
205
|
+
metadata.description,
|
206
|
+
"🔶 External"
|
214
207
|
)
|
215
208
|
|
216
209
|
console.print(table)
|
217
210
|
else:
|
218
|
-
console.print(
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
)
|
224
|
-
)
|
211
|
+
console.print(Panel(
|
212
|
+
"No plugins are currently loaded.",
|
213
|
+
title="No Plugins Loaded",
|
214
|
+
style="yellow"
|
215
|
+
))
|
225
216
|
|
226
217
|
|
227
218
|
def _print_plugin_details(manager, plugin_name):
|
@@ -76,12 +76,7 @@ def handle_list_tools(args=None):
|
|
76
76
|
DisabledToolsState.set_disabled_tools(disabled_str)
|
77
77
|
disabled_tools = DisabledToolsState.get_disabled_tools()
|
78
78
|
|
79
|
-
|
80
|
-
from janito.tools import get_local_tools_adapter
|
81
|
-
registry = get_local_tools_adapter()
|
82
|
-
if registry is None:
|
83
|
-
print("No tools available - tools initialization failed.")
|
84
|
-
return
|
79
|
+
registry = janito.tools.local_tools_adapter
|
85
80
|
tools = registry.list_tools()
|
86
81
|
if tools:
|
87
82
|
from rich.console import Console
|
janito/cli/core/getters.py
CHANGED
@@ -5,7 +5,6 @@ import sys
|
|
5
5
|
from janito.cli.cli_commands.list_providers import handle_list_providers
|
6
6
|
from janito.cli.cli_commands.list_models import handle_list_models
|
7
7
|
from janito.cli.cli_commands.list_tools import handle_list_tools
|
8
|
-
from janito.cli.cli_commands.check_tools import handle_check_tools
|
9
8
|
from janito.cli.cli_commands.show_config import handle_show_config
|
10
9
|
from janito.cli.cli_commands.list_config import handle_list_config
|
11
10
|
from janito.cli.cli_commands.list_drivers import handle_list_drivers
|
@@ -29,7 +28,6 @@ GETTER_KEYS = [
|
|
29
28
|
"list_plugins",
|
30
29
|
"list_plugins_available",
|
31
30
|
"list_resources",
|
32
|
-
"check_tools",
|
33
31
|
]
|
34
32
|
|
35
33
|
|
@@ -66,7 +64,6 @@ def handle_getter(args, config_mgr=None):
|
|
66
64
|
"list_plugins": partial(handle_list_plugins, args),
|
67
65
|
"list_plugins_available": partial(handle_list_plugins, args),
|
68
66
|
"list_resources": partial(handle_list_plugins, args),
|
69
|
-
"check_tools": partial(handle_check_tools, args),
|
70
67
|
}
|
71
68
|
for arg in GETTER_KEYS:
|
72
69
|
if getattr(args, arg, False) and arg in GETTER_DISPATCH:
|
janito/cli/core/model_guesser.py
CHANGED
@@ -21,50 +21,34 @@ def guess_provider_from_model(model_name: str) -> str:
|
|
21
21
|
model_name = model_name.lower()
|
22
22
|
|
23
23
|
# Check each provider's models
|
24
|
-
return _find_provider_for_model(model_name)
|
25
|
-
|
26
|
-
|
27
|
-
def _find_provider_for_model(model_name: str) -> str:
|
28
|
-
"""Find provider for given model name."""
|
29
24
|
for provider_name in LLMProviderRegistry.list_providers():
|
30
25
|
provider_class = LLMProviderRegistry.get(provider_name)
|
31
26
|
if not provider_class:
|
32
27
|
continue
|
33
28
|
|
34
|
-
|
35
|
-
|
29
|
+
# Get model specs for this provider
|
30
|
+
try:
|
31
|
+
if hasattr(provider_class, "MODEL_SPECS"):
|
32
|
+
model_specs = provider_class.MODEL_SPECS
|
33
|
+
for spec_model_name in model_specs.keys():
|
34
|
+
if spec_model_name.lower() == model_name:
|
35
|
+
return provider_name
|
36
|
+
|
37
|
+
# Handle special cases like moonshot
|
38
|
+
if provider_name == "moonshot":
|
39
|
+
try:
|
40
|
+
from janito.providers.moonshot.model_info import (
|
41
|
+
MOONSHOT_MODEL_SPECS,
|
42
|
+
)
|
43
|
+
|
44
|
+
for spec_model_name in MOONSHOT_MODEL_SPECS.keys():
|
45
|
+
if spec_model_name.lower() == model_name:
|
46
|
+
return "moonshot"
|
47
|
+
except ImportError:
|
48
|
+
pass
|
49
|
+
|
50
|
+
except Exception:
|
51
|
+
# Skip providers that have issues accessing model specs
|
52
|
+
continue
|
36
53
|
|
37
54
|
return None
|
38
|
-
|
39
|
-
|
40
|
-
def _check_provider_models(provider_name: str, provider_class, model_name: str) -> bool:
|
41
|
-
"""Check if provider has matching model."""
|
42
|
-
try:
|
43
|
-
if hasattr(provider_class, "MODEL_SPECS"):
|
44
|
-
model_specs = provider_class.MODEL_SPECS
|
45
|
-
for spec_model_name in model_specs.keys():
|
46
|
-
if spec_model_name.lower() == model_name:
|
47
|
-
return True
|
48
|
-
|
49
|
-
# Handle special cases like moonshot
|
50
|
-
if provider_name == "moonshot":
|
51
|
-
return _check_moonshot_models(model_name)
|
52
|
-
|
53
|
-
except Exception:
|
54
|
-
# Skip providers that have issues accessing model specs
|
55
|
-
pass
|
56
|
-
|
57
|
-
return False
|
58
|
-
|
59
|
-
|
60
|
-
def _check_moonshot_models(model_name: str) -> bool:
|
61
|
-
"""Check moonshot models specifically."""
|
62
|
-
try:
|
63
|
-
from janito.providers.moonshot.model_info import MOONSHOT_MODEL_SPECS
|
64
|
-
|
65
|
-
for spec_model_name in MOONSHOT_MODEL_SPECS.keys():
|
66
|
-
if spec_model_name.lower() == model_name:
|
67
|
-
return True
|
68
|
-
except ImportError:
|
69
|
-
pass
|
70
|
-
return False
|
janito/cli/main_cli.py
CHANGED
@@ -238,13 +238,6 @@ definition = [
|
|
238
238
|
"help": "List all resources (tools, commands, config) from loaded plugins",
|
239
239
|
},
|
240
240
|
),
|
241
|
-
(
|
242
|
-
["--check-tools"],
|
243
|
-
{
|
244
|
-
"action": "store_true",
|
245
|
-
"help": "Check all registered tools for signature validation and availability",
|
246
|
-
},
|
247
|
-
),
|
248
241
|
]
|
249
242
|
|
250
243
|
MODIFIER_KEYS = [
|
@@ -276,7 +269,18 @@ GETTER_KEYS = [
|
|
276
269
|
"region_info",
|
277
270
|
"list_providers_region",
|
278
271
|
"ping",
|
279
|
-
|
272
|
+
]
|
273
|
+
GETTER_KEYS = [
|
274
|
+
"show_config",
|
275
|
+
"list_providers",
|
276
|
+
"list_profiles",
|
277
|
+
"list_models",
|
278
|
+
"list_tools",
|
279
|
+
"list_config",
|
280
|
+
"list_drivers",
|
281
|
+
"region_info",
|
282
|
+
"list_providers_region",
|
283
|
+
"ping",
|
280
284
|
]
|
281
285
|
|
282
286
|
|
@@ -292,7 +296,7 @@ class JanitoCLI:
|
|
292
296
|
|
293
297
|
self.parser = argparse.ArgumentParser(
|
294
298
|
description="Janito CLI - A tool for running LLM-powered workflows from the command line."
|
295
|
-
"\n\nExample usage: janito -p moonshot -m kimi-
|
299
|
+
"\n\nExample usage: janito -p moonshot -m kimi-k1-8k 'Your prompt here'\n\n"
|
296
300
|
"Use -m or --model to set the model for the session.",
|
297
301
|
)
|
298
302
|
self._define_args()
|
@@ -402,7 +406,6 @@ class JanitoCLI:
|
|
402
406
|
or self.args.list_plugins_available
|
403
407
|
or self.args.list_resources
|
404
408
|
or self.args.ping
|
405
|
-
or self.args.check_tools
|
406
409
|
):
|
407
410
|
self._maybe_print_verbose_provider_model()
|
408
411
|
handle_getter(self.args)
|
janito/cli/prompt_core.py
CHANGED
@@ -207,53 +207,15 @@ class PromptHandler:
|
|
207
207
|
"""
|
208
208
|
try:
|
209
209
|
self._print_verbose_debug("Calling agent.chat()...")
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
# Timer setup with live status display
|
220
|
-
start_time = time.time()
|
221
|
-
stop_timer = Event()
|
222
|
-
|
223
|
-
# Create a status display with timer
|
224
|
-
from rich.live import Live
|
225
|
-
from rich.text import Text
|
226
|
-
|
227
|
-
def get_timer_text():
|
228
|
-
elapsed = time.time() - start_time
|
229
|
-
minutes, seconds = divmod(int(elapsed), 60)
|
230
|
-
return Text(f"⏱️ Waiting for response... {minutes:02d}:{seconds:02d}", style="cyan")
|
231
|
-
|
232
|
-
# Use Live display for updating timer
|
233
|
-
with Live(get_timer_text(), refresh_per_second=4, console=self.console) as live:
|
234
|
-
def update_timer():
|
235
|
-
while not stop_timer.wait(0.25): # Update every 250ms
|
236
|
-
live.update(get_timer_text())
|
237
|
-
|
238
|
-
timer_thread = Thread(target=update_timer, daemon=True)
|
239
|
-
timer_thread.start()
|
240
|
-
|
241
|
-
try:
|
242
|
-
final_event = self.agent.chat(prompt=user_prompt)
|
243
|
-
stop_timer.set() # Stop the timer
|
244
|
-
|
245
|
-
if hasattr(self.agent, "set_latest_event"):
|
246
|
-
self.agent.set_latest_event(final_event)
|
247
|
-
self.agent.last_event = final_event
|
248
|
-
self._print_verbose_debug(f"agent.chat() returned: {final_event}")
|
249
|
-
self._print_verbose_final_event(final_event)
|
250
|
-
if on_event and final_event is not None:
|
251
|
-
on_event(final_event)
|
252
|
-
global_event_bus.publish(final_event)
|
253
|
-
finally:
|
254
|
-
stop_timer.set() # Ensure timer stops
|
255
|
-
cancel_manager.clear_current_request()
|
256
|
-
|
210
|
+
final_event = self.agent.chat(prompt=user_prompt)
|
211
|
+
if hasattr(self.agent, "set_latest_event"):
|
212
|
+
self.agent.set_latest_event(final_event)
|
213
|
+
self.agent.last_event = final_event
|
214
|
+
self._print_verbose_debug(f"agent.chat() returned: {final_event}")
|
215
|
+
self._print_verbose_final_event(final_event)
|
216
|
+
if on_event and final_event is not None:
|
217
|
+
on_event(final_event)
|
218
|
+
global_event_bus.publish(final_event)
|
257
219
|
except KeyboardInterrupt:
|
258
220
|
# Capture user interrupt / cancellation
|
259
221
|
self.console.print("[red]Interrupted by the user.[/red]")
|
@@ -74,8 +74,8 @@ class RichTerminalReporter(EventHandlerBase):
|
|
74
74
|
"""
|
75
75
|
Clears the entire current line in the terminal and returns the cursor to column 1.
|
76
76
|
"""
|
77
|
-
|
78
|
-
|
77
|
+
sys.stdout.write("\033[2K\r")
|
78
|
+
sys.stdout.flush()
|
79
79
|
|
80
80
|
def on_RequestFinished(self, event):
|
81
81
|
self.delete_current_line()
|
@@ -161,10 +161,10 @@ class RichTerminalReporter(EventHandlerBase):
|
|
161
161
|
self.console.print(msg)
|
162
162
|
self.console.file.flush()
|
163
163
|
elif subtype == ReportSubtype.STDOUT:
|
164
|
-
self.console.print(msg
|
164
|
+
self.console.print(msg)
|
165
165
|
self.console.file.flush()
|
166
166
|
elif subtype == ReportSubtype.STDERR:
|
167
|
-
self.console.print(msg, style=
|
167
|
+
self.console.print(Text(msg, style="on red"))
|
168
168
|
self.console.file.flush()
|
169
169
|
else:
|
170
170
|
self.console.print(msg)
|