janito 1.14.2__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. janito-2.0.0/PKG-INFO +232 -0
  2. janito-2.0.0/README.md +223 -0
  3. janito-2.0.0/janito/__init__.py +6 -0
  4. {janito-1.14.2 → janito-2.0.0}/janito/__main__.py +1 -1
  5. janito-2.0.0/janito/agent/setup_agent.py +139 -0
  6. janito-1.14.2/janito/agent/templates/profiles/system_prompt_template_base.txt.j2 → janito-2.0.0/janito/agent/templates/profiles/system_prompt_template_main.txt.j2 +1 -1
  7. janito-2.0.0/janito/cli/__init__.py +9 -0
  8. janito-2.0.0/janito/cli/chat_mode/bindings.py +37 -0
  9. janito-2.0.0/janito/cli/chat_mode/chat_entry.py +23 -0
  10. janito-2.0.0/janito/cli/chat_mode/prompt_style.py +19 -0
  11. janito-2.0.0/janito/cli/chat_mode/session.py +272 -0
  12. janito-1.14.2/janito/shell/prompt/completer.py → janito-2.0.0/janito/cli/chat_mode/shell/autocomplete.py +7 -6
  13. janito-2.0.0/janito/cli/chat_mode/shell/commands/__init__.py +55 -0
  14. janito-2.0.0/janito/cli/chat_mode/shell/commands/base.py +9 -0
  15. janito-2.0.0/janito/cli/chat_mode/shell/commands/clear.py +12 -0
  16. {janito-1.14.2/janito → janito-2.0.0/janito/cli/chat_mode}/shell/commands/conversation_restart.py +34 -30
  17. janito-2.0.0/janito/cli/chat_mode/shell/commands/edit.py +25 -0
  18. janito-2.0.0/janito/cli/chat_mode/shell/commands/help.py +16 -0
  19. janito-2.0.0/janito/cli/chat_mode/shell/commands/history_view.py +93 -0
  20. janito-2.0.0/janito/cli/chat_mode/shell/commands/lang.py +25 -0
  21. janito-2.0.0/janito/cli/chat_mode/shell/commands/last.py +137 -0
  22. janito-2.0.0/janito/cli/chat_mode/shell/commands/livelogs.py +49 -0
  23. janito-2.0.0/janito/cli/chat_mode/shell/commands/multi.py +51 -0
  24. janito-2.0.0/janito/cli/chat_mode/shell/commands/prompt.py +64 -0
  25. janito-2.0.0/janito/cli/chat_mode/shell/commands/role.py +36 -0
  26. janito-2.0.0/janito/cli/chat_mode/shell/commands/session.py +40 -0
  27. {janito-1.14.2/janito → janito-2.0.0/janito/cli/chat_mode}/shell/commands/session_control.py +2 -2
  28. janito-2.0.0/janito/cli/chat_mode/shell/commands/termweb_log.py +92 -0
  29. janito-2.0.0/janito/cli/chat_mode/shell/commands/tools.py +32 -0
  30. {janito-1.14.2/janito → janito-2.0.0/janito/cli/chat_mode}/shell/commands/utility.py +4 -7
  31. {janito-1.14.2/janito → janito-2.0.0/janito/cli/chat_mode}/shell/commands/verbose.py +5 -5
  32. janito-2.0.0/janito/cli/chat_mode/shell/session/__init__.py +1 -0
  33. {janito-1.14.2/janito → janito-2.0.0/janito/cli/chat_mode}/shell/session/manager.py +9 -1
  34. janito-2.0.0/janito/cli/chat_mode/toolbar.py +90 -0
  35. janito-2.0.0/janito/cli/cli_commands/list_models.py +35 -0
  36. janito-2.0.0/janito/cli/cli_commands/list_providers.py +9 -0
  37. janito-2.0.0/janito/cli/cli_commands/list_tools.py +53 -0
  38. janito-2.0.0/janito/cli/cli_commands/model_selection.py +50 -0
  39. janito-2.0.0/janito/cli/cli_commands/model_utils.py +84 -0
  40. janito-2.0.0/janito/cli/cli_commands/set_api_key.py +19 -0
  41. janito-2.0.0/janito/cli/cli_commands/show_config.py +51 -0
  42. janito-2.0.0/janito/cli/cli_commands/show_system_prompt.py +62 -0
  43. janito-2.0.0/janito/cli/config.py +28 -0
  44. janito-2.0.0/janito/cli/console.py +3 -0
  45. janito-2.0.0/janito/cli/core/__init__.py +4 -0
  46. janito-2.0.0/janito/cli/core/event_logger.py +59 -0
  47. janito-2.0.0/janito/cli/core/getters.py +31 -0
  48. janito-2.0.0/janito/cli/core/runner.py +141 -0
  49. janito-2.0.0/janito/cli/core/setters.py +174 -0
  50. janito-2.0.0/janito/cli/core/unsetters.py +54 -0
  51. janito-2.0.0/janito/cli/main.py +14 -0
  52. janito-2.0.0/janito/cli/main_cli.py +312 -0
  53. janito-2.0.0/janito/cli/prompt_core.py +230 -0
  54. janito-2.0.0/janito/cli/prompt_handler.py +6 -0
  55. janito-2.0.0/janito/cli/rich_terminal_reporter.py +101 -0
  56. janito-2.0.0/janito/cli/single_shot_mode/__init__.py +6 -0
  57. janito-2.0.0/janito/cli/single_shot_mode/handler.py +137 -0
  58. janito-2.0.0/janito/cli/termweb_starter.py +122 -0
  59. janito-2.0.0/janito/cli/utils.py +25 -0
  60. janito-2.0.0/janito/cli/verbose_output.py +196 -0
  61. janito-2.0.0/janito/config.py +5 -0
  62. janito-2.0.0/janito/config_manager.py +110 -0
  63. janito-2.0.0/janito/conversation_history.py +30 -0
  64. {janito-1.14.2/janito/agent/tools_utils → janito-2.0.0/janito}/dir_walk_utils.py +3 -2
  65. janito-2.0.0/janito/driver_events.py +98 -0
  66. janito-2.0.0/janito/drivers/anthropic/driver.py +113 -0
  67. janito-2.0.0/janito/drivers/azure_openai/driver.py +36 -0
  68. janito-2.0.0/janito/drivers/driver_registry.py +33 -0
  69. janito-2.0.0/janito/drivers/google_genai/driver.py +54 -0
  70. janito-2.0.0/janito/drivers/google_genai/schema_generator.py +67 -0
  71. janito-2.0.0/janito/drivers/mistralai/driver.py +41 -0
  72. janito-2.0.0/janito/drivers/openai/driver.py +334 -0
  73. janito-2.0.0/janito/event_bus/__init__.py +2 -0
  74. janito-2.0.0/janito/event_bus/bus.py +68 -0
  75. janito-2.0.0/janito/event_bus/event.py +15 -0
  76. janito-2.0.0/janito/event_bus/handler.py +31 -0
  77. janito-2.0.0/janito/event_bus/queue_bus.py +57 -0
  78. janito-2.0.0/janito/exceptions.py +23 -0
  79. janito-2.0.0/janito/formatting_token.py +54 -0
  80. {janito-1.14.2 → janito-2.0.0}/janito/i18n/pt.py +1 -0
  81. janito-2.0.0/janito/llm/__init__.py +5 -0
  82. janito-2.0.0/janito/llm/agent.py +443 -0
  83. janito-2.0.0/janito/llm/auth.py +62 -0
  84. janito-2.0.0/janito/llm/driver.py +239 -0
  85. janito-2.0.0/janito/llm/driver_config.py +34 -0
  86. janito-2.0.0/janito/llm/driver_config_builder.py +34 -0
  87. janito-2.0.0/janito/llm/driver_input.py +12 -0
  88. janito-2.0.0/janito/llm/message_parts.py +60 -0
  89. janito-2.0.0/janito/llm/model.py +38 -0
  90. janito-2.0.0/janito/llm/provider.py +187 -0
  91. janito-2.0.0/janito/perf_singleton.py +3 -0
  92. janito-2.0.0/janito/performance_collector.py +167 -0
  93. janito-2.0.0/janito/provider_config.py +98 -0
  94. janito-2.0.0/janito/provider_registry.py +152 -0
  95. janito-2.0.0/janito/providers/__init__.py +7 -0
  96. janito-2.0.0/janito/providers/anthropic/model_info.py +22 -0
  97. janito-2.0.0/janito/providers/anthropic/provider.py +65 -0
  98. janito-2.0.0/janito/providers/azure_openai/model_info.py +15 -0
  99. janito-2.0.0/janito/providers/azure_openai/provider.py +72 -0
  100. janito-2.0.0/janito/providers/deepseek/__init__.py +1 -0
  101. janito-2.0.0/janito/providers/deepseek/model_info.py +16 -0
  102. janito-2.0.0/janito/providers/deepseek/provider.py +91 -0
  103. janito-2.0.0/janito/providers/google/__init__.py +1 -0
  104. janito-2.0.0/janito/providers/google/model_info.py +40 -0
  105. janito-2.0.0/janito/providers/google/provider.py +69 -0
  106. janito-2.0.0/janito/providers/mistralai/model_info.py +37 -0
  107. janito-2.0.0/janito/providers/mistralai/provider.py +69 -0
  108. janito-2.0.0/janito/providers/openai/__init__.py +1 -0
  109. janito-2.0.0/janito/providers/openai/model_info.py +137 -0
  110. janito-2.0.0/janito/providers/openai/provider.py +107 -0
  111. janito-2.0.0/janito/providers/openai/schema_generator.py +63 -0
  112. janito-2.0.0/janito/providers/provider_static_info.py +21 -0
  113. janito-2.0.0/janito/providers/registry.py +26 -0
  114. janito-2.0.0/janito/report_events.py +38 -0
  115. {janito-1.14.2 → janito-2.0.0}/janito/termweb/app.py +1 -1
  116. janito-2.0.0/janito/tools/__init__.py +16 -0
  117. janito-2.0.0/janito/tools/adapters/__init__.py +1 -0
  118. janito-2.0.0/janito/tools/adapters/local/__init__.py +54 -0
  119. janito-2.0.0/janito/tools/adapters/local/adapter.py +92 -0
  120. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/ask_user.py +30 -13
  121. janito-2.0.0/janito/tools/adapters/local/copy_file.py +84 -0
  122. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/create_directory.py +11 -10
  123. janito-2.0.0/janito/tools/adapters/local/create_file.py +82 -0
  124. janito-2.0.0/janito/tools/adapters/local/delete_text_in_file.py +136 -0
  125. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/fetch_url.py +18 -19
  126. janito-2.0.0/janito/tools/adapters/local/find_files.py +140 -0
  127. janito-2.0.0/janito/tools/adapters/local/get_file_outline/core.py +151 -0
  128. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/get_file_outline/python_outline.py +125 -0
  129. janito-2.0.0/janito/tools/adapters/local/get_file_outline/python_outline_v2.py +156 -0
  130. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/get_file_outline/search_outline.py +12 -7
  131. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/move_file.py +13 -9
  132. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/open_url.py +7 -5
  133. janito-2.0.0/janito/tools/adapters/local/python_code_run.py +165 -0
  134. janito-2.0.0/janito/tools/adapters/local/python_command_run.py +163 -0
  135. janito-2.0.0/janito/tools/adapters/local/python_file_run.py +162 -0
  136. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/remove_directory.py +15 -9
  137. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/remove_file.py +17 -14
  138. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/replace_text_in_file.py +27 -22
  139. janito-2.0.0/janito/tools/adapters/local/run_bash_command.py +176 -0
  140. janito-2.0.0/janito/tools/adapters/local/run_powershell_command.py +219 -0
  141. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/search_text/core.py +32 -12
  142. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/search_text/match_lines.py +13 -4
  143. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/search_text/pattern_utils.py +12 -4
  144. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/search_text/traverse_directory.py +15 -2
  145. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/core.py +12 -11
  146. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/css_validator.py +1 -1
  147. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/html_validator.py +1 -1
  148. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/js_validator.py +1 -1
  149. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/json_validator.py +1 -1
  150. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/markdown_validator.py +1 -1
  151. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/ps1_validator.py +1 -1
  152. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/python_validator.py +1 -1
  153. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/xml_validator.py +1 -1
  154. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/yaml_validator.py +1 -1
  155. janito-1.14.2/janito/agent/tools/get_lines.py → janito-2.0.0/janito/tools/adapters/local/view_file.py +45 -27
  156. janito-2.0.0/janito/tools/inspect_registry.py +17 -0
  157. janito-2.0.0/janito/tools/tool_base.py +105 -0
  158. janito-2.0.0/janito/tools/tool_events.py +58 -0
  159. janito-2.0.0/janito/tools/tool_run_exception.py +12 -0
  160. {janito-1.14.2/janito/agent → janito-2.0.0/janito/tools}/tool_use_tracker.py +2 -4
  161. janito-1.14.2/janito/agent/tools_utils/utils.py → janito-2.0.0/janito/tools/tool_utils.py +18 -9
  162. janito-2.0.0/janito/tools/tools_adapter.py +207 -0
  163. janito-2.0.0/janito/tools/tools_schema.py +104 -0
  164. janito-2.0.0/janito/utils.py +11 -0
  165. janito-2.0.0/janito/version.py +4 -0
  166. janito-2.0.0/janito.egg-info/PKG-INFO +232 -0
  167. janito-2.0.0/janito.egg-info/SOURCES.txt +182 -0
  168. janito-2.0.0/pyproject.toml +33 -0
  169. janito-1.14.2/LICENSE +0 -21
  170. janito-1.14.2/MANIFEST.in +0 -6
  171. janito-1.14.2/PKG-INFO +0 -306
  172. janito-1.14.2/README.md +0 -275
  173. janito-1.14.2/janito/__init__.py +0 -1
  174. janito-1.14.2/janito/agent/__init__.py +0 -0
  175. janito-1.14.2/janito/agent/api_exceptions.py +0 -4
  176. janito-1.14.2/janito/agent/config.py +0 -147
  177. janito-1.14.2/janito/agent/config_defaults.py +0 -12
  178. janito-1.14.2/janito/agent/config_utils.py +0 -0
  179. janito-1.14.2/janito/agent/content_handler.py +0 -0
  180. janito-1.14.2/janito/agent/conversation.py +0 -238
  181. janito-1.14.2/janito/agent/conversation_api.py +0 -306
  182. janito-1.14.2/janito/agent/conversation_exceptions.py +0 -18
  183. janito-1.14.2/janito/agent/conversation_tool_calls.py +0 -39
  184. janito-1.14.2/janito/agent/conversation_ui.py +0 -17
  185. janito-1.14.2/janito/agent/event.py +0 -24
  186. janito-1.14.2/janito/agent/event_dispatcher.py +0 -24
  187. janito-1.14.2/janito/agent/event_handler_protocol.py +0 -5
  188. janito-1.14.2/janito/agent/event_system.py +0 -15
  189. janito-1.14.2/janito/agent/llm_conversation_history.py +0 -82
  190. janito-1.14.2/janito/agent/message_handler.py +0 -20
  191. janito-1.14.2/janito/agent/message_handler_protocol.py +0 -5
  192. janito-1.14.2/janito/agent/openai_client.py +0 -149
  193. janito-1.14.2/janito/agent/openai_schema_generator.py +0 -187
  194. janito-1.14.2/janito/agent/profile_manager.py +0 -96
  195. janito-1.14.2/janito/agent/queued_message_handler.py +0 -50
  196. janito-1.14.2/janito/agent/rich_live.py +0 -32
  197. janito-1.14.2/janito/agent/rich_message_handler.py +0 -115
  198. janito-1.14.2/janito/agent/runtime_config.py +0 -36
  199. janito-1.14.2/janito/agent/test_handler_protocols.py +0 -47
  200. janito-1.14.2/janito/agent/test_openai_schema_generator.py +0 -93
  201. janito-1.14.2/janito/agent/tests/__init__.py +0 -1
  202. janito-1.14.2/janito/agent/tool_base.py +0 -63
  203. janito-1.14.2/janito/agent/tool_executor.py +0 -122
  204. janito-1.14.2/janito/agent/tool_registry.py +0 -49
  205. janito-1.14.2/janito/agent/tools/__init__.py +0 -47
  206. janito-1.14.2/janito/agent/tools/create_file.py +0 -59
  207. janito-1.14.2/janito/agent/tools/delete_text_in_file.py +0 -97
  208. janito-1.14.2/janito/agent/tools/find_files.py +0 -106
  209. janito-1.14.2/janito/agent/tools/get_file_outline/core.py +0 -81
  210. janito-1.14.2/janito/agent/tools/present_choices.py +0 -64
  211. janito-1.14.2/janito/agent/tools/python_command_runner.py +0 -201
  212. janito-1.14.2/janito/agent/tools/python_file_runner.py +0 -199
  213. janito-1.14.2/janito/agent/tools/python_stdin_runner.py +0 -208
  214. janito-1.14.2/janito/agent/tools/replace_file.py +0 -72
  215. janito-1.14.2/janito/agent/tools/run_bash_command.py +0 -218
  216. janito-1.14.2/janito/agent/tools/run_powershell_command.py +0 -251
  217. janito-1.14.2/janito/agent/tools_utils/__init__.py +0 -1
  218. janito-1.14.2/janito/agent/tools_utils/action_type.py +0 -7
  219. janito-1.14.2/janito/agent/tools_utils/test_gitignore_utils.py +0 -46
  220. janito-1.14.2/janito/cli/__init__.py +0 -0
  221. janito-1.14.2/janito/cli/_livereload_log_utils.py +0 -13
  222. janito-1.14.2/janito/cli/_print_config.py +0 -96
  223. janito-1.14.2/janito/cli/_termweb_log_utils.py +0 -17
  224. janito-1.14.2/janito/cli/_utils.py +0 -9
  225. janito-1.14.2/janito/cli/arg_parser.py +0 -272
  226. janito-1.14.2/janito/cli/cli_main.py +0 -281
  227. janito-1.14.2/janito/cli/config_commands.py +0 -211
  228. janito-1.14.2/janito/cli/config_runner.py +0 -35
  229. janito-1.14.2/janito/cli/formatting_runner.py +0 -12
  230. janito-1.14.2/janito/cli/livereload_starter.py +0 -60
  231. janito-1.14.2/janito/cli/logging_setup.py +0 -38
  232. janito-1.14.2/janito/cli/main.py +0 -202
  233. janito-1.14.2/janito/cli/one_shot.py +0 -80
  234. janito-1.14.2/janito/cli/termweb_starter.py +0 -73
  235. janito-1.14.2/janito/livereload/app.py +0 -25
  236. janito-1.14.2/janito/rich_utils.py +0 -59
  237. janito-1.14.2/janito/shell/__init__.py +0 -0
  238. janito-1.14.2/janito/shell/commands/__init__.py +0 -61
  239. janito-1.14.2/janito/shell/commands/config.py +0 -22
  240. janito-1.14.2/janito/shell/commands/edit.py +0 -24
  241. janito-1.14.2/janito/shell/commands/history_view.py +0 -18
  242. janito-1.14.2/janito/shell/commands/lang.py +0 -19
  243. janito-1.14.2/janito/shell/commands/livelogs.py +0 -42
  244. janito-1.14.2/janito/shell/commands/prompt.py +0 -62
  245. janito-1.14.2/janito/shell/commands/termweb_log.py +0 -94
  246. janito-1.14.2/janito/shell/commands/tools.py +0 -26
  247. janito-1.14.2/janito/shell/commands/track.py +0 -36
  248. janito-1.14.2/janito/shell/main.py +0 -326
  249. janito-1.14.2/janito/shell/prompt/load_prompt.py +0 -57
  250. janito-1.14.2/janito/shell/prompt/session_setup.py +0 -57
  251. janito-1.14.2/janito/shell/session/config.py +0 -109
  252. janito-1.14.2/janito/shell/session/history.py +0 -0
  253. janito-1.14.2/janito/shell/ui/interactive.py +0 -226
  254. janito-1.14.2/janito/termweb/static/editor.css +0 -158
  255. janito-1.14.2/janito/termweb/static/editor.css.bak +0 -145
  256. janito-1.14.2/janito/termweb/static/editor.html +0 -46
  257. janito-1.14.2/janito/termweb/static/editor.html.bak +0 -46
  258. janito-1.14.2/janito/termweb/static/editor.js +0 -265
  259. janito-1.14.2/janito/termweb/static/editor.js.bak +0 -259
  260. janito-1.14.2/janito/termweb/static/explorer.html.bak +0 -59
  261. janito-1.14.2/janito/termweb/static/favicon.ico +0 -0
  262. janito-1.14.2/janito/termweb/static/favicon.ico.bak +0 -0
  263. janito-1.14.2/janito/termweb/static/index.html +0 -53
  264. janito-1.14.2/janito/termweb/static/index.html.bak +0 -54
  265. janito-1.14.2/janito/termweb/static/index.html.bak.bak +0 -175
  266. janito-1.14.2/janito/termweb/static/landing.html.bak +0 -36
  267. janito-1.14.2/janito/termweb/static/termicon.svg +0 -1
  268. janito-1.14.2/janito/termweb/static/termweb.css +0 -214
  269. janito-1.14.2/janito/termweb/static/termweb.css.bak +0 -237
  270. janito-1.14.2/janito/termweb/static/termweb.js +0 -162
  271. janito-1.14.2/janito/termweb/static/termweb.js.bak +0 -168
  272. janito-1.14.2/janito/termweb/static/termweb.js.bak.bak +0 -157
  273. janito-1.14.2/janito/termweb/static/termweb_quickopen.js +0 -135
  274. janito-1.14.2/janito/termweb/static/termweb_quickopen.js.bak +0 -125
  275. janito-1.14.2/janito/tests/test_rich_utils.py +0 -44
  276. janito-1.14.2/janito/web/__init__.py +0 -0
  277. janito-1.14.2/janito/web/__main__.py +0 -25
  278. janito-1.14.2/janito/web/app.py +0 -145
  279. janito-1.14.2/janito.egg-info/PKG-INFO +0 -306
  280. janito-1.14.2/janito.egg-info/SOURCES.txt +0 -188
  281. janito-1.14.2/janito.egg-info/requires.txt +0 -16
  282. janito-1.14.2/pyproject.toml +0 -62
  283. janito-1.14.2/tests/test_basic.py +0 -21
  284. janito-1.14.2/tests/test_find_files.py +0 -55
  285. janito-1.14.2/tests/test_outline_formatter.py +0 -49
  286. janito-1.14.2/tests/test_outline_no_overlap.py +0 -31
  287. janito-1.14.2/tests/test_outline_python_file.py +0 -35
  288. janito-1.14.2/tests/test_outline_python_file_complex.py +0 -52
  289. janito-1.14.2/tests/test_outline_tool_run.py +0 -46
  290. janito-1.14.2/tests/test_platform_discovery.py +0 -37
  291. janito-1.14.2/tests/test_python_command_runner.py +0 -23
  292. janito-1.14.2/tests/test_python_file_runner.py +0 -29
  293. janito-1.14.2/tests/test_python_stdin_runner.py +0 -23
  294. janito-1.14.2/tests/test_rich_message_handler_action_type.py +0 -39
  295. janito-1.14.2/tests/test_run_powershell_command.py +0 -15
  296. janito-1.14.2/tests/test_search_text.py +0 -29
  297. janito-1.14.2/tests/test_set_role.py +0 -37
  298. janito-1.14.2/tests/test_tool_registry_docstring_formats.py +0 -99
  299. janito-1.14.2/tests/test_tool_registry_manual_sim.py +0 -55
  300. janito-1.14.2/tests/test_tool_registry_validation.py +0 -47
  301. janito-1.14.2/tests/test_tool_use_tracker.py +0 -38
  302. janito-1.14.2/tests/test_validate_file_syntax.py +0 -66
  303. janito-1.14.2/tests/test_validate_file_syntax_xml_html.py +0 -42
  304. janito-1.14.2/tests/test_validate_markdown_syntax.py +0 -64
  305. {janito-1.14.2 → janito-2.0.0}/janito/agent/templates/profiles/system_prompt_template_base_pt.txt.j2 +0 -0
  306. {janito-1.14.2/janito → janito-2.0.0/janito/cli/chat_mode}/shell/input_history.py +0 -0
  307. /janito-1.14.2/janito/shell/commands/session.py → /janito-2.0.0/janito/cli/chat_mode/shell/session/history.py +0 -0
  308. {janito-1.14.2/janito/agent/tools_utils → janito-2.0.0/janito}/formatting.py +0 -0
  309. {janito-1.14.2/janito/agent/tools_utils → janito-2.0.0/janito}/gitignore_utils.py +0 -0
  310. {janito-1.14.2 → janito-2.0.0}/janito/i18n/__init__.py +0 -0
  311. {janito-1.14.2 → janito-2.0.0}/janito/i18n/messages.py +0 -0
  312. {janito-1.14.2/janito/agent → janito-2.0.0/janito}/platform_discovery.py +0 -0
  313. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/get_file_outline/__init__.py +0 -0
  314. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/get_file_outline/markdown_outline.py +0 -0
  315. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/search_text/__init__.py +0 -0
  316. {janito-1.14.2/janito/agent/tools → janito-2.0.0/janito/tools/adapters/local}/validate_file_syntax/__init__.py +0 -0
  317. {janito-1.14.2 → janito-2.0.0}/janito.egg-info/dependency_links.txt +0 -0
  318. {janito-1.14.2 → janito-2.0.0}/janito.egg-info/entry_points.txt +0 -0
  319. {janito-1.14.2 → janito-2.0.0}/janito.egg-info/top_level.txt +0 -0
  320. {janito-1.14.2 → janito-2.0.0}/setup.cfg +0 -0
