janito 3.3.0__py3-none-any.whl → 3.4.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/cli/cli_commands/list_plugins.py +48 -52
- janito/cli/core/getters.py +0 -3
- janito/cli/main_cli.py +12 -9
- janito/drivers/openai/driver.py +0 -1
- janito/drivers/zai/driver.py +0 -1
- janito/hello.txt +0 -0
- janito/llm/auth_utils.py +5 -14
- janito/plugins/__init__.py +7 -18
- janito/{plugins_backup_20250825_070018 → plugins}/auto_loader_fixed.py +11 -12
- janito/plugins/base.py +152 -57
- janito/plugins/builtin.py +1 -15
- janito/{plugins_backup_20250825_070018 → plugins}/core_adapter.py +9 -11
- janito/plugins/core_loader.py +34 -58
- janito/{plugin_system_backup_20250825_070018/core_loader.py → plugins/core_loader_fixed.py} +26 -45
- janito/plugins/discovery.py +3 -3
- janito/tools/__init__.py +7 -31
- janito/tools/adapters/__init__.py +1 -6
- janito/tools/adapters/local/__init__.py +70 -7
- janito/{plugins_backup_20250825_070018/tools → tools/adapters/local}/ask_user.py +3 -3
- janito/{plugins_backup_20250825_070018/tools → tools/adapters/local}/create_file.py +4 -4
- janito/{plugins/core/filemanager/tools → tools/adapters/local}/delete_text_in_file.py +0 -1
- janito/{plugins_backup_20250825_070018/tools → tools/adapters/local}/fetch_url.py +3 -3
- janito/{plugins_backup_20250825_070018/tools → tools/adapters/local}/replace_text_in_file.py +4 -4
- janito/{plugins_backup_20250825_070018/tools → tools/adapters/local}/show_image.py +6 -15
- janito/{plugins/core/imagedisplay/tools → tools/adapters/local}/show_image_grid.py +5 -13
- janito/tools/base.py +1 -31
- janito/tools/function_adapter.py +16 -127
- janito/tools/tool_base.py +114 -142
- janito/tools/tools_schema.py +6 -12
- {janito-3.3.0.dist-info → janito-3.4.0.dist-info}/METADATA +2 -1
- janito-3.4.0.dist-info/RECORD +264 -0
- janito/cli/cli_commands/check_tools.py +0 -212
- janito/plugin_system_backup_20250825_070018/__init__.py +0 -10
- janito/plugin_system_backup_20250825_070018/base.py +0 -155
- janito/plugin_system_backup_20250825_070018/core_loader_fixed.py +0 -149
- janito/plugins/__main__.py +0 -85
- 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 -111
- janito/plugins/core/filemanager/tools/create_directory.py +0 -97
- janito/plugins/core/filemanager/tools/create_file.py +0 -111
- janito/plugins/core/filemanager/tools/replace_text_in_file.py +0 -270
- 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/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/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 -33
- janito/plugins/web/webtools/tools/fetch_url.py +0 -458
- janito/plugins_backup_20250825_070018/__init__.py +0 -36
- janito/plugins_backup_20250825_070018/builtin.py +0 -102
- janito/plugins_backup_20250825_070018/config.py +0 -84
- janito/plugins_backup_20250825_070018/core/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/core/codeanalyzer/__init__.py +0 -43
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/__init__.py +0 -1
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/core.py +0 -122
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/java_outline.py +0 -47
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/markdown_outline.py +0 -14
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/python_outline.py +0 -303
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/get_file_outline/search_outline.py +0 -36
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/__init__.py +0 -1
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/core.py +0 -205
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/match_lines.py +0 -67
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/pattern_utils.py +0 -73
- janito/plugins_backup_20250825_070018/core/codeanalyzer/tools/search_text/traverse_directory.py +0 -145
- janito/plugins_backup_20250825_070018/core/filemanager/__init__.py +0 -124
- janito/plugins_backup_20250825_070018/core/filemanager/tools/create_file.py +0 -87
- janito/plugins_backup_20250825_070018/core/filemanager/tools/delete_text_in_file.py +0 -135
- janito/plugins_backup_20250825_070018/core/filemanager/tools/find_files.py +0 -143
- janito/plugins_backup_20250825_070018/core/filemanager/tools/move_file.py +0 -131
- janito/plugins_backup_20250825_070018/core/filemanager/tools/read_files.py +0 -58
- janito/plugins_backup_20250825_070018/core/filemanager/tools/remove_directory.py +0 -55
- janito/plugins_backup_20250825_070018/core/filemanager/tools/remove_file.py +0 -58
- janito/plugins_backup_20250825_070018/core/filemanager/tools/replace_text_in_file.py +0 -270
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/__init__.py +0 -1
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/core.py +0 -114
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/css_validator.py +0 -35
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/html_validator.py +0 -100
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/jinja2_validator.py +0 -50
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/js_validator.py +0 -27
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/json_validator.py +0 -6
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/markdown_validator.py +0 -109
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/ps1_validator.py +0 -32
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/python_validator.py +0 -5
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/xml_validator.py +0 -11
- janito/plugins_backup_20250825_070018/core/filemanager/tools/validate_file_syntax/yaml_validator.py +0 -6
- janito/plugins_backup_20250825_070018/core/filemanager/tools/view_file.py +0 -172
- janito/plugins_backup_20250825_070018/core/imagedisplay/__init__.py +0 -14
- janito/plugins_backup_20250825_070018/core/imagedisplay/plugin.py +0 -51
- janito/plugins_backup_20250825_070018/core/imagedisplay/tools/__init__.py +0 -1
- janito/plugins_backup_20250825_070018/core/imagedisplay/tools/show_image.py +0 -83
- janito/plugins_backup_20250825_070018/core/imagedisplay/tools/show_image_grid.py +0 -84
- janito/plugins_backup_20250825_070018/core/system/__init__.py +0 -23
- janito/plugins_backup_20250825_070018/core/system/tools/run_bash_command.py +0 -183
- janito/plugins_backup_20250825_070018/core/system/tools/run_powershell_command.py +0 -218
- janito/plugins_backup_20250825_070018/dev/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/dev/pythondev/__init__.py +0 -37
- janito/plugins_backup_20250825_070018/dev/pythondev/tools/python_code_run.py +0 -172
- janito/plugins_backup_20250825_070018/dev/pythondev/tools/python_command_run.py +0 -171
- janito/plugins_backup_20250825_070018/dev/pythondev/tools/python_file_run.py +0 -172
- janito/plugins_backup_20250825_070018/dev/visualization/__init__.py +0 -23
- janito/plugins_backup_20250825_070018/dev/visualization/tools/read_chart.py +0 -259
- janito/plugins_backup_20250825_070018/discovery.py +0 -289
- janito/plugins_backup_20250825_070018/example_plugin.py +0 -108
- janito/plugins_backup_20250825_070018/manager.py +0 -243
- janito/plugins_backup_20250825_070018/tools/__init__.py +0 -10
- janito/plugins_backup_20250825_070018/tools/copy_file.py +0 -87
- janito/plugins_backup_20250825_070018/tools/core_tools_plugin.py +0 -88
- janito/plugins_backup_20250825_070018/tools/create_directory.py +0 -70
- janito/plugins_backup_20250825_070018/tools/decorators.py +0 -19
- janito/plugins_backup_20250825_070018/tools/delete_text_in_file.py +0 -135
- janito/plugins_backup_20250825_070018/tools/find_files.py +0 -143
- janito/plugins_backup_20250825_070018/tools/get_file_outline/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/tools/get_file_outline/core.py +0 -122
- janito/plugins_backup_20250825_070018/tools/get_file_outline/java_outline.py +0 -47
- janito/plugins_backup_20250825_070018/tools/get_file_outline/markdown_outline.py +0 -14
- janito/plugins_backup_20250825_070018/tools/get_file_outline/python_outline.py +0 -303
- janito/plugins_backup_20250825_070018/tools/get_file_outline/search_outline.py +0 -36
- janito/plugins_backup_20250825_070018/tools/move_file.py +0 -131
- janito/plugins_backup_20250825_070018/tools/open_html_in_browser.py +0 -51
- janito/plugins_backup_20250825_070018/tools/open_url.py +0 -37
- janito/plugins_backup_20250825_070018/tools/python_code_run.py +0 -172
- janito/plugins_backup_20250825_070018/tools/python_command_run.py +0 -171
- janito/plugins_backup_20250825_070018/tools/python_file_run.py +0 -172
- janito/plugins_backup_20250825_070018/tools/read_chart.py +0 -259
- janito/plugins_backup_20250825_070018/tools/read_files.py +0 -58
- janito/plugins_backup_20250825_070018/tools/remove_directory.py +0 -55
- janito/plugins_backup_20250825_070018/tools/remove_file.py +0 -58
- janito/plugins_backup_20250825_070018/tools/run_bash_command.py +0 -183
- janito/plugins_backup_20250825_070018/tools/run_powershell_command.py +0 -218
- janito/plugins_backup_20250825_070018/tools/search_text/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/tools/search_text/core.py +0 -205
- janito/plugins_backup_20250825_070018/tools/search_text/match_lines.py +0 -67
- janito/plugins_backup_20250825_070018/tools/search_text/pattern_utils.py +0 -73
- janito/plugins_backup_20250825_070018/tools/search_text/traverse_directory.py +0 -145
- janito/plugins_backup_20250825_070018/tools/show_image_grid.py +0 -85
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/core.py +0 -114
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/css_validator.py +0 -35
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/html_validator.py +0 -100
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/jinja2_validator.py +0 -50
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/js_validator.py +0 -27
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/json_validator.py +0 -6
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/markdown_validator.py +0 -109
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/ps1_validator.py +0 -32
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/python_validator.py +0 -5
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/xml_validator.py +0 -11
- janito/plugins_backup_20250825_070018/tools/validate_file_syntax/yaml_validator.py +0 -6
- janito/plugins_backup_20250825_070018/tools/view_file.py +0 -172
- janito/plugins_backup_20250825_070018/ui/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/ui/userinterface/__init__.py +0 -16
- janito/plugins_backup_20250825_070018/ui/userinterface/tools/ask_user.py +0 -110
- janito/plugins_backup_20250825_070018/web/__init__.py +0 -7
- janito/plugins_backup_20250825_070018/web/webtools/__init__.py +0 -33
- janito/plugins_backup_20250825_070018/web/webtools/tools/fetch_url.py +0 -458
- janito/plugins_backup_20250825_070018/web/webtools/tools/open_html_in_browser.py +0 -51
- janito/plugins_backup_20250825_070018/web/webtools/tools/open_url.py +0 -37
- janito/tools/cli_initializer.py +0 -88
- janito/tools/initialize.py +0 -70
- janito-3.3.0.dist-info/RECORD +0 -400
- /janito/{plugins_backup_20250825_070018 → plugins}/auto_loader.py +0 -0
- /janito/{plugins_backup_20250825_070018 → plugins}/discovery_core.py +0 -0
- /janito/{plugins_backup_20250825_070018/core/filemanager/tools → tools/adapters/local}/copy_file.py +0 -0
- /janito/{plugins_backup_20250825_070018/core/filemanager/tools → tools/adapters/local}/create_directory.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/core/filemanager/tools → tools/adapters/local}/move_file.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/pythondev/tools → tools/adapters/local}/python_code_run.py +0 -0
- /janito/{plugins/dev/pythondev/tools → tools/adapters/local}/python_command_run.py +0 -0
- /janito/{plugins/dev/pythondev/tools → tools/adapters/local}/python_file_run.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/filemanager/tools → tools/adapters/local}/remove_file.py +0 -0
- /janito/{plugins/core/system/tools → tools/adapters/local}/run_bash_command.py +0 -0
- /janito/{plugins/core/system/tools → tools/adapters/local}/run_powershell_command.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/{plugins/core/filemanager/tools → tools/adapters/local}/view_file.py +0 -0
- {janito-3.3.0.dist-info → janito-3.4.0.dist-info}/WHEEL +0 -0
- {janito-3.3.0.dist-info → janito-3.4.0.dist-info}/entry_points.txt +0 -0
- {janito-3.3.0.dist-info → janito-3.4.0.dist-info}/licenses/LICENSE +0 -0
- {janito-3.3.0.dist-info → janito-3.4.0.dist-info}/top_level.txt +0 -0
@@ -8,8 +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.
|
12
|
-
from janito.plugins.core_loader import get_core_plugins
|
11
|
+
from janito.plugins.auto_loader_fixed import load_core_plugins, get_loaded_core_plugins, is_core_plugin
|
13
12
|
from rich.console import Console
|
14
13
|
from rich.table import Table
|
15
14
|
from rich.panel import Panel
|
@@ -52,8 +51,7 @@ def _list_available_plugins():
|
|
52
51
|
console.print(table)
|
53
52
|
|
54
53
|
# Show core plugins
|
55
|
-
from janito.plugins.
|
56
|
-
|
54
|
+
from janito.plugins.core_loader_fixed import get_core_plugins
|
57
55
|
core_plugins = get_core_plugins()
|
58
56
|
core_table = Table(title="Core Plugins (Enabled by Default)")
|
59
57
|
core_table.add_column("Plugin Name", style="cyan", no_wrap=True)
|
@@ -64,16 +62,14 @@ def _list_available_plugins():
|
|
64
62
|
|
65
63
|
console.print(core_table)
|
66
64
|
else:
|
67
|
-
console.print(
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
)
|
76
|
-
)
|
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
|
+
))
|
77
73
|
|
78
74
|
|
79
75
|
def _print_builtin_plugins(builtin_plugins):
|
@@ -95,18 +91,20 @@ def _print_external_plugins(available, builtin_plugins):
|
|
95
91
|
|
96
92
|
def _list_plugin_resources():
|
97
93
|
"""List all resources from loaded plugins using rich formatting."""
|
94
|
+
from janito.plugins.auto_loader_fixed import get_plugin_manager
|
95
|
+
|
98
96
|
console = Console()
|
99
|
-
manager =
|
97
|
+
manager = get_plugin_manager()
|
100
98
|
all_resources = manager.list_all_resources()
|
101
99
|
|
102
100
|
if all_resources:
|
103
101
|
for plugin_name, resources in all_resources.items():
|
104
102
|
metadata = manager.get_plugin_metadata(plugin_name)
|
105
|
-
version = metadata.version if metadata else
|
106
|
-
|
103
|
+
version = metadata.version if metadata else 'unknown'
|
104
|
+
|
107
105
|
# Create panel for each plugin
|
108
106
|
panel_content = []
|
109
|
-
|
107
|
+
|
110
108
|
tools = [r for r in resources if r["type"] == "tool"]
|
111
109
|
commands = [r for r in resources if r["type"] == "command"]
|
112
110
|
configs = [r for r in resources if r["type"] == "config"]
|
@@ -124,25 +122,19 @@ def _list_plugin_resources():
|
|
124
122
|
if configs:
|
125
123
|
panel_content.append("[bold yellow]Configuration:[/bold yellow]")
|
126
124
|
for config in configs:
|
127
|
-
panel_content.append(
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
title=f"{plugin_name} v{version}",
|
135
|
-
style="cyan",
|
136
|
-
)
|
137
|
-
)
|
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
|
+
))
|
138
132
|
else:
|
139
|
-
console.print(
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
)
|
145
|
-
)
|
133
|
+
console.print(Panel(
|
134
|
+
"No plugins are currently loaded.",
|
135
|
+
title="No Plugin Resources",
|
136
|
+
style="yellow"
|
137
|
+
))
|
146
138
|
|
147
139
|
|
148
140
|
def _print_resources_by_type(resources):
|
@@ -169,8 +161,10 @@ def _print_resources_by_type(resources):
|
|
169
161
|
|
170
162
|
def _list_loaded_plugins():
|
171
163
|
"""List loaded plugins using rich formatting."""
|
164
|
+
from janito.plugins.auto_loader_fixed import get_plugin_manager
|
165
|
+
|
172
166
|
console = Console()
|
173
|
-
manager =
|
167
|
+
manager = get_plugin_manager()
|
174
168
|
loaded = manager.list_plugins()
|
175
169
|
|
176
170
|
if loaded:
|
@@ -183,40 +177,42 @@ def _list_loaded_plugins():
|
|
183
177
|
|
184
178
|
core_plugins = []
|
185
179
|
other_plugins = []
|
186
|
-
|
180
|
+
|
187
181
|
for plugin_name in loaded:
|
188
|
-
|
189
|
-
core_plugin_list = get_core_plugins()
|
190
|
-
if plugin_name in core_plugin_list:
|
182
|
+
if is_core_plugin(plugin_name):
|
191
183
|
core_plugins.append(plugin_name)
|
192
184
|
else:
|
193
185
|
other_plugins.append(plugin_name)
|
194
|
-
|
186
|
+
|
195
187
|
# Add core plugins
|
196
188
|
for plugin_name in core_plugins:
|
197
189
|
metadata = manager.get_plugin_metadata(plugin_name)
|
198
190
|
if metadata:
|
199
191
|
table.add_row(
|
200
|
-
metadata.name,
|
192
|
+
metadata.name,
|
193
|
+
metadata.version,
|
194
|
+
metadata.description,
|
195
|
+
"🔵 Core"
|
201
196
|
)
|
202
|
-
|
197
|
+
|
203
198
|
# Add other plugins
|
204
199
|
for plugin_name in other_plugins:
|
205
200
|
metadata = manager.get_plugin_metadata(plugin_name)
|
206
201
|
if metadata:
|
207
202
|
table.add_row(
|
208
|
-
metadata.name,
|
203
|
+
metadata.name,
|
204
|
+
metadata.version,
|
205
|
+
metadata.description,
|
206
|
+
"🔶 External"
|
209
207
|
)
|
210
208
|
|
211
209
|
console.print(table)
|
212
210
|
else:
|
213
|
-
console.print(
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
)
|
219
|
-
)
|
211
|
+
console.print(Panel(
|
212
|
+
"No plugins are currently loaded.",
|
213
|
+
title="No Plugins Loaded",
|
214
|
+
style="yellow"
|
215
|
+
))
|
220
216
|
|
221
217
|
|
222
218
|
def _print_plugin_details(manager, plugin_name):
|
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/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
|
|
@@ -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/drivers/openai/driver.py
CHANGED
@@ -181,7 +181,6 @@ class OpenAIModelDriver(LLMDriver):
|
|
181
181
|
is_insufficient_quota = (
|
182
182
|
"insufficient_quota" in lower_err
|
183
183
|
or "exceeded your current quota" in lower_err
|
184
|
-
or "exceeded_current_quota_error" in lower_err
|
185
184
|
)
|
186
185
|
is_rate_limit = (
|
187
186
|
status_code == 429
|
janito/drivers/zai/driver.py
CHANGED
janito/hello.txt
ADDED
File without changes
|
janito/llm/auth_utils.py
CHANGED
@@ -13,18 +13,9 @@ def handle_missing_api_key(provider_name: str, env_var_name: str) -> None:
|
|
13
13
|
provider_name: Name of the provider (e.g., 'alibaba', 'openai')
|
14
14
|
env_var_name: Environment variable name (e.g., 'ALIBABA_API_KEY')
|
15
15
|
"""
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
print()
|
22
|
-
print(f"To set a new API key, use:")
|
23
|
-
print(f" janito --set-api-key YOUR_NEW_API_KEY -p moonshot")
|
24
|
-
else:
|
25
|
-
print(
|
26
|
-
f"[ERROR] No API key found for provider '{provider_name}'. Please set the API key using:"
|
27
|
-
)
|
28
|
-
print(f" janito --set-api-key YOUR_API_KEY -p {provider_name}")
|
29
|
-
print(f"Or set the {env_var_name} environment variable.")
|
16
|
+
print(
|
17
|
+
f"[ERROR] No API key found for provider '{provider_name}'. Please set the API key using:"
|
18
|
+
)
|
19
|
+
print(f" janito --set-api-key YOUR_API_KEY -p {provider_name}")
|
20
|
+
print(f"Or set the {env_var_name} environment variable.")
|
30
21
|
sys.exit(1)
|
janito/plugins/__init__.py
CHANGED
@@ -1,28 +1,17 @@
|
|
1
1
|
"""
|
2
|
-
|
2
|
+
Plugin system for janito.
|
3
3
|
|
4
|
-
This package provides a
|
4
|
+
This package provides a flexible plugin system that allows extending
|
5
|
+
janito's functionality with custom tools, commands, and features.
|
5
6
|
"""
|
6
7
|
|
7
|
-
__version__ = "1.0.0"
|
8
|
-
__author__ = "Development Assistant"
|
9
|
-
|
10
|
-
# Import core components
|
11
|
-
from .base import Plugin, PluginMetadata, PluginResource
|
12
8
|
from .manager import PluginManager
|
13
|
-
from .
|
14
|
-
from .
|
15
|
-
from .builtin import BuiltinPluginRegistry, load_builtin_plugin
|
9
|
+
from .base import Plugin, PluginMetadata
|
10
|
+
from .discovery import discover_plugins
|
16
11
|
|
17
12
|
__all__ = [
|
18
|
-
"Plugin",
|
19
|
-
"PluginMetadata",
|
20
|
-
"PluginResource",
|
21
13
|
"PluginManager",
|
14
|
+
"Plugin",
|
15
|
+
"PluginMetadata",
|
22
16
|
"discover_plugins",
|
23
|
-
"list_available_plugins",
|
24
|
-
"load_plugins_config",
|
25
|
-
"save_plugins_config",
|
26
|
-
"BuiltinPluginRegistry",
|
27
|
-
"load_builtin_plugin",
|
28
17
|
]
|
@@ -9,12 +9,12 @@ import os
|
|
9
9
|
from pathlib import Path
|
10
10
|
from typing import List
|
11
11
|
from janito.plugins.manager import PluginManager
|
12
|
-
from janito.
|
12
|
+
from janito.plugins.core_loader_fixed import load_core_plugin, get_core_plugins
|
13
13
|
|
14
14
|
# List of core plugins that should be enabled by default
|
15
15
|
CORE_PLUGINS = [
|
16
16
|
"core.filemanager",
|
17
|
-
"core.codeanalyzer",
|
17
|
+
"core.codeanalyzer",
|
18
18
|
"core.system",
|
19
19
|
"core.imagedisplay",
|
20
20
|
"dev.pythondev",
|
@@ -27,18 +27,18 @@ CORE_PLUGINS = [
|
|
27
27
|
def load_core_plugins(pm: PluginManager = None) -> List[str]:
|
28
28
|
"""
|
29
29
|
Load all core plugins.
|
30
|
-
|
30
|
+
|
31
31
|
Args:
|
32
32
|
pm: PluginManager instance. If None, creates a new one.
|
33
|
-
|
33
|
+
|
34
34
|
Returns:
|
35
35
|
List of successfully loaded plugin names
|
36
36
|
"""
|
37
37
|
if pm is None:
|
38
38
|
pm = PluginManager()
|
39
|
-
|
39
|
+
|
40
40
|
loaded = []
|
41
|
-
|
41
|
+
|
42
42
|
# Load core plugins
|
43
43
|
for plugin_name in CORE_PLUGINS:
|
44
44
|
try:
|
@@ -49,14 +49,14 @@ def load_core_plugins(pm: PluginManager = None) -> List[str]:
|
|
49
49
|
loaded.append(plugin_name)
|
50
50
|
except Exception as e:
|
51
51
|
print(f"Warning: Failed to load core plugin {plugin_name}: {e}")
|
52
|
-
|
52
|
+
|
53
53
|
return loaded
|
54
54
|
|
55
55
|
|
56
56
|
def get_loaded_core_plugins() -> List[str]:
|
57
57
|
"""
|
58
58
|
Get list of currently loaded core plugins.
|
59
|
-
|
59
|
+
|
60
60
|
Returns:
|
61
61
|
List of loaded core plugin names
|
62
62
|
"""
|
@@ -68,10 +68,10 @@ def get_loaded_core_plugins() -> List[str]:
|
|
68
68
|
def is_core_plugin(plugin_name: str) -> bool:
|
69
69
|
"""
|
70
70
|
Check if a plugin is a core plugin.
|
71
|
-
|
71
|
+
|
72
72
|
Args:
|
73
73
|
plugin_name: Name of the plugin to check
|
74
|
-
|
74
|
+
|
75
75
|
Returns:
|
76
76
|
True if it's a core plugin
|
77
77
|
"""
|
@@ -81,11 +81,10 @@ def is_core_plugin(plugin_name: str) -> bool:
|
|
81
81
|
# Auto-load core plugins when module is imported
|
82
82
|
_plugin_manager = None
|
83
83
|
|
84
|
-
|
85
84
|
def get_plugin_manager() -> PluginManager:
|
86
85
|
"""Get the global plugin manager with core plugins loaded."""
|
87
86
|
global _plugin_manager
|
88
87
|
if _plugin_manager is None:
|
89
88
|
_plugin_manager = PluginManager()
|
90
89
|
load_core_plugins(_plugin_manager)
|
91
|
-
return _plugin_manager
|
90
|
+
return _plugin_manager
|
janito/plugins/base.py
CHANGED
@@ -1,57 +1,152 @@
|
|
1
|
-
"""
|
2
|
-
Base classes for janito plugins.
|
3
|
-
"""
|
4
|
-
|
5
|
-
from abc import ABC, abstractmethod
|
6
|
-
from dataclasses import dataclass
|
7
|
-
from typing import Dict, Any, List, Optional, Type
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
def
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
1
|
+
"""
|
2
|
+
Base classes for janito plugins.
|
3
|
+
"""
|
4
|
+
|
5
|
+
from abc import ABC, abstractmethod
|
6
|
+
from dataclasses import dataclass
|
7
|
+
from typing import Dict, Any, List, Optional, Type, Union
|
8
|
+
from janito.tools.tool_base import ToolBase
|
9
|
+
|
10
|
+
|
11
|
+
@dataclass
|
12
|
+
class PluginMetadata:
|
13
|
+
"""Metadata describing a plugin."""
|
14
|
+
|
15
|
+
name: str
|
16
|
+
version: str
|
17
|
+
description: str
|
18
|
+
author: str
|
19
|
+
license: str = "MIT"
|
20
|
+
homepage: Optional[str] = None
|
21
|
+
dependencies: List[str] = None
|
22
|
+
|
23
|
+
def __post_init__(self):
|
24
|
+
if self.dependencies is None:
|
25
|
+
self.dependencies = []
|
26
|
+
|
27
|
+
|
28
|
+
@dataclass
|
29
|
+
class PluginResource:
|
30
|
+
"""Represents a resource provided by a plugin."""
|
31
|
+
|
32
|
+
name: str
|
33
|
+
type: str # "tool", "command", "config"
|
34
|
+
description: str
|
35
|
+
schema: Optional[Dict[str, Any]] = None
|
36
|
+
|
37
|
+
|
38
|
+
class Plugin(ABC):
|
39
|
+
"""
|
40
|
+
Base class for all janito plugins.
|
41
|
+
|
42
|
+
Plugins can provide tools, commands, or other functionality.
|
43
|
+
"""
|
44
|
+
|
45
|
+
def __init__(self):
|
46
|
+
self.metadata: PluginMetadata = self.get_metadata()
|
47
|
+
|
48
|
+
@abstractmethod
|
49
|
+
def get_metadata(self) -> PluginMetadata:
|
50
|
+
"""Return metadata describing this plugin."""
|
51
|
+
pass
|
52
|
+
|
53
|
+
def get_tools(self) -> List[Type[ToolBase]]:
|
54
|
+
"""
|
55
|
+
Return a list of tool classes provided by this plugin.
|
56
|
+
|
57
|
+
Returns:
|
58
|
+
List of ToolBase subclasses that should be registered
|
59
|
+
"""
|
60
|
+
return []
|
61
|
+
|
62
|
+
def get_commands(self) -> Dict[str, Any]:
|
63
|
+
"""
|
64
|
+
Return a dictionary of CLI commands provided by this plugin.
|
65
|
+
|
66
|
+
Returns:
|
67
|
+
Dict mapping command names to command handlers
|
68
|
+
"""
|
69
|
+
return {}
|
70
|
+
|
71
|
+
def initialize(self) -> None:
|
72
|
+
"""
|
73
|
+
Called when the plugin is loaded.
|
74
|
+
Override to perform any initialization needed.
|
75
|
+
"""
|
76
|
+
pass
|
77
|
+
|
78
|
+
def cleanup(self) -> None:
|
79
|
+
"""
|
80
|
+
Called when the plugin is unloaded.
|
81
|
+
Override to perform any cleanup needed.
|
82
|
+
"""
|
83
|
+
pass
|
84
|
+
|
85
|
+
def get_config_schema(self) -> Dict[str, Any]:
|
86
|
+
"""
|
87
|
+
Return JSON schema for plugin configuration.
|
88
|
+
|
89
|
+
Returns:
|
90
|
+
JSON schema dict describing configuration options
|
91
|
+
"""
|
92
|
+
return {}
|
93
|
+
|
94
|
+
def validate_config(self, config: Dict[str, Any]) -> bool:
|
95
|
+
"""
|
96
|
+
Validate plugin configuration.
|
97
|
+
|
98
|
+
Args:
|
99
|
+
config: Configuration dict to validate
|
100
|
+
|
101
|
+
Returns:
|
102
|
+
True if configuration is valid
|
103
|
+
"""
|
104
|
+
return True
|
105
|
+
|
106
|
+
def get_resources(self) -> List[PluginResource]:
|
107
|
+
"""
|
108
|
+
Return a list of resources provided by this plugin.
|
109
|
+
|
110
|
+
Returns:
|
111
|
+
List of PluginResource objects describing the resources
|
112
|
+
"""
|
113
|
+
resources = []
|
114
|
+
|
115
|
+
# Add tools as resources
|
116
|
+
for tool_class in self.get_tools():
|
117
|
+
tool_instance = tool_class()
|
118
|
+
tool_name = getattr(tool_instance, "tool_name", tool_class.__name__)
|
119
|
+
tool_desc = getattr(tool_class, "__doc__", f"Tool: {tool_name}")
|
120
|
+
resources.append(
|
121
|
+
PluginResource(
|
122
|
+
name=tool_name,
|
123
|
+
type="tool",
|
124
|
+
description=tool_desc or f"Tool provided by {self.metadata.name}",
|
125
|
+
)
|
126
|
+
)
|
127
|
+
|
128
|
+
# Add commands as resources
|
129
|
+
commands = self.get_commands()
|
130
|
+
for cmd_name, cmd_handler in commands.items():
|
131
|
+
cmd_desc = getattr(cmd_handler, "__doc__", f"Command: {cmd_name}")
|
132
|
+
resources.append(
|
133
|
+
PluginResource(
|
134
|
+
name=cmd_name,
|
135
|
+
type="command",
|
136
|
+
description=cmd_desc or f"Command provided by {self.metadata.name}",
|
137
|
+
)
|
138
|
+
)
|
139
|
+
|
140
|
+
# Add config schema as resource
|
141
|
+
config_schema = self.get_config_schema()
|
142
|
+
if config_schema:
|
143
|
+
resources.append(
|
144
|
+
PluginResource(
|
145
|
+
name=f"{self.metadata.name}_config",
|
146
|
+
type="config",
|
147
|
+
description=f"Configuration schema for {self.metadata.name} plugin",
|
148
|
+
schema=config_schema,
|
149
|
+
)
|
150
|
+
)
|
151
|
+
|
152
|
+
return resources
|
janito/plugins/builtin.py
CHANGED
@@ -7,7 +7,7 @@ with janito and available by default without requiring external installation.
|
|
7
7
|
|
8
8
|
import importlib
|
9
9
|
from typing import Dict, List, Optional, Type
|
10
|
-
from .base import Plugin
|
10
|
+
from janito.plugins.base import Plugin
|
11
11
|
|
12
12
|
|
13
13
|
class BuiltinPluginRegistry:
|
@@ -83,20 +83,6 @@ try:
|
|
83
83
|
"documentation_generator", DocumentationGeneratorPlugin
|
84
84
|
)
|
85
85
|
|
86
|
-
# Register core tools plugin
|
87
|
-
from janito.plugins.tools import CoreToolsPlugin
|
88
|
-
|
89
|
-
BuiltinPluginRegistry.register("core_tools", CoreToolsPlugin)
|
90
|
-
|
91
86
|
except ImportError:
|
92
87
|
# janito-coder not available, skip registration
|
93
88
|
pass
|
94
|
-
|
95
|
-
# Register core tools plugin (always available)
|
96
|
-
try:
|
97
|
-
from janito.plugins.tools import CoreToolsPlugin
|
98
|
-
|
99
|
-
BuiltinPluginRegistry.register("core_tools", CoreToolsPlugin)
|
100
|
-
except ImportError:
|
101
|
-
# Should not happen, but handle gracefully
|
102
|
-
pass
|