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/docs/GETTING_STARTED.md
CHANGED
@@ -14,7 +14,7 @@ pip install janito
|
|
14
14
|
Janito supports multiple AI providers. Choose one to get started:
|
15
15
|
|
16
16
|
**Moonshot (Recommended for Chinese users)**
|
17
|
-
1. Go to [Moonshot AI Platform](https://platform.moonshot.
|
17
|
+
1. Go to [Moonshot AI Platform](https://platform.moonshot.cn/)
|
18
18
|
2. Sign up for an account
|
19
19
|
3. Navigate to API Keys section
|
20
20
|
4. Create a new API key
|
@@ -67,7 +67,7 @@ janito "Hello, can you introduce yourself?"
|
|
67
67
|
janito "Create a Python script to calculate fibonacci numbers"
|
68
68
|
|
69
69
|
# With specific model
|
70
|
-
janito -m kimi-
|
70
|
+
janito -m kimi-k1-8k "Explain machine learning in simple terms"
|
71
71
|
|
72
72
|
# Interactive chat mode
|
73
73
|
janito --chat
|
@@ -88,7 +88,7 @@ janito -W ./my_project "Create a REST API with FastAPI"
|
|
88
88
|
```bash
|
89
89
|
# Make your chosen provider the permanent default
|
90
90
|
janito --set provider=moonshot # or openai, ibm, etc.
|
91
|
-
janito --set model=kimi-
|
91
|
+
janito --set model=kimi-k1-8k # or gpt-5, ibm/granite-3-8b-instruct, etc.
|
92
92
|
```
|
93
93
|
|
94
94
|
### Environment Variables
|
@@ -98,7 +98,7 @@ You can also use environment variables:
|
|
98
98
|
```bash
|
99
99
|
export MOONSHOT_API_KEY=your_key_here
|
100
100
|
export JANITO_PROVIDER=moonshot
|
101
|
-
export JANITO_MODEL=kimi-
|
101
|
+
export JANITO_MODEL=kimi-k1-8k
|
102
102
|
```
|
103
103
|
|
104
104
|
**OpenAI:**
|
@@ -120,10 +120,11 @@ export JANITO_MODEL=ibm/granite-3-3-8b-instruct
|
|
120
120
|
## Available Models by Provider
|
121
121
|
|
122
122
|
### Moonshot Models
|
123
|
-
|
124
|
-
- **kimi-
|
125
|
-
- **kimi-
|
126
|
-
- **kimi-k2-
|
123
|
+
- **kimi-k1-8k**: Fast responses, good for general tasks
|
124
|
+
- **kimi-k1-32k**: Better for longer contexts
|
125
|
+
- **kimi-k1-128k**: Best for very long documents
|
126
|
+
- **kimi-k2-turbo-preview**: Latest model with enhanced capabilities
|
127
|
+
- **kimi-k2-0905-preview**: Newest model with 256K context window for handling very large documents and complex tasks
|
127
128
|
|
128
129
|
### OpenAI Models
|
129
130
|
- **gpt-5**: Latest GPT model with advanced capabilities
|
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/i18n/it.py
CHANGED
@@ -1,46 +1,46 @@
|
|
1
|
-
# pragma: allowlist secret
|
2
|
-
translations = {
|
3
|
-
"36107ed78ab25f6fb12ad8ce13018cd1ce6735d1": "Avvio del server web...",
|
4
|
-
"70a0d194687568a47aa617fd85036ace1e69a982": "Vuoi davvero uscire? (s/n): ",
|
5
|
-
"5c9ebcbbd7632ecb328bd52958b17158afaa32c6": "F12 = Azione Rapida (segue l'azione raccomandata)",
|
6
|
-
"fe21121e2934234b68d19b2757532117d440c1e3": "Chiave API non trovata. Si prega di configurare 'api_key' nel file di configurazione.",
|
7
|
-
"c9e3759b1756eba35b381ce2b72cd659e132b01f": "Ciao, {name}!",
|
8
|
-
"ca1fee2f55baabdc2e4b0e9529c89ee024e62079": "Nessun prompt fornito nei messaggi",
|
9
|
-
"f7449d23d0c500ae2a0b31e04f92b47a4d8ae845": "max_tokens deve essere un intero, ricevuto: {resolved_max_tokens!r}",
|
10
|
-
"70a9ed8edb6da12e208431a31aa16ba54419b26f": "Risposta non valida/malformed da OpenAI (tentativo {attempt}/{max_retries}). Riprovo tra {wait_time} secondi...",
|
11
|
-
"a873085e3b06184fb5d27e842f97b06b6190976d": "Numero massimo di tentativi per risposta non valida raggiunto. Generazione errore.",
|
12
|
-
"66a34568bbe846bb1bde3619eb4d6dfa10211104": "L'API non supporta l'uso degli strumenti.",
|
13
|
-
"09b81476b75586da4116b83f8be70d77b174cec3": "
|
14
|
-
"5717a35dd2a1533fb7e15edc8c9329cb69f3410b": "Errore server API OpenAI (tentativo {attempt}/{max_retries}): {e}. Riprovo tra {wait_time} secondi...",
|
15
|
-
"02e760ba15ed863176c1290ac8a9b923963103cd": "Errore client API OpenAI {status_code}: {e}. Nessun nuovo tentativo.",
|
16
|
-
"2e52b0bbc8f16226b70e3e20f95c9245d2bcdb47": "Errore API OpenAI (tentativo {attempt}/{max_retries}): {e}. Riprovo tra {wait_time} secondi...",
|
17
|
-
"012cc970e039fdd79c452fc676202c814ffc76ae": "Numero massimo di tentativi per errore API OpenAI raggiunto. Generazione errore.",
|
18
|
-
"d0438e45667d31e0022b2497b5901cd4300f084b": "QueuedMessageHandler.handle_message si aspetta un dizionario con 'type' e 'message', ricevuto {msg_type}: {msg!r}",
|
19
|
-
"9d3460187ffa19c7c8a4020157072b1087e1bd2f": "[QueuedMessageHandler] {msg_type}: {msg}",
|
20
|
-
"3813833343430e8afa8fce33385c5e39fb24dd60": "[QueuedMessageHandler] {msg_type}: {message}",
|
21
|
-
"0be9a22226e16a40797010d23a0f581542dca40e": "[ToolExecutor] {tool_name} chiamato con argomenti: {args}",
|
22
|
-
"42c68edcb25442f518b1af77c6a2ddc07461aae0": "[ToolExecutor] Motivo chiamata: {tool_call_reason}",
|
23
|
-
"002ff598115d84595ffeee6219cb5c03d3a1d4a6": "Domanda",
|
24
|
-
"35747d13dcd91e8e8790c7f767d5ed764f541b9e": "procedi",
|
25
|
-
"33dde3a1afbc418768a69fa53168d9b0638fe1aa": "avanti",
|
26
|
-
"eee0bbba4ff92adbeb038a77df0466d660f15716": "continua",
|
27
|
-
"edee9402d198b04ac77dcf5dc9cc3dac44573782": "prossimo",
|
28
|
-
"8fdb7e2fa84f4faf0d9b92f466df424ec47a165b": "ok",
|
29
|
-
"5f8f924671cda79b5205a6bf1b776f347c4a7a07": "Opzioni di configurazione disponibili:\n",
|
30
|
-
"cef780a309cd234750764d42697882c24168ddab": "{key:15} {desc} (predefinito: {default})",
|
31
|
-
"68c2cc7f0ceaa3e499ecb4db331feb4debbbcc23": "Modello",
|
32
|
-
"c3f104d1365744b538bfde9f4adb6a6df4b80355": "Funzione",
|
33
|
-
"99a0efc6cfd85d8ff2732a6718140f822cb90472": "Stile",
|
34
|
-
"f1702b4686278becffc88baabe6f4b7a8355532c": "Messaggi",
|
35
|
-
"c38c6c1f3a2743f8626703abb302e403d20ff81c": "Token",
|
36
|
-
"a817d7eb8e0f1dab755ab5203a082e5c3c094fce": "Prompt",
|
37
|
-
"2ff255684a2277f806fcebf3fe338ed27857f350": "Completamento",
|
38
|
-
"b25928c69902557b0ef0a628490a3a1768d7b82f": "Totale",
|
39
|
-
"76e63d65c883ed50df40ac3aeef0c2d6a1c4ad60": "Azione Rapida",
|
40
|
-
"5397e0583f14f6c88de06b1ef28f460a1fb5b0ae": "Sì",
|
41
|
-
"816c52fd2bdd94a63cd0944823a6c0aa9384c103": "No",
|
42
|
-
"c47ae15370cfe1ed2781eedc1dc2547d12d9e972": "Aiuto",
|
43
|
-
"cc3dbd47e1cf9003a55d3366b3adbcd72275e525": "Nuovo Task",
|
44
|
-
"efa5a8b84e1afe65c81ecfce28c398c48f19ddc2": "Benvenuto su Janito{version_str}! Modalità chat attiva. Digita /exit per uscire.",
|
45
|
-
"b314d6e1460f86e0f21abc5aceb7935a2a0667e8": "Benvenuto su Janito{version_str} in modalità [white on magenta]VANILLA[/white on magenta]! Strumenti, prompt di sistema e temperatura sono disattivati, a meno che non siano sovrascritti.",
|
46
|
-
}
|
1
|
+
# pragma: allowlist secret
|
2
|
+
translations = {
|
3
|
+
"36107ed78ab25f6fb12ad8ce13018cd1ce6735d1": "Avvio del server web...",
|
4
|
+
"70a0d194687568a47aa617fd85036ace1e69a982": "Vuoi davvero uscire? (s/n): ",
|
5
|
+
"5c9ebcbbd7632ecb328bd52958b17158afaa32c6": "F12 = Azione Rapida (segue l'azione raccomandata)",
|
6
|
+
"fe21121e2934234b68d19b2757532117d440c1e3": "Chiave API non trovata. Si prega di configurare 'api_key' nel file di configurazione.",
|
7
|
+
"c9e3759b1756eba35b381ce2b72cd659e132b01f": "Ciao, {name}!",
|
8
|
+
"ca1fee2f55baabdc2e4b0e9529c89ee024e62079": "Nessun prompt fornito nei messaggi",
|
9
|
+
"f7449d23d0c500ae2a0b31e04f92b47a4d8ae845": "max_tokens deve essere un intero, ricevuto: {resolved_max_tokens!r}",
|
10
|
+
"70a9ed8edb6da12e208431a31aa16ba54419b26f": "Risposta non valida/malformed da OpenAI (tentativo {attempt}/{max_retries}). Riprovo tra {wait_time} secondi...",
|
11
|
+
"a873085e3b06184fb5d27e842f97b06b6190976d": "Numero massimo di tentativi per risposta non valida raggiunto. Generazione errore.",
|
12
|
+
"66a34568bbe846bb1bde3619eb4d6dfa10211104": "L'API non supporta l'uso degli strumenti.",
|
13
|
+
"09b81476b75586da4116b83f8be70d77b174cec3": "Limite di richieste API OpenAI (429) (tentativo {attempt}/{max_retries}): {e}. Riprovo tra {wait_time} secondi...",
|
14
|
+
"5717a35dd2a1533fb7e15edc8c9329cb69f3410b": "Errore server API OpenAI (tentativo {attempt}/{max_retries}): {e}. Riprovo tra {wait_time} secondi...",
|
15
|
+
"02e760ba15ed863176c1290ac8a9b923963103cd": "Errore client API OpenAI {status_code}: {e}. Nessun nuovo tentativo.",
|
16
|
+
"2e52b0bbc8f16226b70e3e20f95c9245d2bcdb47": "Errore API OpenAI (tentativo {attempt}/{max_retries}): {e}. Riprovo tra {wait_time} secondi...",
|
17
|
+
"012cc970e039fdd79c452fc676202c814ffc76ae": "Numero massimo di tentativi per errore API OpenAI raggiunto. Generazione errore.",
|
18
|
+
"d0438e45667d31e0022b2497b5901cd4300f084b": "QueuedMessageHandler.handle_message si aspetta un dizionario con 'type' e 'message', ricevuto {msg_type}: {msg!r}",
|
19
|
+
"9d3460187ffa19c7c8a4020157072b1087e1bd2f": "[QueuedMessageHandler] {msg_type}: {msg}",
|
20
|
+
"3813833343430e8afa8fce33385c5e39fb24dd60": "[QueuedMessageHandler] {msg_type}: {message}",
|
21
|
+
"0be9a22226e16a40797010d23a0f581542dca40e": "[ToolExecutor] {tool_name} chiamato con argomenti: {args}",
|
22
|
+
"42c68edcb25442f518b1af77c6a2ddc07461aae0": "[ToolExecutor] Motivo chiamata: {tool_call_reason}",
|
23
|
+
"002ff598115d84595ffeee6219cb5c03d3a1d4a6": "Domanda",
|
24
|
+
"35747d13dcd91e8e8790c7f767d5ed764f541b9e": "procedi",
|
25
|
+
"33dde3a1afbc418768a69fa53168d9b0638fe1aa": "avanti",
|
26
|
+
"eee0bbba4ff92adbeb038a77df0466d660f15716": "continua",
|
27
|
+
"edee9402d198b04ac77dcf5dc9cc3dac44573782": "prossimo",
|
28
|
+
"8fdb7e2fa84f4faf0d9b92f466df424ec47a165b": "ok",
|
29
|
+
"5f8f924671cda79b5205a6bf1b776f347c4a7a07": "Opzioni di configurazione disponibili:\n",
|
30
|
+
"cef780a309cd234750764d42697882c24168ddab": "{key:15} {desc} (predefinito: {default})",
|
31
|
+
"68c2cc7f0ceaa3e499ecb4db331feb4debbbcc23": "Modello",
|
32
|
+
"c3f104d1365744b538bfde9f4adb6a6df4b80355": "Funzione",
|
33
|
+
"99a0efc6cfd85d8ff2732a6718140f822cb90472": "Stile",
|
34
|
+
"f1702b4686278becffc88baabe6f4b7a8355532c": "Messaggi",
|
35
|
+
"c38c6c1f3a2743f8626703abb302e403d20ff81c": "Token",
|
36
|
+
"a817d7eb8e0f1dab755ab5203a082e5c3c094fce": "Prompt",
|
37
|
+
"2ff255684a2277f806fcebf3fe338ed27857f350": "Completamento",
|
38
|
+
"b25928c69902557b0ef0a628490a3a1768d7b82f": "Totale",
|
39
|
+
"76e63d65c883ed50df40ac3aeef0c2d6a1c4ad60": "Azione Rapida",
|
40
|
+
"5397e0583f14f6c88de06b1ef28f460a1fb5b0ae": "Sì",
|
41
|
+
"816c52fd2bdd94a63cd0944823a6c0aa9384c103": "No",
|
42
|
+
"c47ae15370cfe1ed2781eedc1dc2547d12d9e972": "Aiuto",
|
43
|
+
"cc3dbd47e1cf9003a55d3366b3adbcd72275e525": "Nuovo Task",
|
44
|
+
"efa5a8b84e1afe65c81ecfce28c398c48f19ddc2": "Benvenuto su Janito{version_str}! Modalità chat attiva. Digita /exit per uscire.",
|
45
|
+
"b314d6e1460f86e0f21abc5aceb7935a2a0667e8": "Benvenuto su Janito{version_str} in modalità [white on magenta]VANILLA[/white on magenta]! Strumenti, prompt di sistema e temperatura sono disattivati, a meno che non siano sovrascritti.",
|
46
|
+
}
|
janito/llm/agent.py
CHANGED
@@ -318,39 +318,23 @@ class LLMAgent:
|
|
318
318
|
loop_count = 1
|
319
319
|
import threading
|
320
320
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
config, cancel_event=driver_cancel_event
|
321
|
+
cancel_event = threading.Event()
|
322
|
+
while True:
|
323
|
+
self._print_verbose_chat_loop(loop_count)
|
324
|
+
driver_input = self._prepare_driver_input(config, cancel_event=cancel_event)
|
325
|
+
self.input_queue.put(driver_input)
|
326
|
+
try:
|
327
|
+
result, added_tool_results = self._process_next_response()
|
328
|
+
except KeyboardInterrupt:
|
329
|
+
cancel_event.set()
|
330
|
+
raise
|
331
|
+
if getattr(self, "verbose_agent", False):
|
332
|
+
print(
|
333
|
+
f"[agent] [DEBUG] Returned from _process_next_response: result={result}, added_tool_results={added_tool_results}"
|
335
334
|
)
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
except KeyboardInterrupt:
|
340
|
-
cancel_manager.cancel_current_request()
|
341
|
-
raise
|
342
|
-
if getattr(self, "verbose_agent", False):
|
343
|
-
print(
|
344
|
-
f"[agent] [DEBUG] Returned from _process_next_response: result={result}, added_tool_results={added_tool_results}"
|
345
|
-
)
|
346
|
-
if self._should_exit_chat_loop(result, added_tool_results):
|
347
|
-
return result
|
348
|
-
loop_count += 1
|
349
|
-
finally:
|
350
|
-
cancel_manager.clear_current_request()
|
351
|
-
# Clean up cancellation event
|
352
|
-
if hasattr(self, "cancel_event"):
|
353
|
-
delattr(self, "cancel_event")
|
335
|
+
if self._should_exit_chat_loop(result, added_tool_results):
|
336
|
+
return result
|
337
|
+
loop_count += 1
|
354
338
|
|
355
339
|
def _clear_driver_queues(self):
|
356
340
|
if hasattr(self, "driver") and self.driver:
|
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/llm/driver.py
CHANGED
@@ -252,11 +252,3 @@ class LLMDriver(ABC):
|
|
252
252
|
def _get_message_from_result(self, result):
|
253
253
|
"""Extract the message object from the provider result. Subclasses must implement this."""
|
254
254
|
raise NotImplementedError("Subclasses must implement _get_message_from_result.")
|
255
|
-
|
256
|
-
def cancel_current_request(self):
|
257
|
-
"""Cancel the current request being processed."""
|
258
|
-
# Use global cancellation manager to cancel the current request
|
259
|
-
from janito.llm.cancellation_manager import get_cancellation_manager
|
260
|
-
|
261
|
-
cancel_manager = get_cancellation_manager()
|
262
|
-
cancel_manager.cancel_current_request()
|
janito/plugins/__init__.py
CHANGED
@@ -1,36 +1,17 @@
|
|
1
1
|
"""
|
2
|
-
Plugin
|
2
|
+
Plugin system for janito.
|
3
3
|
|
4
|
-
This package
|
5
|
-
|
4
|
+
This package provides a flexible plugin system that allows extending
|
5
|
+
janito's functionality with custom tools, commands, and features.
|
6
6
|
"""
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
from .manager import PluginManager
|
9
|
+
from .base import Plugin, PluginMetadata
|
10
|
+
from .discovery import discover_plugins
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
PLUGINS = {
|
18
|
-
"core.filemanager": filemanager,
|
19
|
-
"core.codeanalyzer": codeanalyzer,
|
20
|
-
"core.system": system,
|
21
|
-
"core.imagedisplay": imagedisplay,
|
22
|
-
"web.webtools": webtools,
|
23
|
-
"dev.pythondev": pythondev,
|
24
|
-
"dev.visualization": visualization,
|
25
|
-
"ui.userinterface": userinterface,
|
26
|
-
}
|
27
|
-
|
28
|
-
|
29
|
-
def list_plugins():
|
30
|
-
"""Return all available plugins"""
|
31
|
-
return list(PLUGINS.keys())
|
32
|
-
|
33
|
-
|
34
|
-
def get_plugin(name):
|
35
|
-
"""Get a specific plugin by name"""
|
36
|
-
return PLUGINS.get(name)
|
12
|
+
__all__ = [
|
13
|
+
"PluginManager",
|
14
|
+
"Plugin",
|
15
|
+
"PluginMetadata",
|
16
|
+
"discover_plugins",
|
17
|
+
]
|
janito/plugins/auto_loader.py
CHANGED
@@ -13,7 +13,7 @@ from janito.plugins.discovery import list_available_plugins
|
|
13
13
|
# List of core plugins that should be enabled by default
|
14
14
|
CORE_PLUGINS = [
|
15
15
|
"core.filemanager",
|
16
|
-
"core.codeanalyzer",
|
16
|
+
"core.codeanalyzer",
|
17
17
|
"core.system",
|
18
18
|
"core.imagedisplay",
|
19
19
|
"dev.pythondev",
|
@@ -26,23 +26,23 @@ CORE_PLUGINS = [
|
|
26
26
|
def load_core_plugins(pm: PluginManager = None) -> List[str]:
|
27
27
|
"""
|
28
28
|
Load all core plugins.
|
29
|
-
|
29
|
+
|
30
30
|
Args:
|
31
31
|
pm: PluginManager instance. If None, creates a new one.
|
32
|
-
|
32
|
+
|
33
33
|
Returns:
|
34
34
|
List of successfully loaded plugin names
|
35
35
|
"""
|
36
36
|
if pm is None:
|
37
37
|
pm = PluginManager()
|
38
|
-
|
38
|
+
|
39
39
|
# Ensure plugins directory is in search path
|
40
40
|
plugins_dir = Path.cwd() / "plugins"
|
41
41
|
if plugins_dir.exists():
|
42
42
|
pm.add_plugin_path(str(plugins_dir))
|
43
|
-
|
43
|
+
|
44
44
|
loaded = []
|
45
|
-
|
45
|
+
|
46
46
|
# Load core plugins
|
47
47
|
for plugin_name in CORE_PLUGINS:
|
48
48
|
try:
|
@@ -50,14 +50,14 @@ def load_core_plugins(pm: PluginManager = None) -> List[str]:
|
|
50
50
|
loaded.append(plugin_name)
|
51
51
|
except Exception as e:
|
52
52
|
print(f"Warning: Failed to load core plugin {plugin_name}: {e}")
|
53
|
-
|
53
|
+
|
54
54
|
return loaded
|
55
55
|
|
56
56
|
|
57
57
|
def get_loaded_core_plugins() -> List[str]:
|
58
58
|
"""
|
59
59
|
Get list of currently loaded core plugins.
|
60
|
-
|
60
|
+
|
61
61
|
Returns:
|
62
62
|
List of loaded core plugin names
|
63
63
|
"""
|
@@ -69,10 +69,10 @@ def get_loaded_core_plugins() -> List[str]:
|
|
69
69
|
def is_core_plugin(plugin_name: str) -> bool:
|
70
70
|
"""
|
71
71
|
Check if a plugin is a core plugin.
|
72
|
-
|
72
|
+
|
73
73
|
Args:
|
74
74
|
plugin_name: Name of the plugin to check
|
75
|
-
|
75
|
+
|
76
76
|
Returns:
|
77
77
|
True if it's a core plugin
|
78
78
|
"""
|
@@ -82,11 +82,10 @@ def is_core_plugin(plugin_name: str) -> bool:
|
|
82
82
|
# Auto-load core plugins when module is imported
|
83
83
|
_plugin_manager = None
|
84
84
|
|
85
|
-
|
86
85
|
def get_plugin_manager() -> PluginManager:
|
87
86
|
"""Get the global plugin manager with core plugins loaded."""
|
88
87
|
global _plugin_manager
|
89
88
|
if _plugin_manager is None:
|
90
89
|
_plugin_manager = PluginManager()
|
91
90
|
load_core_plugins(_plugin_manager)
|
92
|
-
return _plugin_manager
|
91
|
+
return _plugin_manager
|
@@ -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
|
@@ -5,10 +5,7 @@ Base classes for janito plugins.
|
|
5
5
|
from abc import ABC, abstractmethod
|
6
6
|
from dataclasses import dataclass
|
7
7
|
from typing import Dict, Any, List, Optional, Type, Union
|
8
|
-
from
|
9
|
-
|
10
|
-
if TYPE_CHECKING:
|
11
|
-
from janito.tools.tool_base import ToolBase
|
8
|
+
from janito.tools.tool_base import ToolBase
|
12
9
|
|
13
10
|
|
14
11
|
@dataclass
|
@@ -53,7 +50,7 @@ class Plugin(ABC):
|
|
53
50
|
"""Return metadata describing this plugin."""
|
54
51
|
pass
|
55
52
|
|
56
|
-
def get_tools(self) -> List[Type[
|
53
|
+
def get_tools(self) -> List[Type[ToolBase]]:
|
57
54
|
"""
|
58
55
|
Return a list of tool classes provided by this plugin.
|
59
56
|
|
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 janito.
|
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
|
janito/plugins/core_adapter.py
CHANGED
@@ -5,24 +5,25 @@ This module provides proper Plugin class implementations for core plugins
|
|
5
5
|
that use the function-based approach instead of class-based.
|
6
6
|
"""
|
7
7
|
|
8
|
-
from janito.
|
8
|
+
from janito.plugins.base import Plugin, PluginMetadata
|
9
9
|
from typing import List, Type
|
10
|
-
from janito.tools.tool_base import ToolBase
|
10
|
+
from janito.tools.tool_base import ToolBase
|
11
|
+
from janito.tools.function_adapter import create_function_tool
|
11
12
|
|
12
13
|
|
13
14
|
class CorePluginAdapter(Plugin):
|
14
15
|
"""Adapter for core plugins using function-based tools."""
|
15
|
-
|
16
|
+
|
16
17
|
def __init__(self, plugin_name: str, description: str, tools_module):
|
17
18
|
super().__init__()
|
18
19
|
self._plugin_name = plugin_name
|
19
20
|
self._description = description
|
20
21
|
self._tools_module = tools_module
|
21
22
|
self._tool_classes = []
|
22
|
-
|
23
|
+
|
23
24
|
# Set the metadata attribute that Plugin expects
|
24
25
|
self.metadata = self.get_metadata()
|
25
|
-
|
26
|
+
|
26
27
|
def get_metadata(self) -> PluginMetadata:
|
27
28
|
return PluginMetadata(
|
28
29
|
name=self._plugin_name,
|
@@ -31,101 +32,22 @@ class CorePluginAdapter(Plugin):
|
|
31
32
|
author="Janito",
|
32
33
|
license="MIT",
|
33
34
|
)
|
34
|
-
|
35
|
+
|
35
36
|
def get_tools(self) -> List[Type[ToolBase]]:
|
36
37
|
return self._tool_classes
|
37
|
-
|
38
|
-
def _create_tool_class(self, func):
|
39
|
-
"""Create a ToolBase class from a function."""
|
40
|
-
resolved_tool_name = getattr(func, "tool_name", func.__name__)
|
41
|
-
|
42
|
-
# Create a proper tool class with explicit parameters and documentation
|
43
|
-
import inspect
|
44
|
-
from typing import get_type_hints
|
45
|
-
|
46
|
-
func_sig = inspect.signature(func)
|
47
|
-
type_hints = get_type_hints(func)
|
48
|
-
|
49
|
-
# Build parameter definitions for the run method
|
50
|
-
param_defs = []
|
51
|
-
param_docs = []
|
52
|
-
for name, param in func_sig.parameters.items():
|
53
|
-
type_hint = type_hints.get(name, str)
|
54
|
-
if param.default == inspect.Parameter.empty:
|
55
|
-
param_defs.append(f"{name}: {type_hint.__name__}")
|
56
|
-
else:
|
57
|
-
param_defs.append(f"{name}: {type_hint.__name__} = {repr(param.default)}")
|
58
|
-
|
59
|
-
# Add parameter documentation
|
60
|
-
param_docs.append(f" {name}: {type_hint.__name__} - Parameter {name}")
|
61
|
-
|
62
|
-
# Get function docstring or create one
|
63
|
-
func_doc = func.__doc__ or f"Execute {resolved_tool_name} tool"
|
64
|
-
|
65
|
-
# Create the tool class with proper signature and documentation
|
66
|
-
exec_globals = {
|
67
|
-
'ToolBase': ToolBase,
|
68
|
-
'ToolPermissions': ToolPermissions,
|
69
|
-
'func': func,
|
70
|
-
'inspect': inspect,
|
71
|
-
'str': str,
|
72
|
-
'List': list,
|
73
|
-
'Dict': dict,
|
74
|
-
'Optional': type(None),
|
75
|
-
}
|
76
|
-
|
77
|
-
param_docs_str = '\n'.join(param_docs)
|
78
|
-
|
79
|
-
class_def = f'''
|
80
|
-
class DynamicTool(ToolBase):
|
81
|
-
"""
|
82
|
-
{func_doc}
|
83
|
-
|
84
|
-
Parameters:
|
85
|
-
{param_docs_str}
|
86
|
-
|
87
|
-
Returns:
|
88
|
-
str: Execution result
|
89
|
-
"""
|
90
|
-
tool_name = "{resolved_tool_name}"
|
91
|
-
permissions = ToolPermissions(read=True, write=True, execute=True)
|
92
38
|
|
93
|
-
def __init__(self):
|
94
|
-
super().__init__()
|
95
|
-
|
96
|
-
def run(self, {', '.join(param_defs)}) -> str:
|
97
|
-
kwargs = locals()
|
98
|
-
sig = inspect.signature(func)
|
99
|
-
|
100
|
-
# Filter kwargs to only include parameters the function accepts
|
101
|
-
filtered_kwargs = {{}}
|
102
|
-
for name, param in sig.parameters.items():
|
103
|
-
if name in kwargs and kwargs[name] is not None:
|
104
|
-
filtered_kwargs[name] = kwargs[name]
|
105
|
-
|
106
|
-
result = func(**filtered_kwargs)
|
107
|
-
return str(result) if result is not None else ""
|
108
|
-
'''
|
109
|
-
|
110
|
-
exec(class_def, exec_globals)
|
111
|
-
return exec_globals['DynamicTool']
|
112
|
-
|
113
|
-
return DynamicTool
|
114
|
-
|
115
39
|
def initialize(self):
|
116
40
|
"""Initialize the plugin by creating tool classes."""
|
117
41
|
# Get tools from the module
|
118
42
|
tools = getattr(self._tools_module, "__plugin_tools__", [])
|
119
|
-
|
43
|
+
|
120
44
|
self._tool_classes = []
|
121
45
|
for tool_func in tools:
|
122
46
|
if callable(tool_func):
|
123
|
-
tool_class =
|
47
|
+
tool_class = create_function_tool(tool_func)
|
124
48
|
self._tool_classes.append(tool_class)
|
125
49
|
|
126
50
|
|
127
|
-
def create_core_plugin(
|
128
|
-
plugin_name: str, description: str, tools_module
|
129
|
-
) -> CorePluginAdapter:
|
51
|
+
def create_core_plugin(plugin_name: str, description: str, tools_module) -> CorePluginAdapter:
|
130
52
|
"""Create a core plugin adapter."""
|
131
|
-
return CorePluginAdapter(plugin_name, description, tools_module)
|
53
|
+
return CorePluginAdapter(plugin_name, description, tools_module)
|