janito-2.0.0/PKG-INFO ADDED
@@ -0,0 +1,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: janito
3
+ Version: 2.0.0
4
+ Summary: A new Python package called janito.
5
+ Author-email: Your Name <your.email@example.com>
6
+ Project-URL: Homepage, https://github.com/janito-dev/janito
7
+ Requires-Python: >=3.7
8
+ Description-Content-Type: text/markdown
9
+
10
+ # Janito
11
+
12
+ Janito is a command-line interface (CLI) tool for managing and interacting with Large Language Model (LLM) providers. It enables you to configure API keys, select providers and models, and submit prompts to various LLMs from your terminal. Janito is designed for extensibility, supporting multiple providers and a wide range of tools for automation and productivity.
13
+
14
+ ## Features
15
+
16
+ - 🔑 Manage API keys and provider configurations
17
+ - 🤖 Interact with multiple LLM providers (OpenAI, Google, Mistral, , and more)
18
+ - 🛠️ List and use a variety of registered tools
19
+ - 📝 Submit prompts and receive responses directly from the CLI
20
+ - 📋 List available models for each provider
21
+ - 🧩 Extensible architecture for adding new providers and tools
22
+ - 🎛️ Rich terminal output and event logging
23
+
24
+ ### Advanced and Architectural Features
25
+
26
+ - ⚡ **Event-driven architecture**: Modular, decoupled system using a custom EventBus for extensibility and integration.
27
+ - 🧑‍💻 **Tool registry & dynamic tool execution**: Register new tools easily, execute them by name or call from automation pipelines.
28
+ - 🤖 **LLM Agent automation**: Supports agent-like workflows with the ability to chain tools or make decisions during LLM conversations.
29
+ - 🏗️ **Extensible provider management**: Add, configure, or switch between LLM providers and their models on the fly.
30
+ - 🧰 **Rich tool ecosystem**: Includes file operations, local/remote script and command execution, text processing, and internet access (fetching URLs), all reusable by LLM or user.
31
+ - 📝 **Comprehensive event & history reporting**: Detailed logs of prompts, events, tool usage, and responses for traceability and audit.
32
+ - 🖥️ **Enhanced terminal UI**: Colorful, informative real-time outputs and logs to improve productivity and insight during LLM usage.
33
+
34
+ ## Installation
35
+
36
+ Janito is a Python package. Since this is a development version, install it directly from GitHub:
37
+
38
+ ```bash
39
+ pip install git+https://github.com/janito-dev/janito.git
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ After installation, use the `janito` command in your terminal.
45
+
46
+ ### Basic Commands
47
+
48
+ - **Set API Key for a Provider (requires -p PROVIDER)**
49
+ ```bash
50
+ janito --set-api-key API_KEY -p PROVIDER
51
+ ```
52
+ > **Note:** The `-p PROVIDER` argument is required when setting an API key. For example:
53
+ > ```bash
54
+ > janito --set-api-key sk-xxxxxxx -p openai
55
+ > ```
56
+
57
+ - **Set the Provider**
58
+ ```bash
59
+ janito --set provider=provider_name
60
+ ```
61
+
62
+ - **List Supported Providers**
63
+ ```bash
64
+ janito --list-providers
65
+ ```
66
+
67
+ - **List Registered Tools**
68
+ ```bash
69
+ janito --list-tools
70
+ ```
71
+
72
+ - **List Models for a Provider**
73
+ ```bash
74
+ janito -p PROVIDER --list-models
75
+ ```
76
+
77
+ - **Submit a Prompt**
78
+ ```bash
79
+ janito "What is the capital of France?"
80
+ ```
81
+
82
+ - **Start Interactive Chat Shell**
83
+ ```bash
84
+ janito
85
+ ```
86
+
87
+ ### Advanced Options
88
+
89
+ - **Enable Inline Web File Viewer for Clickable Links**
90
+
91
+ By default, Janito can open referenced files in a browser-based viewer when you click on file links in supported terminals. To enable this feature for your session, use the `-w` or `--web` flag:
92
+
93
+ ```bash
94
+ janito -w
95
+ ```
96
+ This starts the lightweight web file viewer (termweb) in the background, allowing you to inspect files referenced in responses directly in your browser. Combine with interactive mode or prompts as needed.
97
+
98
+ > **Tip:** Use with the interactive shell for the best experience with clickable file links.
99
+
100
+
101
+ - **Enable Execution Tools (Code/Shell Execution)**
102
+
103
+ By default, tools that can execute code or shell commands are **disabled** for safety. To enable these tools (such as code execution, shell commands, etc.), use the `--exec` or `-x` flag:
104
+
105
+ ```bash
106
+ janito -x "Run this code: print('Hello, world!')"
107
+ ```
108
+ > **Warning:** Enabling execution tools allows running arbitrary code or shell commands. Only use `--exec` if you trust your prompt and environment.
109
+
110
+ - **Set a System Prompt**
111
+ ```bash
112
+ janito -s path/to/system_prompt.txt "Your prompt here"
113
+ ```
114
+
115
+ - **Select Model and Provider Temporarily**
116
+ ```bash
117
+ janito -p openai -m gpt-3.5-turbo "Your prompt here"
118
+ ```
119
+
120
+ - **Set Provider-Specific Config (for the selected provider)**
121
+ ```bash
122
+ # syntax: janito --set PROVIDER.KEY=VALUE
123
+ # example: set the default model for openai provider
124
+ janito --set openai.model=gpt-4o
125
+
126
+ ```
127
+ > **Note:** Use `--set PROVIDER.key=value` for provider-specific settings (e.g., `openai.max_tokens`, `openai.base_url`).
128
+
129
+ - **Enable Event Logging**
130
+ ```bash
131
+ janito -e "Your prompt here"
132
+ ```
133
+
134
+ ## 🌟 CLI Options Reference
135
+
136
+ ### Core CLI Options
137
+ | Option | Description |
138
+ |------------------------|-----------------------------------------------------------------------------|
139
+ | `-w`, `--web` | Enable the builtin lightweight web file viewer for clickable file links (termweb). |
140
+
141
+ |------------------------|-----------------------------------------------------------------------------|
142
+ | `--version` | Show program version |
143
+ | `--list-tools` | List all registered tools |
144
+ | `--list-providers` | List all supported LLM providers |
145
+ | `-l`, `--list-models` | List models for current/selected provider |
146
+ | `--set-api-key` | Set API key for a provider. **Requires** `-p PROVIDER` to specify the provider. |
147
+ | `--set provider=name` | Set the current LLM provider (e.g., `janito --set provider=openai`) |
148
+ | `--set PROVIDER.model=MODEL` or `--set model=MODEL` | Set the default model for the current/selected provider, or globally. (e.g., `janito --set openai.model=gpt-3.5-turbo`) |
149
+ | `-s`, `--system` | Set a system prompt (e.g., `janito -s path/to/system_prompt.txt "Your prompt here"`) |
150
+ | `-r`, `--role` | Set the role for the agent (overrides config) (e.g., `janito -r "assistant" "Your prompt here"`) |
151
+ | `-p`, `--provider` | Select LLM provider (overrides config) (e.g., `janito -p openai "Your prompt here"`) |
152
+ | `-m`, `--model` | Select model for the provider (e.g., `janito -m gpt-3.5-turbo "Your prompt here"`) |
153
+ | `-v`, `--verbose` | Print extra information before answering |
154
+ | `-R`, `--raw` | Print raw JSON response from API |
155
+ | `-e`, `--event-log` | Log events to console as they occur |
156
+ | `["user_prompt"]...` | Prompt to submit (if no other command is used) (e.g., `janito "What is the capital of France?"`) |
157
+
158
+ ### 🧩 Extended Chat Mode Commands
159
+ Once inside the interactive chat mode, you can use these slash commands:
160
+
161
+ #### 📲 Basic Interaction
162
+ | Command | Description |
163
+ |-------------------|----------------------------------------------|
164
+ | `/exit` or `exit` | Exit chat mode |
165
+ | `/help` | Show available commands |
166
+ | `/multi` | Activate multiline input mode |
167
+ | `/clear` | Clear the terminal screen |
168
+ | `/history` | Show input history |
169
+ | `/view` | Print current conversation history |
170
+ | `/track` | Show tool usage history |
171
+
172
+ #### 💬 Conversation Management
173
+ | Command | Description |
174
+ |---------------------|----------------------------------------------|
175
+ | `/restart` or `/start` | Start a new conversation (reset context) |
176
+ | `/prompt` | Show the current system prompt |
177
+ | `/role <description>` | Change the system role |
178
+ | `/lang [code]` | Change interface language (e.g., `/lang en`) |
179
+
180
+ #### 🛠️ Tool & Provider Interaction
181
+ | Command | Description |
182
+ |----------------------|----------------------------------------------|
183
+ | `/tools` | List available tools |
184
+ | `/termweb-status` | Show status of termweb server |
185
+ | `/termweb-logs` | Show last lines of termweb logs |
186
+ | `/livelogs` | Show live updates from server log file |
187
+ | `/edit <filename>` | Open file in browser-based editor |
188
+
189
+ #### 📊 Output Control
190
+ | Command | Description |
191
+ |---------------------|----------------------------------------------|
192
+ | `/verbose` | Show current verbose mode status |
193
+ | `/verbose [on|off]` | Set verbose mode |
194
+
195
+ ## Extending Janito
196
+
197
+ Janito is built to be extensible. You can add new LLM providers or tools by implementing new modules in the `janito/providers` or `janito/tools` directories, respectively. See the source code and developer documentation for more details.
198
+
199
+ ## Supported Providers
200
+
201
+ - OpenAI
202
+ - DeepSeek
203
+
204
+ ## Contributing
205
+
206
+ Contributions are welcome! Please see the `CONTRIBUTING.md` (if available) or open an issue to get started.
207
+
208
+ ## License
209
+
210
+ This project is licensed under the terms of the MIT license.
211
+
212
+ For more information, see the documentation in the `docs/` directory or run `janito --help`.
213
+
214
+ ---
215
+
216
+ ## 📖 Detailed Documentation
217
+
218
+ Full and up-to-date documentation is available at: https://janito-dev.github.io/janito/
219
+
220
+ ---
221
+
222
+ ## FAQ: Setting API Keys
223
+
224
+ To set an API key for a provider, you **must** specify both the API key and the provider name:
225
+
226
+ ```bash
227
+ janito --set-api-key YOUR_API_KEY -p PROVIDER_NAME
228
+ ```
229
+
230
+ Replace `YOUR_API_KEY` with your actual key and `PROVIDER_NAME` with the provider (e.g., `openai`, `google`, etc.).
231
+
232
+ If you omit the `-p PROVIDER_NAME` argument, Janito will show an error and not set the key.
janito-2.0.0/README.md ADDED
@@ -0,0 +1,223 @@
1
+ # Janito
2
+
3
+ Janito is a command-line interface (CLI) tool for managing and interacting with Large Language Model (LLM) providers. It enables you to configure API keys, select providers and models, and submit prompts to various LLMs from your terminal. Janito is designed for extensibility, supporting multiple providers and a wide range of tools for automation and productivity.
4
+
5
+ ## Features
6
+
7
+ - 🔑 Manage API keys and provider configurations
8
+ - 🤖 Interact with multiple LLM providers (OpenAI, Google, Mistral, , and more)
9
+ - 🛠️ List and use a variety of registered tools
10
+ - 📝 Submit prompts and receive responses directly from the CLI
11
+ - 📋 List available models for each provider
12
+ - 🧩 Extensible architecture for adding new providers and tools
13
+ - 🎛️ Rich terminal output and event logging
14
+
15
+ ### Advanced and Architectural Features
16
+
17
+ - ⚡ **Event-driven architecture**: Modular, decoupled system using a custom EventBus for extensibility and integration.
18
+ - 🧑‍💻 **Tool registry & dynamic tool execution**: Register new tools easily, execute them by name or call from automation pipelines.
19
+ - 🤖 **LLM Agent automation**: Supports agent-like workflows with the ability to chain tools or make decisions during LLM conversations.
20
+ - 🏗️ **Extensible provider management**: Add, configure, or switch between LLM providers and their models on the fly.
21
+ - 🧰 **Rich tool ecosystem**: Includes file operations, local/remote script and command execution, text processing, and internet access (fetching URLs), all reusable by LLM or user.
22
+ - 📝 **Comprehensive event & history reporting**: Detailed logs of prompts, events, tool usage, and responses for traceability and audit.
23
+ - 🖥️ **Enhanced terminal UI**: Colorful, informative real-time outputs and logs to improve productivity and insight during LLM usage.
24
+
25
+ ## Installation
26
+
27
+ Janito is a Python package. Since this is a development version, install it directly from GitHub:
28
+
29
+ ```bash
30
+ pip install git+https://github.com/janito-dev/janito.git
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ After installation, use the `janito` command in your terminal.
36
+
37
+ ### Basic Commands
38
+
39
+ - **Set API Key for a Provider (requires -p PROVIDER)**
40
+ ```bash
41
+ janito --set-api-key API_KEY -p PROVIDER
42
+ ```
43
+ > **Note:** The `-p PROVIDER` argument is required when setting an API key. For example:
44
+ > ```bash
45
+ > janito --set-api-key sk-xxxxxxx -p openai
46
+ > ```
47
+
48
+ - **Set the Provider**
49
+ ```bash
50
+ janito --set provider=provider_name
51
+ ```
52
+
53
+ - **List Supported Providers**
54
+ ```bash
55
+ janito --list-providers
56
+ ```
57
+
58
+ - **List Registered Tools**
59
+ ```bash
60
+ janito --list-tools
61
+ ```
62
+
63
+ - **List Models for a Provider**
64
+ ```bash
65
+ janito -p PROVIDER --list-models
66
+ ```
67
+
68
+ - **Submit a Prompt**
69
+ ```bash
70
+ janito "What is the capital of France?"
71
+ ```
72
+
73
+ - **Start Interactive Chat Shell**
74
+ ```bash
75
+ janito
76
+ ```
77
+
78
+ ### Advanced Options
79
+
80
+ - **Enable Inline Web File Viewer for Clickable Links**
81
+
82
+ By default, Janito can open referenced files in a browser-based viewer when you click on file links in supported terminals. To enable this feature for your session, use the `-w` or `--web` flag:
83
+
84
+ ```bash
85
+ janito -w
86
+ ```
87
+ This starts the lightweight web file viewer (termweb) in the background, allowing you to inspect files referenced in responses directly in your browser. Combine with interactive mode or prompts as needed.
88
+
89
+ > **Tip:** Use with the interactive shell for the best experience with clickable file links.
90
+
91
+
92
+ - **Enable Execution Tools (Code/Shell Execution)**
93
+
94
+ By default, tools that can execute code or shell commands are **disabled** for safety. To enable these tools (such as code execution, shell commands, etc.), use the `--exec` or `-x` flag:
95
+
96
+ ```bash
97
+ janito -x "Run this code: print('Hello, world!')"
98
+ ```
99
+ > **Warning:** Enabling execution tools allows running arbitrary code or shell commands. Only use `--exec` if you trust your prompt and environment.
100
+
101
+ - **Set a System Prompt**
102
+ ```bash
103
+ janito -s path/to/system_prompt.txt "Your prompt here"
104
+ ```
105
+
106
+ - **Select Model and Provider Temporarily**
107
+ ```bash
108
+ janito -p openai -m gpt-3.5-turbo "Your prompt here"
109
+ ```
110
+
111
+ - **Set Provider-Specific Config (for the selected provider)**
112
+ ```bash
113
+ # syntax: janito --set PROVIDER.KEY=VALUE
114
+ # example: set the default model for openai provider
115
+ janito --set openai.model=gpt-4o
116
+
117
+ ```
118
+ > **Note:** Use `--set PROVIDER.key=value` for provider-specific settings (e.g., `openai.max_tokens`, `openai.base_url`).
119
+
120
+ - **Enable Event Logging**
121
+ ```bash
122
+ janito -e "Your prompt here"
123
+ ```
124
+
125
+ ## 🌟 CLI Options Reference
126
+
127
+ ### Core CLI Options
128
+ | Option | Description |
129
+ |------------------------|-----------------------------------------------------------------------------|
130
+ | `-w`, `--web` | Enable the builtin lightweight web file viewer for clickable file links (termweb). |
131
+
132
+ |------------------------|-----------------------------------------------------------------------------|
133
+ | `--version` | Show program version |
134
+ | `--list-tools` | List all registered tools |
135
+ | `--list-providers` | List all supported LLM providers |
136
+ | `-l`, `--list-models` | List models for current/selected provider |
137
+ | `--set-api-key` | Set API key for a provider. **Requires** `-p PROVIDER` to specify the provider. |
138
+ | `--set provider=name` | Set the current LLM provider (e.g., `janito --set provider=openai`) |
139
+ | `--set PROVIDER.model=MODEL` or `--set model=MODEL` | Set the default model for the current/selected provider, or globally. (e.g., `janito --set openai.model=gpt-3.5-turbo`) |
140
+ | `-s`, `--system` | Set a system prompt (e.g., `janito -s path/to/system_prompt.txt "Your prompt here"`) |
141
+ | `-r`, `--role` | Set the role for the agent (overrides config) (e.g., `janito -r "assistant" "Your prompt here"`) |
142
+ | `-p`, `--provider` | Select LLM provider (overrides config) (e.g., `janito -p openai "Your prompt here"`) |
143
+ | `-m`, `--model` | Select model for the provider (e.g., `janito -m gpt-3.5-turbo "Your prompt here"`) |
144
+ | `-v`, `--verbose` | Print extra information before answering |
145
+ | `-R`, `--raw` | Print raw JSON response from API |
146
+ | `-e`, `--event-log` | Log events to console as they occur |
147
+ | `["user_prompt"]...` | Prompt to submit (if no other command is used) (e.g., `janito "What is the capital of France?"`) |
148
+
149
+ ### 🧩 Extended Chat Mode Commands
150
+ Once inside the interactive chat mode, you can use these slash commands:
151
+
152
+ #### 📲 Basic Interaction
153
+ | Command | Description |
154
+ |-------------------|----------------------------------------------|
155
+ | `/exit` or `exit` | Exit chat mode |
156
+ | `/help` | Show available commands |
157
+ | `/multi` | Activate multiline input mode |
158
+ | `/clear` | Clear the terminal screen |
159
+ | `/history` | Show input history |
160
+ | `/view` | Print current conversation history |
161
+ | `/track` | Show tool usage history |
162
+
163
+ #### 💬 Conversation Management
164
+ | Command | Description |
165
+ |---------------------|----------------------------------------------|
166
+ | `/restart` or `/start` | Start a new conversation (reset context) |
167
+ | `/prompt` | Show the current system prompt |
168
+ | `/role <description>` | Change the system role |
169
+ | `/lang [code]` | Change interface language (e.g., `/lang en`) |
170
+
171
+ #### 🛠️ Tool & Provider Interaction
172
+ | Command | Description |
173
+ |----------------------|----------------------------------------------|
174
+ | `/tools` | List available tools |
175
+ | `/termweb-status` | Show status of termweb server |
176
+ | `/termweb-logs` | Show last lines of termweb logs |
177
+ | `/livelogs` | Show live updates from server log file |
178
+ | `/edit <filename>` | Open file in browser-based editor |
179
+
180
+ #### 📊 Output Control
181
+ | Command | Description |
182
+ |---------------------|----------------------------------------------|
183
+ | `/verbose` | Show current verbose mode status |
184
+ | `/verbose [on|off]` | Set verbose mode |
185
+
186
+ ## Extending Janito
187
+
188
+ Janito is built to be extensible. You can add new LLM providers or tools by implementing new modules in the `janito/providers` or `janito/tools` directories, respectively. See the source code and developer documentation for more details.
189
+
190
+ ## Supported Providers
191
+
192
+ - OpenAI
193
+ - DeepSeek
194
+
195
+ ## Contributing
196
+
197
+ Contributions are welcome! Please see the `CONTRIBUTING.md` (if available) or open an issue to get started.
198
+
199
+ ## License
200
+
201
+ This project is licensed under the terms of the MIT license.
202
+
203
+ For more information, see the documentation in the `docs/` directory or run `janito --help`.
204
+
205
+ ---
206
+
207
+ ## 📖 Detailed Documentation
208
+
209
+ Full and up-to-date documentation is available at: https://janito-dev.github.io/janito/
210
+
211
+ ---
212
+
213
+ ## FAQ: Setting API Keys
214
+
215
+ To set an API key for a provider, you **must** specify both the API key and the provider name:
216
+
217
+ ```bash
218
+ janito --set-api-key YOUR_API_KEY -p PROVIDER_NAME
219
+ ```
220
+
221
+ Replace `YOUR_API_KEY` with your actual key and `PROVIDER_NAME` with the provider (e.g., `openai`, `google`, etc.).
222
+
223
+ If you omit the `-p PROVIDER_NAME` argument, Janito will show an error and not set the key.
@@ -0,0 +1,6 @@
1
+ """
2
+ janito: A Python package for managing and interacting with Large Language Model (LLM) providers and their APIs.
3
+ Provides a CLI for credential management and an extensible driver system for LLMs.
4
+ """
5
+
6
+ __version__ = "2.0.0"
@@ -1,4 +1,4 @@
1
- from janito.cli.main import main
1
+ from .cli.main import main
2
2
 
3
3
  if __name__ == "__main__":
4
4
  main()
@@ -0,0 +1,139 @@
1
+ from pathlib import Path
2
+ from jinja2 import Template
3
+ import importlib.resources
4
+ import sys
5
+ import warnings
6
+ from janito.tools import get_local_tools_adapter
7
+ from janito.llm.agent import LLMAgent
8
+ from janito.drivers.driver_registry import get_driver_class
9
+ from queue import Queue
10
+ from janito.platform_discovery import PlatformDiscovery
11
+
12
+
13
+ def setup_agent(
14
+ provider_instance,
15
+ llm_driver_config,
16
+ role=None,
17
+ templates_dir=None,
18
+ zero_mode=False,
19
+ input_queue=None,
20
+ output_queue=None,
21
+ verbose_tools=False,
22
+ verbose_agent=False,
23
+ ):
24
+ """
25
+ Creates an agent using a rendered system prompt template, passing an explicit role.
26
+ """
27
+ tools_provider = get_local_tools_adapter()
28
+ tools_provider.set_verbose_tools(verbose_tools)
29
+
30
+ if zero_mode:
31
+ # Pass provider to agent, let agent create driver
32
+ agent = LLMAgent(
33
+ provider_instance,
34
+ tools_provider,
35
+ agent_name=role or "software developer",
36
+ system_prompt=None,
37
+ verbose_agent=verbose_agent,
38
+ )
39
+ return agent
40
+ # Normal flow
41
+ if templates_dir is None:
42
+ # Set default template directory
43
+ templates_dir = Path(__file__).parent / "templates" / "profiles"
44
+ template_path = templates_dir / "system_prompt_template_main.txt.j2"
45
+
46
+ template_content = None
47
+ if template_path.exists():
48
+ with open(template_path, "r", encoding="utf-8") as file:
49
+ template_content = file.read()
50
+ else:
51
+ # Try package import fallback: janito.agent.templates.profiles.system_prompt_template_main.txt.j2
52
+ try:
53
+ with importlib.resources.files("janito.agent.templates.profiles").joinpath(
54
+ "system_prompt_template_main.txt.j2"
55
+ ).open("r", encoding="utf-8") as file:
56
+ template_content = file.read()
57
+ except (FileNotFoundError, ModuleNotFoundError, AttributeError):
58
+ warnings.warn(
59
+ f"[janito] Could not find system_prompt_template_main.txt.j2 in {template_path} nor in janito.agent.templates.profiles package."
60
+ )
61
+ raise FileNotFoundError(
62
+ f"Template file not found in either {template_path} or package resource."
63
+ )
64
+
65
+ template = Template(template_content)
66
+ # Prepare context for Jinja2 rendering from llm_driver_config
67
+ # Compose context for Jinja2 rendering without using to_dict or temperature
68
+ context = {}
69
+ context["role"] = role or "software developer"
70
+ # Inject current platform environment information
71
+ pd = PlatformDiscovery()
72
+ context["platform"] = pd.get_platform_name()
73
+ context["python_version"] = pd.get_python_version()
74
+ context["shell_info"] = pd.detect_shell()
75
+ rendered_prompt = template.render(**context)
76
+ # Create the agent as before, now passing the explicit role
77
+ # Do NOT pass temperature; do not depend on to_dict
78
+ agent = LLMAgent(
79
+ provider_instance,
80
+ tools_provider,
81
+ agent_name=role or "software developer",
82
+ system_prompt=rendered_prompt,
83
+ input_queue=input_queue,
84
+ output_queue=output_queue,
85
+ verbose_agent=verbose_agent,
86
+ )
87
+ agent.template_vars["role"] = context["role"]
88
+ return agent
89
+
90
+
91
+ def create_configured_agent(
92
+ *,
93
+ provider_instance=None,
94
+ llm_driver_config=None,
95
+ role=None,
96
+ verbose_tools=False,
97
+ verbose_agent=False,
98
+ templates_dir=None,
99
+ zero_mode=False,
100
+ ):
101
+ """
102
+ Normalizes agent setup for all CLI modes.
103
+
104
+ Args:
105
+ provider_instance: Provider instance for the agent
106
+ llm_driver_config: LLM driver configuration
107
+ role: Optional role string
108
+ verbose_tools: Optional, default False
109
+ verbose_agent: Optional, default False
110
+ templates_dir: Optional
111
+ zero_mode: Optional, default False
112
+
113
+ Returns:
114
+ Configured agent instance
115
+ """
116
+ # If provider_instance has create_driver, wire queues (single-shot mode)
117
+ input_queue = None
118
+ output_queue = None
119
+ driver = None
120
+ if hasattr(provider_instance, "create_driver"):
121
+ driver = provider_instance.create_driver()
122
+ driver.start() # Ensure the driver background thread is started
123
+ input_queue = getattr(driver, "input_queue", None)
124
+ output_queue = getattr(driver, "output_queue", None)
125
+
126
+ agent = setup_agent(
127
+ provider_instance=provider_instance,
128
+ llm_driver_config=llm_driver_config,
129
+ role=role,
130
+ templates_dir=templates_dir,
131
+ zero_mode=zero_mode,
132
+ input_queue=input_queue,
133
+ output_queue=output_queue,
134
+ verbose_tools=verbose_tools,
135
+ verbose_agent=verbose_agent,
136
+ )
137
+ if driver is not None:
138
+ agent.driver = driver # Attach driver to agent for thread management
139
+ return agent
@@ -3,7 +3,7 @@
3
3
  #}
4
4
  You are: {{ role }}
5
5
 
6
- You will answer following a pattern of: discovery, description, implementation (when a change was request) and validation.
6
+ You will answer following a pattern of: discovery, description, implementation (when a change is requested) and validation.
7
7
 
8
8
  {# Improves tool selection and platform specific constrains, eg, path format, C:\ vs /path #}
9
9
  You will be using the following environment:
@@ -0,0 +1,9 @@
1
+ # janito.cli package
2
+ from .utils import format_tokens, format_generation_time
3
+
4
+ __all__ = [
5
+ "setup_provider",
6
+ "setup_agent",
7
+ "format_tokens",
8
+ "format_generation_time",
9
+ ]
@@ -0,0 +1,37 @@
1
+ """
2
+ Key bindings for Janito Chat CLI.
3
+ """
4
+
5
+ from prompt_toolkit.key_binding import KeyBindings
6
+
7
+
8
+ class KeyBindingsFactory:
9
+ @staticmethod
10
+ def create():
11
+ bindings = KeyBindings()
12
+
13
+ @bindings.add("c-y")
14
+ def _(event):
15
+ buf = event.app.current_buffer
16
+ buf.text = "Yes"
17
+ buf.validate_and_handle()
18
+
19
+ @bindings.add("c-n")
20
+ def _(event):
21
+ buf = event.app.current_buffer
22
+ buf.text = "No"
23
+ buf.validate_and_handle()
24
+
25
+ @bindings.add("f1")
26
+ def _(event):
27
+ buf = event.app.current_buffer
28
+ buf.text = "/restart"
29
+ buf.validate_and_handle()
30
+
31
+ @bindings.add("f12")
32
+ def _(event):
33
+ buf = event.app.current_buffer
34
+ buf.text = "Do It"
35
+ buf.validate_and_handle()
36
+
37
+ return bindings