janito 2.3.0__py3-none-any.whl → 2.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.
Files changed (150) hide show
  1. janito/__init__.py +6 -6
  2. janito/_version.py +57 -0
  3. janito/agent/setup_agent.py +92 -18
  4. janito/agent/templates/profiles/system_prompt_template_developer.txt.j2 +44 -0
  5. janito/cli/chat_mode/bindings.py +21 -2
  6. janito/cli/chat_mode/chat_entry.py +2 -3
  7. janito/cli/chat_mode/prompt_style.py +5 -0
  8. janito/cli/chat_mode/session.py +80 -94
  9. janito/cli/chat_mode/session_profile_select.py +80 -0
  10. janito/cli/chat_mode/shell/autocomplete.py +21 -21
  11. janito/cli/chat_mode/shell/commands/__init__.py +13 -7
  12. janito/cli/chat_mode/shell/commands/_priv_check.py +5 -0
  13. janito/cli/chat_mode/shell/commands/clear.py +12 -12
  14. janito/cli/chat_mode/shell/commands/conversation_restart.py +30 -0
  15. janito/cli/chat_mode/shell/commands/execute.py +42 -0
  16. janito/cli/chat_mode/shell/commands/help.py +6 -3
  17. janito/cli/chat_mode/shell/commands/model.py +28 -0
  18. janito/cli/chat_mode/shell/commands/multi.py +51 -51
  19. janito/cli/chat_mode/shell/commands/read.py +37 -0
  20. janito/cli/chat_mode/shell/commands/tools.py +45 -18
  21. janito/cli/chat_mode/shell/commands/write.py +37 -0
  22. janito/cli/chat_mode/shell/commands.bak.zip +0 -0
  23. janito/cli/chat_mode/shell/input_history.py +62 -62
  24. janito/cli/chat_mode/shell/session.bak.zip +0 -0
  25. janito/cli/chat_mode/toolbar.py +44 -27
  26. janito/cli/cli_commands/list_models.py +35 -35
  27. janito/cli/cli_commands/list_providers.py +9 -9
  28. janito/cli/cli_commands/list_tools.py +86 -53
  29. janito/cli/cli_commands/model_selection.py +50 -50
  30. janito/cli/cli_commands/set_api_key.py +19 -19
  31. janito/cli/cli_commands/show_config.py +51 -51
  32. janito/cli/cli_commands/show_system_prompt.py +105 -62
  33. janito/cli/config.py +5 -6
  34. janito/cli/core/__init__.py +4 -4
  35. janito/cli/core/event_logger.py +59 -59
  36. janito/cli/core/runner.py +25 -18
  37. janito/cli/core/setters.py +10 -1
  38. janito/cli/core/unsetters.py +54 -54
  39. janito/cli/main_cli.py +28 -5
  40. janito/cli/prompt_core.py +18 -2
  41. janito/cli/prompt_setup.py +56 -0
  42. janito/cli/single_shot_mode/__init__.py +6 -6
  43. janito/cli/single_shot_mode/handler.py +14 -73
  44. janito/cli/verbose_output.py +1 -1
  45. janito/config.py +5 -5
  46. janito/config_manager.py +13 -0
  47. janito/drivers/anthropic/driver.py +113 -113
  48. janito/drivers/dashscope.bak.zip +0 -0
  49. janito/drivers/openai/README.md +20 -0
  50. janito/drivers/openai_responses.bak.zip +0 -0
  51. janito/event_bus/event.py +2 -2
  52. janito/formatting_token.py +54 -54
  53. janito/i18n/__init__.py +35 -35
  54. janito/i18n/messages.py +23 -23
  55. janito/i18n/pt.py +46 -47
  56. janito/llm/README.md +23 -0
  57. janito/llm/__init__.py +5 -5
  58. janito/llm/agent.py +507 -443
  59. janito/llm/driver.py +8 -0
  60. janito/llm/driver_config_builder.py +34 -34
  61. janito/llm/driver_input.py +12 -12
  62. janito/llm/message_parts.py +60 -60
  63. janito/llm/model.py +38 -38
  64. janito/llm/provider.py +196 -196
  65. janito/provider_registry.py +8 -6
  66. janito/providers/anthropic/model_info.py +22 -22
  67. janito/providers/anthropic/provider.py +2 -0
  68. janito/providers/azure_openai/provider.py +3 -0
  69. janito/providers/dashscope.bak.zip +0 -0
  70. janito/providers/deepseek/__init__.py +1 -1
  71. janito/providers/deepseek/model_info.py +16 -16
  72. janito/providers/deepseek/provider.py +94 -91
  73. janito/providers/google/provider.py +3 -0
  74. janito/providers/mistralai/provider.py +3 -0
  75. janito/providers/openai/provider.py +4 -0
  76. janito/providers/registry.py +26 -26
  77. janito/shell.bak.zip +0 -0
  78. janito/tools/DOCSTRING_STANDARD.txt +33 -0
  79. janito/tools/README.md +3 -0
  80. janito/tools/__init__.py +20 -6
  81. janito/tools/adapters/__init__.py +1 -1
  82. janito/tools/adapters/local/__init__.py +65 -62
  83. janito/tools/adapters/local/adapter.py +18 -35
  84. janito/tools/adapters/local/ask_user.py +101 -102
  85. janito/tools/adapters/local/copy_file.py +84 -84
  86. janito/tools/adapters/local/create_directory.py +69 -69
  87. janito/tools/adapters/local/create_file.py +82 -82
  88. janito/tools/adapters/local/delete_text_in_file.py +2 -2
  89. janito/tools/adapters/local/fetch_url.py +97 -97
  90. janito/tools/adapters/local/find_files.py +139 -138
  91. janito/tools/adapters/local/get_file_outline/__init__.py +1 -1
  92. janito/tools/adapters/local/get_file_outline/core.py +117 -117
  93. janito/tools/adapters/local/get_file_outline/java_outline.py +40 -40
  94. janito/tools/adapters/local/get_file_outline/markdown_outline.py +14 -14
  95. janito/tools/adapters/local/get_file_outline/python_outline.py +303 -303
  96. janito/tools/adapters/local/get_file_outline/python_outline_v2.py +156 -156
  97. janito/tools/adapters/local/get_file_outline/search_outline.py +33 -33
  98. janito/tools/adapters/local/move_file.py +2 -2
  99. janito/tools/adapters/local/open_html_in_browser.py +2 -1
  100. janito/tools/adapters/local/open_url.py +2 -2
  101. janito/tools/adapters/local/python_code_run.py +166 -166
  102. janito/tools/adapters/local/python_command_run.py +164 -164
  103. janito/tools/adapters/local/python_file_run.py +163 -163
  104. janito/tools/adapters/local/remove_directory.py +2 -2
  105. janito/tools/adapters/local/remove_file.py +2 -2
  106. janito/tools/adapters/local/replace_text_in_file.py +2 -2
  107. janito/tools/adapters/local/run_bash_command.py +176 -176
  108. janito/tools/adapters/local/run_powershell_command.py +219 -219
  109. janito/tools/adapters/local/search_text/__init__.py +1 -1
  110. janito/tools/adapters/local/search_text/core.py +201 -201
  111. janito/tools/adapters/local/search_text/pattern_utils.py +73 -73
  112. janito/tools/adapters/local/search_text/traverse_directory.py +145 -145
  113. janito/tools/adapters/local/validate_file_syntax/__init__.py +1 -1
  114. janito/tools/adapters/local/validate_file_syntax/core.py +106 -106
  115. janito/tools/adapters/local/validate_file_syntax/css_validator.py +35 -35
  116. janito/tools/adapters/local/validate_file_syntax/html_validator.py +93 -93
  117. janito/tools/adapters/local/validate_file_syntax/js_validator.py +27 -27
  118. janito/tools/adapters/local/validate_file_syntax/json_validator.py +6 -6
  119. janito/tools/adapters/local/validate_file_syntax/markdown_validator.py +109 -109
  120. janito/tools/adapters/local/validate_file_syntax/ps1_validator.py +32 -32
  121. janito/tools/adapters/local/validate_file_syntax/python_validator.py +5 -5
  122. janito/tools/adapters/local/validate_file_syntax/xml_validator.py +11 -11
  123. janito/tools/adapters/local/validate_file_syntax/yaml_validator.py +6 -6
  124. janito/tools/adapters/local/view_file.py +168 -167
  125. janito/tools/inspect_registry.py +17 -17
  126. janito/tools/outline_file.bak.zip +0 -0
  127. janito/tools/permissions.py +45 -0
  128. janito/tools/permissions_parse.py +12 -0
  129. janito/tools/tool_base.py +118 -105
  130. janito/tools/tool_events.py +58 -58
  131. janito/tools/tool_run_exception.py +12 -12
  132. janito/tools/tool_use_tracker.py +81 -81
  133. janito/tools/tool_utils.py +43 -45
  134. janito/tools/tools_adapter.py +25 -20
  135. janito/tools/tools_schema.py +104 -104
  136. {janito-2.3.0.dist-info → janito-2.4.0.dist-info}/METADATA +425 -388
  137. janito-2.4.0.dist-info/RECORD +195 -0
  138. janito/agent/templates/profiles/system_prompt_template_base_pt.txt.j2 +0 -13
  139. janito/agent/templates/profiles/system_prompt_template_main.txt.j2 +0 -37
  140. janito/cli/chat_mode/shell/commands/edit.py +0 -25
  141. janito/cli/chat_mode/shell/commands/exec.py +0 -27
  142. janito/cli/chat_mode/shell/commands/termweb_log.py +0 -92
  143. janito/cli/termweb_starter.py +0 -122
  144. janito/termweb/app.py +0 -95
  145. janito/version.py +0 -4
  146. janito-2.3.0.dist-info/RECORD +0 -181
  147. {janito-2.3.0.dist-info → janito-2.4.0.dist-info}/WHEEL +0 -0
  148. {janito-2.3.0.dist-info → janito-2.4.0.dist-info}/entry_points.txt +0 -0
  149. {janito-2.3.0.dist-info → janito-2.4.0.dist-info}/licenses/LICENSE +0 -0
  150. {janito-2.3.0.dist-info → janito-2.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,195 @@
1
+ janito/__init__.py,sha256=a0pFui3A_AfWJiUfg93yE-Vf4868bqG3y9yg2fkTIuY,244
2
+ janito/__main__.py,sha256=lPQ8kAyYfyeS1KopmJ8EVY5g1YswlIqCS615mM_B_rM,70
3
+ janito/_version.py,sha256=B8if-CpKuIYGJzuNPxoHx7PGvRa7vKzGgvOzOdn-F5I,2348
4
+ janito/config.py,sha256=HJh0CmZEx7AbMQOmFkiYHFNzc-fO7fqpZ9rh6RenxK8,201
5
+ janito/config_manager.py,sha256=-v28Rybh0KUXU8dZF-ozqHWXn7djAyYxSrJEwXOC7TQ,5047
6
+ janito/conversation_history.py,sha256=GqqEJElTVONzOMRe-9g25WCMcDi0PF7DOnqGWLTrY_8,897
7
+ janito/dir_walk_utils.py,sha256=ON9EyVH7Aaik8WtCH5z8DQis9ycdoNVkjNvU16HH498,1193
8
+ janito/driver_events.py,sha256=51ab7KW_W6fVZVeO0ez-HJFY4NbTI327ZlEmEsEkxQc,3405
9
+ janito/exceptions.py,sha256=l4AepRdWwAuLp5fUygrBBgO9rpwgfV6JvY1afOdq2pw,913
10
+ janito/formatting.py,sha256=SMvOmL6bst3KGcI7OLa5D4DE127fQYuHZS3oY8OPsn8,2031
11
+ janito/formatting_token.py,sha256=J810eUoXhtM73fIAkgAcl_oN2WhdUs6A06lDX75mnmg,1965
12
+ janito/gitignore_utils.py,sha256=P3iF9fMWAomqULq2xsoqHtI9uNIFSPcagljrxZshmLw,4110
13
+ janito/perf_singleton.py,sha256=g1h0Sdf4ydzegeEpJlMhQt4H0GQZ2hryXrdYOTL-b30,113
14
+ janito/performance_collector.py,sha256=RYu4av16Trj3RljJZ8-2Gbn1KlGdJUosrcVFYtwviNI,6285
15
+ janito/platform_discovery.py,sha256=JN3kC7hkxdvuj-AyrJTlbbDJjtNHke3fdlZDqGi_uz0,4621
16
+ janito/provider_config.py,sha256=acn2FEgWsEIyi2AxZiuCLoP2rXDd-nXcP5VB4CZHaeE,3189
17
+ janito/provider_registry.py,sha256=FjsrOXzuUFQZdJ6qK69Z365-iqIFeffLoObCGHQqv7A,7840
18
+ janito/report_events.py,sha256=q4OR_jTZNfcqaQF_fzTjgqo6_VlUIxSGWfhpT4nJWcw,938
19
+ janito/shell.bak.zip,sha256=hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU,22
20
+ janito/utils.py,sha256=eXSsMgM69YyzahgCNrJQLcEbB8ssLI1MQqaa20ONxbE,376
21
+ janito/agent/setup_agent.py,sha256=7oKIE-ieKSimLARL8xHwAvrKWhvaoaQuZtouYPrCk6k,8632
22
+ janito/agent/templates/profiles/system_prompt_template_developer.txt.j2,sha256=gIXF3dPgGxQnVqRBnT8r2sUGu7F_Sl0F4YF-TfyOKgI,2586
23
+ janito/cli/__init__.py,sha256=xaPDOrWphBbCR63Xpcx_yfpXSJIlCaaICc4j2qpWqrM,194
24
+ janito/cli/config.py,sha256=t7sdM0I3RD_FZ2ni1xuGMFGzvCLMt3NwJKu3_WtxPUg,1068
25
+ janito/cli/console.py,sha256=gJolqzWL7jEPLxeuH-CwBDRFpXt976KdZOEAB2tdBDs,64
26
+ janito/cli/main.py,sha256=s5odou0txf8pzTf1ADk2yV7T5m8B6cejJ81e7iu776U,312
27
+ janito/cli/main_cli.py,sha256=aZZjuqJbhDE0bxi1y4kfDOT5V8Z57TP8YqqdJGOlQ7k,11624
28
+ janito/cli/prompt_core.py,sha256=IAa1X4fw4aPASFyOXGiFcpgiZXlVoFQM617F0mHMxsE,11587
29
+ janito/cli/prompt_handler.py,sha256=SnPTlL64noeAMGlI08VBDD5IDD8jlVMIYA4-fS8zVLg,215
30
+ janito/cli/prompt_setup.py,sha256=_2VaUtK67rk9QnvLGmdRJ31m244-Vf-WQazJtp9PzeE,1935
31
+ janito/cli/rich_terminal_reporter.py,sha256=LCUGojAGlvs2SOHs7_qFz8AbAGJW5cyLQhte4OXHIR4,4981
32
+ janito/cli/utils.py,sha256=plCQiDKIf3V8mFhhX5H9-MF2W86i-xRdWf8Xi117Z0w,677
33
+ janito/cli/verbose_output.py,sha256=UmB1byT1V6wZvMJDIPfqajhmNcMnnJ3tgYocje5w0x8,7620
34
+ janito/cli/chat_mode/bindings.py,sha256=u8q8SekKyAFncoPI5mxeAQ2lI3loIEaUVyq2TqELv2c,1990
35
+ janito/cli/chat_mode/chat_entry.py,sha256=HjflAjGOz4xyRbzocsEzrjcVepfQYz3d9fzyZDMBB34,477
36
+ janito/cli/chat_mode/prompt_style.py,sha256=Yltxc9unsiWsJzfditE139iqL3S64d6G19LzrnqYvFg,825
37
+ janito/cli/chat_mode/session.py,sha256=monPEAFbDeS_p_DM4ml_GQvz2JfipqNgU0T3MFJSGy0,11309
38
+ janito/cli/chat_mode/session_profile_select.py,sha256=epKwAM_DlL_4LA940_zqmTy0BvIyheCdD_Zab-lRg9I,2913
39
+ janito/cli/chat_mode/toolbar.py,sha256=QWIVAdm31vNKu0UO_-igxYwVwtko-KzjtxPtK3DYH5Y,4891
40
+ janito/cli/chat_mode/shell/autocomplete.py,sha256=lE68MaVaodbA2VfUM0_YLqQVLBJAE_BJsd5cMtwuD-g,793
41
+ janito/cli/chat_mode/shell/commands.bak.zip,sha256=I7GFjXg2ORT5NzFpicH1vQ3kchhduQsZinzqo0xO8wU,74238
42
+ janito/cli/chat_mode/shell/input_history.py,sha256=mdcu8XNPp1ewVQMTEmqoAdgj1Lsig5cKkUfvFVxShYo,2537
43
+ janito/cli/chat_mode/shell/session.bak.zip,sha256=m1GyO3Wy4G4D9sVgRO6ZDyC0VjclsmnEJsiQoer4LzI,5789
44
+ janito/cli/chat_mode/shell/commands/__init__.py,sha256=Mi5srIBhIaLwjqKSb76bDTXiodtJqsjTNzptSm2Pt2Y,2278
45
+ janito/cli/chat_mode/shell/commands/_priv_check.py,sha256=LfIa_IbJBIhKT17K2cACbfYEJprFUH-o4BPvNnGyPSE,204
46
+ janito/cli/chat_mode/shell/commands/base.py,sha256=I6-SVOcRd7q4PpoutLdrbhbqeUpJic2oyPhOSMgMihA,288
47
+ janito/cli/chat_mode/shell/commands/clear.py,sha256=wYEHGYcAohUoCJlbEhiXKfDbJvuzAVK4e9uirskIllw,422
48
+ janito/cli/chat_mode/shell/commands/conversation_restart.py,sha256=klT_TtbsyJXOANAoc93_yg4ZxmHJjtdw5dH-ONrttPw,4710
49
+ janito/cli/chat_mode/shell/commands/execute.py,sha256=OS7RHl2JS-tFOA9-YAvWEYnb7HvAKOFOr7MHagV6imM,2190
50
+ janito/cli/chat_mode/shell/commands/help.py,sha256=EaA9Dm8L6ilGMrgfqa0va0FaoOG8FIlX6sNhbgVKeik,938
51
+ janito/cli/chat_mode/shell/commands/history_view.py,sha256=9dyxYpDHjT77LEIikjBQA03Ep3P2AmKXUwUnVsG0OQc,3584
52
+ janito/cli/chat_mode/shell/commands/lang.py,sha256=uIelDs3gPYDZ9X9gw7iDMmiwefT7TiBo32420pq2tW8,837
53
+ janito/cli/chat_mode/shell/commands/livelogs.py,sha256=uJI14qyubXEz8m0Cajd-vURPYxC__7p_CNCq6PVOHN0,2142
54
+ janito/cli/chat_mode/shell/commands/model.py,sha256=2tORoA5vdkAknbS9mnMi03gNKcLEkgmIuHPUHDGWxYo,1390
55
+ janito/cli/chat_mode/shell/commands/multi.py,sha256=HAAk0fAO3n8KFta3I4hT_scOAlz4SxWDyaNBUJBQ4nc,1985
56
+ janito/cli/chat_mode/shell/commands/prompt.py,sha256=x9S3mOpplpR5aiy5b8LSIsZEEFGenQtPGK6HxYdwx1Y,2448
57
+ janito/cli/chat_mode/shell/commands/read.py,sha256=AFdkfFWasoUQ8icvHROVEExyCip-sGPLumoUXNkqIFY,1972
58
+ janito/cli/chat_mode/shell/commands/role.py,sha256=7A2S2wzE6lcv1rg4iLGH8vVy-TnzRE0Tn_wPRhBHLpY,1474
59
+ janito/cli/chat_mode/shell/commands/session.py,sha256=9wsw5U24-KJgTT70KAwnGuS8MVPyvpxCJfAt_Io76O0,1574
60
+ janito/cli/chat_mode/shell/commands/session_control.py,sha256=tmMGJ8IvWoBwSIJu7T6GPnFYFrmXWIG2Gr9tTni4y3U,1307
61
+ janito/cli/chat_mode/shell/commands/tools.py,sha256=G7tqjfkjXmTkMFIf6kHOhvYVq66LMPhGQdRyjpZO-xg,3190
62
+ janito/cli/chat_mode/shell/commands/utility.py,sha256=K982P-UwgPLzpEvSuSBGwiQ3zC34S_6T2ork_djweQw,847
63
+ janito/cli/chat_mode/shell/commands/verbose.py,sha256=HDTe0NhdcjBuhh-eJSW8iLPDeeBO95K5iSDAMAljxa4,953
64
+ janito/cli/chat_mode/shell/commands/write.py,sha256=kst0CBxR7UQurAjpx1junYwjm2bWsGVfSK80kJXAm54,1982
65
+ janito/cli/chat_mode/shell/session/__init__.py,sha256=uTYE_QpZFEn7v9QE5o1LdulpCWa9vmk0OsefbBGWg_c,37
66
+ janito/cli/chat_mode/shell/session/history.py,sha256=tYav6GgjAZkvWhlI_rfG6OArNqW6Wn2DTv39Hb20QYc,1262
67
+ janito/cli/chat_mode/shell/session/manager.py,sha256=SL9BCdlCPdoo-5BPAIC1eaJuXv7hH4d5VGqMF6T7MEI,3333
68
+ janito/cli/cli_commands/list_models.py,sha256=VN7_DG6aTxaHPrc6_H-OftRXRT1urhf5ze_qJ_SO35U,1116
69
+ janito/cli/cli_commands/list_providers.py,sha256=AMAVdoS7KN7WA3gaKhZZdfio_zvknu21OLDc6CTFZ34,173
70
+ janito/cli/cli_commands/list_tools.py,sha256=b-OG-lVV4B99bBc05qOrac3qoK8qDJJWGGLHAxsRwvo,4060
71
+ janito/cli/cli_commands/model_selection.py,sha256=ANWtwC5glZkGMdaNtARDbEG3QmuBUcDLVxzzC5jeBNo,1643
72
+ janito/cli/cli_commands/model_utils.py,sha256=ZGIExsv7WMHL_pqh4yeUXIfFGlu0vZE08PF0bCIIIK4,2864
73
+ janito/cli/cli_commands/set_api_key.py,sha256=iPtWPhS5VeyIlwVX43TGg7OYUwXCcGzugvwoa3KB8A8,605
74
+ janito/cli/cli_commands/show_config.py,sha256=6j4P2mK1Q7KZGPF9EXV3ascuWRQtpbgAQgRAnNszBJI,2024
75
+ janito/cli/cli_commands/show_system_prompt.py,sha256=fbFWKWiIuI-UmYy39oHSZE3LBtyDeOaJM-vXHDsgr3I,4604
76
+ janito/cli/core/__init__.py,sha256=YH95fhgY9yBX8RgqX9dSrEkl4exjV0T4rbmJ6xUpG-Y,196
77
+ janito/cli/core/event_logger.py,sha256=1X6lR0Ax7AgF8HlPWFoY5Ystuu7Bh4ooTo78vXzeGB0,2008
78
+ janito/cli/core/getters.py,sha256=Znw6aF6QUHGu6UWqQHQYu7LvNPPIjOO4SD4yyYaIGnw,1467
79
+ janito/cli/core/runner.py,sha256=4n2T_9viKqP5uMe5maYKmYXHs88L8hqvvNsZjGBR21E,7198
80
+ janito/cli/core/setters.py,sha256=S3PxWPh0s7DAhbNyNRspbjtbd5EdAR-JNRe6X4jjIjE,7438
81
+ janito/cli/core/unsetters.py,sha256=FEw9gCt0vRvoCt0kRSNfVB2tzi_TqppJIx2nHPP59-k,2012
82
+ janito/cli/single_shot_mode/__init__.py,sha256=Ct99pKe9tINzVW6oedZJfzfZQKWpXz-weSSCn0hrwHY,115
83
+ janito/cli/single_shot_mode/handler.py,sha256=z8sL3CMRbncXLjdaPUYLq7dsV3t0nyh1mm4kXQf5Mdg,3475
84
+ janito/drivers/dashscope.bak.zip,sha256=9Pv4Xyciju8jO1lEMFVgYXexoZkxmDO3Ig6vw3ODfL8,4936
85
+ janito/drivers/driver_registry.py,sha256=c_nezPfjPHaAZjCZhU80JN_YRCKYBJhomQNYZCu-Ug4,1007
86
+ janito/drivers/openai_responses.bak.zip,sha256=E43eDCHGa2tCtdjzj_pMnWDdnsOZzj8BJTR5tJp8wcM,13352
87
+ janito/drivers/anthropic/driver.py,sha256=4yLaf2T0g2zr-MSwXOx32s7ETut9FOl0uXyJGYiJzZU,3937
88
+ janito/drivers/azure_openai/driver.py,sha256=zQc9xH-RD409okDCfTRwb1QXXb9WzR2bsBfRyrZ5HYc,3936
89
+ janito/drivers/mistralai/driver.py,sha256=r7iMMAG5V7OmzrtQhVCuK3ueAEzgbgS1qcPDKHTNKoo,1208
90
+ janito/drivers/openai/README.md,sha256=bgPdaYX0pyotCoJ9t3cJbYM-teQ_YM1DAFEKLCMP32Q,666
91
+ janito/drivers/openai/driver.py,sha256=50Ic_w6HR7xqp2rZ9RYM4Ylbhn4MKAuhyRNTHYozhVQ,21812
92
+ janito/event_bus/__init__.py,sha256=VG6GOhKMBh0O_92D-zW8a3YitJPKDajGgPiFezTXlNE,77
93
+ janito/event_bus/bus.py,sha256=LokZbAdwcWhWOyKSp7H3Ism57x4EZhxlRPjl3NE4UKU,2847
94
+ janito/event_bus/event.py,sha256=MtgcBPD7cvCuubiLIyo-BWcsNSO-941HLk6bScHTJtQ,427
95
+ janito/event_bus/handler.py,sha256=RhBtT1E48VEM2-k8u3HYsESw7VX5qAgiB8ZTJeKXhHc,1322
96
+ janito/event_bus/queue_bus.py,sha256=l4phun3pxXxi8ZlIq8ChYaiYDVO1PZeXoOzyi3vyu20,1558
97
+ janito/i18n/__init__.py,sha256=6zCIu6pSQpoMJvIRK9oOD3pkzbNeJik3lFDXse0X6ag,994
98
+ janito/i18n/messages.py,sha256=fBuwOTFoygyHPkYphm6Y0r1iE8497Z4iryVAmPhMEkg,1851
99
+ janito/i18n/pt.py,sha256=NlTgpDSftUfFG7FGbs7TK54vQlJVMyaZDHGcWjelwMc,4168
100
+ janito/llm/README.md,sha256=6GRqCu_a9va5HCB1YqNqbshyWKFyAGlnXugrjom-xj8,1213
101
+ janito/llm/__init__.py,sha256=dpyVH51qVRCw-PDyAFLAxq0zd4jl5MDcuV6Cri0D-dQ,134
102
+ janito/llm/agent.py,sha256=mHQhKspA1WH0xLLQwqbqUNlISiOhF60gufVkr6p6m5c,21254
103
+ janito/llm/auth.py,sha256=8Dl_orUEPhn2X6XjkO2Nr-j1HFT2YDxk1qJl9hSFI88,2286
104
+ janito/llm/driver.py,sha256=mepQ00QK0ouK8LHz4blQctUTolzlDatXNWWQEmSdpO8,10037
105
+ janito/llm/driver_config.py,sha256=OW0ae49EfgKDqaThuDjZBiaN78voNzwiZ6szERMqJos,1406
106
+ janito/llm/driver_config_builder.py,sha256=BvWGx7vaBR5NyvPY1XNAP3lAgo1uf-T25CSsIo2kkCU,1401
107
+ janito/llm/driver_input.py,sha256=Zq7IO4KdQPUraeIo6XoOaRy1IdQAyYY15RQw4JU30uA,389
108
+ janito/llm/message_parts.py,sha256=QY_0kDjaxdoErDgKPRPv1dNkkYJuXIBmHWNLiOEKAH4,1365
109
+ janito/llm/model.py,sha256=42hjcffZDTuzjAJoVhDcDqwIXm6rUmmi5UwTOYopf5w,1131
110
+ janito/llm/provider.py,sha256=lfIJnh06F0kf8--Pg_W7ALhkbIzn7N4iItQ93pntyuM,7978
111
+ janito/providers/__init__.py,sha256=Q9zTiZlDuAsdI6y4tAcqLlZ6LCKyRaOsoQ2iBAGq0O4,367
112
+ janito/providers/dashscope.bak.zip,sha256=BwXxRmZreEivvRtmqbr5BR62IFVlNjAf4y6DrF2BVJo,5998
113
+ janito/providers/provider_static_info.py,sha256=Lwbcb-AOEmo9v5Ma4SqM51uSXGwWYFewMJSDl1rOd8M,568
114
+ janito/providers/registry.py,sha256=Ygwv9eVrTXOKhv0EKxSWQXO5WMHvajWE2Q_Lc3p7dKo,730
115
+ janito/providers/anthropic/model_info.py,sha256=saofXNs73WhlAhm58AcIkSem7C8FMUgHP19BvkoLV5Y,641
116
+ janito/providers/anthropic/provider.py,sha256=JW7PSGf7RNQWDMpf55DnnfP1oWU3d98koaz4AHjWtrQ,2509
117
+ janito/providers/azure_openai/model_info.py,sha256=TMSqEpQROIIYUGAyulYJ5xGhj7CbLoaKL_JXeLbXaG0,689
118
+ janito/providers/azure_openai/provider.py,sha256=7RtYYjKa4HYi11XSiB4QQI2czzvpQ2btOWn7i-sHS8g,5154
119
+ janito/providers/deepseek/__init__.py,sha256=4sISEpq4bJO29vxFK9cfnO-SRUmKoD7oSdeCvz0hVno,36
120
+ janito/providers/deepseek/model_info.py,sha256=tAlFRtWiyNF_MKZ1gy5_-VNlvqoIwAinv6bAv9dNFsc,465
121
+ janito/providers/deepseek/provider.py,sha256=5ehIyOOVn7x4kEeU9m8adxSAda9kHHHv3vM44R1MVJ8,3881
122
+ janito/providers/google/__init__.py,sha256=hE3OGJvLEhvNLhIK_XmCGIdrIj8MKlyGgdOLJ4mdess,38
123
+ janito/providers/google/model_info.py,sha256=Yt6UffgCmPDvXzegmzy2FVo7pNblwUOl7oC6bSRYOaI,1106
124
+ janito/providers/google/provider.py,sha256=Qgt8ZcgPl5fQIFplazoGZkqbUjr-JILKs9FtPBmqUkQ,3337
125
+ janito/providers/mistralai/model_info.py,sha256=Kh0S_3O76fcPGYW-ywmsF4Hhd8011wLpORPLRu3zdlQ,1026
126
+ janito/providers/mistralai/provider.py,sha256=H7_SHPFq6mAlqG7RmtrOs9kjMfJ78WB336nwyKeug3c,2763
127
+ janito/providers/openai/__init__.py,sha256=f0m16-sIqScjL9Mp4A0CQBZx6H3PTEy0cnE08jeaB5U,38
128
+ janito/providers/openai/model_info.py,sha256=cz08O26Ychm-aP3T8guJRqpR96Im9Cwtgl2iMgM7tJs,3384
129
+ janito/providers/openai/provider.py,sha256=5jYdakoWywkeIzFk-LxjRhsLONRjLQ8fMYiP6lyZpJo,4809
130
+ janito/providers/openai/schema_generator.py,sha256=hTqeLcPTR8jeKn5DUUpo7b-EZ-V-g1WwXiX7MbHnFzE,2234
131
+ janito/tools/DOCSTRING_STANDARD.txt,sha256=VLPwNgjxRVD_xZSSVvUZ4H-4bBwM-VKh_RyfzYQsYSs,1735
132
+ janito/tools/README.md,sha256=5HkLpF5k4PENJER7SlDPRXj0yo9mpHvAHW4uuzhq4ak,115
133
+ janito/tools/__init__.py,sha256=-hiAfmntq3uVgvLip8hwvsVifj8JoLlmIds4xVt43PM,1167
134
+ janito/tools/inspect_registry.py,sha256=Jo7PrMPRKLuR-j_mBAk9PBcTzeJf1eQrS1ChGofgQk0,538
135
+ janito/tools/outline_file.bak.zip,sha256=EeI2cBXCwTdWVgJDNiroxKeYlkjwo6NLKeXz3J-2iZI,15607
136
+ janito/tools/permissions.py,sha256=8lsfT7L6pyuvjZAgIXX5WrZZYSjZXPWUBpW7LXDBJ6M,1496
137
+ janito/tools/permissions_parse.py,sha256=OY_Uojjg_QCp6UsfVk5iHhrKRbeFgzfm8UUIoYDe18I,382
138
+ janito/tools/tool_base.py,sha256=v5xUQqI9SzkwPrjAjbFgXIxSAHLC8eZOBIAaQMJBsqI,3962
139
+ janito/tools/tool_events.py,sha256=czRtC2TYakAySBZvfHS_Q6_NY_7_krxzAzAL1ggRFWA,1527
140
+ janito/tools/tool_run_exception.py,sha256=43yWgTaGBGEtRteo6FvTrane6fEVGo9FU1uOdjMRWJE,525
141
+ janito/tools/tool_use_tracker.py,sha256=koXi1h-si8IpRFUdMaj6h6buxeYsuEDC4geP_f2xPms,2805
142
+ janito/tools/tool_utils.py,sha256=37jCQe3TuXoiI0411-vBg_CgK-p1Wl4pTTGhLfVXbZY,1223
143
+ janito/tools/tools_adapter.py,sha256=aIRZ0XfU398ee3Xj2kvaYgPx3a78MA4lQwtREspN5WY,11795
144
+ janito/tools/tools_schema.py,sha256=rGrKrmpPNR07VXHAJ_haGBRRO-YGLOF51BlYRep9AAQ,4415
145
+ janito/tools/adapters/__init__.py,sha256=XKixOKtUJs1R-rGwGDXSLVLg5-Kp090gvWbsseWT4LI,92
146
+ janito/tools/adapters/local/__init__.py,sha256=e9z4otmv5PPJQtMpXjIravXUAHPsQxL3nH4DTlDAi30,2126
147
+ janito/tools/adapters/local/adapter.py,sha256=YJGXtie8GemmlQbVfB-DX8v-Z8U92DvXJZNYQrSQPVE,3909
148
+ janito/tools/adapters/local/ask_user.py,sha256=9aR7gwRdrSQGXR8mvuo5x_8SKNk2Ep7GwUDv3latyac,3598
149
+ janito/tools/adapters/local/copy_file.py,sha256=I2GAMxy55w-fZwNUde_paUD2kof7Szgk9uNoDOW_TDA,3580
150
+ janito/tools/adapters/local/create_directory.py,sha256=cLWz_o8TIkcXTD9rE_kRsXTkyeFvTjo0uXBHdoXMqMk,2613
151
+ janito/tools/adapters/local/create_file.py,sha256=wVxe3TJ__j_FLSbtokoq21U22hXrOIty1pIIe5-CtXM,3525
152
+ janito/tools/adapters/local/delete_text_in_file.py,sha256=nt2P7cStgzbjlKcYAVlNR1B4KNJJhHoGBMekPbXKKT8,5174
153
+ janito/tools/adapters/local/fetch_url.py,sha256=1nVM1DWPS7FKV20CwtzyyJF8tFupSZ6rV-xjHtLd2co,3867
154
+ janito/tools/adapters/local/find_files.py,sha256=em748_QiwdyT5pF1Bu0VGZQ_khTv3Mv7Maxp4lRK0vI,6027
155
+ janito/tools/adapters/local/move_file.py,sha256=FktO0bvk9OsztVM1BnR-1Q3rbDbhEezDsPOzzpADNaI,4614
156
+ janito/tools/adapters/local/open_html_in_browser.py,sha256=Xf37F12eQVScZa8AbX00-sxWVX5a14baSR6TxfcZuiI,1988
157
+ janito/tools/adapters/local/open_url.py,sha256=FOLxRu-41oq_1PG6hPn3-aX-ZbobVlofCHbtq5XuXoo,1400
158
+ janito/tools/adapters/local/python_code_run.py,sha256=R_Pmq2iU9C5teUigtT8n8ImutGMAzzSGF1-Hd26HyTQ,6679
159
+ janito/tools/adapters/local/python_command_run.py,sha256=Guk68Z1N_T_8N4GavPYxJsX0431P05iMfDPtqH3eCZM,6619
160
+ janito/tools/adapters/local/python_file_run.py,sha256=nILHer_kRuulBTBtWTN_yiNTeCpYalpDKpKlHbs78cU,6494
161
+ janito/tools/adapters/local/remove_directory.py,sha256=jlGKKhR9sWDLD7MYO3P6kl9rZhlhq6kcZ_mn8UPvTOk,1853
162
+ janito/tools/adapters/local/remove_file.py,sha256=4f20Fq5hMEVRWLc50TpL_eGWU5a4jMYw5oNSXjOKIBc,2113
163
+ janito/tools/adapters/local/replace_text_in_file.py,sha256=NcsJy9a9yFLtVYJmBXP2iq5bsxvMyz4LWYLa55ikxJo,10887
164
+ janito/tools/adapters/local/run_bash_command.py,sha256=5ZUxWoeB2__Q_05juaMbD6mT-PTs1LnVYlkM-_fr6cQ,7620
165
+ janito/tools/adapters/local/run_powershell_command.py,sha256=Kt2mHFdrMAPzB7mSydGB1IAXHSYMrn2oWtDecuACc3k,9258
166
+ janito/tools/adapters/local/view_file.py,sha256=9wXgAgTJf7rGzmMfPFSMmHoX32JBgseYNHEe963KQB8,7197
167
+ janito/tools/adapters/local/get_file_outline/__init__.py,sha256=OKV_BHnoD9h-vkcVoW6AHmsuDjjauHPCKNK0nVFl4sU,37
168
+ janito/tools/adapters/local/get_file_outline/core.py,sha256=irLsmSuwP87KwTEjSBXedh67XKSZckGyTosePtyrp9g,4396
169
+ janito/tools/adapters/local/get_file_outline/java_outline.py,sha256=5xCX7zMOpTljwNTxKmc4ewTnCykCOC9TDd62gZzP_BU,1685
170
+ janito/tools/adapters/local/get_file_outline/markdown_outline.py,sha256=bXEBg0D93tEBDNy8t-wh4i7WxsxfpQ2C3dX1_rmtj08,434
171
+ janito/tools/adapters/local/get_file_outline/python_outline.py,sha256=RAcf9Vxec08lA06drYaNre5HCJ2lTzrRAskZ3rlyE-U,10326
172
+ janito/tools/adapters/local/get_file_outline/python_outline_v2.py,sha256=OOHKDGbOwxiCtr3i5m5ZAnELvoF12fKdzO2RCDuTsCs,5453
173
+ janito/tools/adapters/local/get_file_outline/search_outline.py,sha256=s5S1eMBvqW30lPoScza3bDxENiJY4C0akrGjGN12HpY,1225
174
+ janito/tools/adapters/local/search_text/__init__.py,sha256=FEYpF5tTtf0fiAyRGIGSn-kV-MJDkhdFIbus16mYW8Y,34
175
+ janito/tools/adapters/local/search_text/core.py,sha256=xuaZstYmLp0rhXoNpNFItoshd-dc_9nFP5pFSEm2cvI,7701
176
+ janito/tools/adapters/local/search_text/match_lines.py,sha256=2l0r8_1l5gnmu9vJSdkxu0JwbPNHx7m84Ei2s4V0hcQ,2141
177
+ janito/tools/adapters/local/search_text/pattern_utils.py,sha256=Cytwl7M9tNY-IsAmvoMgvlQMPswbCHTVrX8aZQ6IBJc,2374
178
+ janito/tools/adapters/local/search_text/traverse_directory.py,sha256=TrsAlFXcG7WdtZS6pg3_6vlL3h-afps5u7kkBDhA65c,4064
179
+ janito/tools/adapters/local/validate_file_syntax/__init__.py,sha256=P53RHmas4BbHL90cMxH9m-RpMCJI8JquoJb0rpkPVVk,29
180
+ janito/tools/adapters/local/validate_file_syntax/core.py,sha256=dOIKVY43rvY_TdPqBHKsOyig64DpjH-Fb9btYvGvRJs,3398
181
+ janito/tools/adapters/local/validate_file_syntax/css_validator.py,sha256=2yUMNxVIQy3AhuiahyZZbci0azMHkSWlGBbYIxJNJ-U,1361
182
+ janito/tools/adapters/local/validate_file_syntax/html_validator.py,sha256=sCIGBx-b-xz-vbz6pQM0rYYuzrt93_9ApC5zQ9Rwadk,3064
183
+ janito/tools/adapters/local/validate_file_syntax/js_validator.py,sha256=Km-wUrG0YZJ7kzxxyVPN_vXqOWIdfD12GkhQHPRVrC8,1008
184
+ janito/tools/adapters/local/validate_file_syntax/json_validator.py,sha256=eXFiuR-4-pqlrQIddxDoBmP7-loV4F6S3sJNh-nmOys,160
185
+ janito/tools/adapters/local/validate_file_syntax/markdown_validator.py,sha256=RKZFacTwWq56sJ6KoQzeAPLttC6sV-DsIec4_xN6CJQ,3521
186
+ janito/tools/adapters/local/validate_file_syntax/ps1_validator.py,sha256=cP1jsMhtdOVfC6-sjxlsHbQWklHPq2FAGRJ5LFG7nqY,1162
187
+ janito/tools/adapters/local/validate_file_syntax/python_validator.py,sha256=lHzjlA4g9nCF9hXkGx3izWF0b0vJH3yV7Pu3buLyBbI,140
188
+ janito/tools/adapters/local/validate_file_syntax/xml_validator.py,sha256=3CK7BEGO7gKI3bpeTtCFe0kJ5aKDZVh3Kh67bGIhcuc,294
189
+ janito/tools/adapters/local/validate_file_syntax/yaml_validator.py,sha256=XLmOp7Ef6pLd97ICVnF3PxNKL1Yo5tLZsasvxPY478Y,165
190
+ janito-2.4.0.dist-info/licenses/LICENSE,sha256=GSAKapQH5ZIGWlpQTA7v5YrfECyaxaohUb1vJX-qepw,1090
191
+ janito-2.4.0.dist-info/METADATA,sha256=QlUOwMhvDFyWpbzS1n3lk_CQoE32Bf2q82_hzUgKgsw,17058
192
+ janito-2.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
193
+ janito-2.4.0.dist-info/entry_points.txt,sha256=wIo5zZxbmu4fC-ZMrsKD0T0vq7IqkOOLYhrqRGypkx4,48
194
+ janito-2.4.0.dist-info/top_level.txt,sha256=m0NaVCq0-ivxbazE2-ND0EA9Hmuijj_OGkmCbnBcCig,7
195
+ janito-2.4.0.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- Você está atuando como: {{ role }}
2
-
3
- Você tem acesso, para fins de desenvolvimento, ao seguinte ambiente:
4
- Plataforma: {{ platform }}
5
- Versão do Python: {{ python_version }}
6
- Shell/Ambiente: {{ shell_info }}
7
-
8
- Responda seguindo estas diretrizes:
9
- - Antes de usar suas funções de namespace, forneça uma explicação concisa.
10
- - Na primeira mensagem faça uma pesquisa no projeto.
11
- - Prefira fazer edições localizadas usando substituições de string. Se a alteração necessária for extensa, substitua o arquivo inteiro.
12
- - Ao localizar linhas de código para alterar, consider o conteúdo das linhas anteriores para uma substituição precisa de indentação.
13
- - Após editar arquivos, valide-os.
@@ -1,37 +0,0 @@
1
- {# General role setup
2
- ex. "Search in code" -> Python Developer -> find(*.py) | Java Developer -> find(*.java)
3
- #}
4
- You are: {{ role }}
5
-
6
- You will answer following a pattern of: discovery, description, implementation (when a change is requested) and validation.
7
-
8
- {# Improves tool selection and platform specific constrains, eg, path format, C:\ vs /path #}
9
- {% if exec_enabled %}
10
- You will be using the following environment:
11
- Platform: {{ platform }}
12
- Python version: {{ python_version }}
13
- Shell/Environment: {{ shell_info }}
14
- {% endif %}
15
-
16
- Before answering map the questions to artifacts found in the current directory - the current project.
17
-
18
- Respond according to the following guidelines:
19
- {# Exploratory hint #}
20
- - Before answering to the user, explore the content related to the question
21
- {# Define exploration order, prefers search/outline, reduces chunking roundtip #}
22
- - When exploring full files content, provide empty range to read the entire files instead of chunked reads
23
- {# Prefix tools with purpose for user awarnesses #}
24
- - Before using your namespace functions, provide a concise explanation.
25
- {# Reduce unrequest code verbosity overhead #}
26
- - Use the namespace functions to deliver the code changes instead of showing the code.
27
- {# Drive edit mode, place holders critical as shown to be crucial to avoid corruption with code placeholders #}
28
- - Prefer making localized edits using string replacements. If the required change is extensive, replace the entire file instead, provide full content without placeholders.
29
- {# Trying to prevent surrogates generation, found this frequently in gpt4.1/windows #}
30
- - While writing code, if you need an emoji or special Unicode character in a string, then insert the actual character (e.g., 📖) directly instead of using surrogate pairs or escape sequences.
31
- {# Without this, the LLM choses to create files from a literal interpretation of the purpose and intention #}
32
- - Before creating files search the code for the location related to the file purpose
33
- {# This will trigger a search for the old names/locations to be updates #}
34
- - After moving, removing or renaming functions or classes to different modules, update all imports, references, tests, and documentation to reflect the new locations, then verify functionality.
35
- {# Keeping docstrings update is key to have semanatic match between prompts and code #}
36
- - Once development or updates are finished, ensure that new or updated packages, modules, functions are properly documented.
37
-
@@ -1,25 +0,0 @@
1
- import os
2
- import webbrowser
3
- from janito.cli.console import shared_console
4
- from janito.cli.chat_mode.shell.commands.base import ShellCmdHandler
5
-
6
-
7
- class EditShellHandler(ShellCmdHandler):
8
- help_text = "Open a file in the browser-based editor"
9
-
10
- def run(self):
11
- filename = self.after_cmd_line.strip()
12
- if not filename:
13
- shared_console.print("[red]Usage: /edit <filename>[/red]")
14
- return
15
- if not os.path.isfile(filename):
16
- shared_console.print(f"[red]File not found:[/red] {filename}")
17
- return
18
- from janito.cli.config import get_termweb_port
19
-
20
- port = get_termweb_port()
21
- url = f"http://localhost:{port}/?path={filename}"
22
- shared_console.print(
23
- f"[green]Opening in browser:[/green] [underline blue]{url}[/underline blue]"
24
- )
25
- webbrowser.open(url)
@@ -1,27 +0,0 @@
1
- from janito.cli.console import shared_console
2
- from janito.cli.chat_mode.shell.commands.base import ShellCmdHandler
3
-
4
- class ExecShellHandler(ShellCmdHandler):
5
- help_text = "/exec on|off: Enable or disable code and command execution tools. Usage: /exec on or /exec off."
6
-
7
- def run(self):
8
- if not self.shell_state:
9
- shared_console.print("[red]Shell state unavailable.[/red]")
10
- return
11
- arg = (self.after_cmd_line or "").strip().lower()
12
- if arg not in ("on", "off"):
13
- shared_console.print("[yellow]Usage: /exec on|off[/yellow]")
14
- return
15
- enable = arg == "on"
16
- self.shell_state.allow_execution = enable
17
- # Dynamically enable/disable execution tools in the registry
18
- try:
19
- registry = __import__('janito.tools', fromlist=['get_local_tools_adapter']).get_local_tools_adapter()
20
- if hasattr(registry, 'set_execution_tools_enabled'):
21
- registry.set_execution_tools_enabled(enable)
22
- except Exception as e:
23
- shared_console.print(f"[yellow]Warning: Could not update execution tools dynamically: {e}[/yellow]")
24
- if enable:
25
- shared_console.print("[green]Execution tools ENABLED. You can now use code and command execution tools.[/green]")
26
- else:
27
- shared_console.print("[yellow]Execution tools DISABLED. Code and command execution tools are now blocked.[/yellow]")
@@ -1,92 +0,0 @@
1
- import http.client
2
- from rich.console import Console
3
- from janito.cli.config import config
4
- from janito.cli.console import shared_console
5
- from janito.cli.chat_mode.shell.commands.base import ShellCmdHandler
6
-
7
-
8
- class TermwebLogTailShellHandler(ShellCmdHandler):
9
- help_text = "Show the last lines of the latest termweb logs"
10
-
11
- def run(self):
12
- lines = 20
13
- args = self.after_cmd_line.strip().split()
14
- if args and args[0].isdigit():
15
- lines = int(args[0])
16
- stdout_path = self.shell_state.termweb_stdout_path if self.shell_state else None
17
- stderr_path = self.shell_state.termweb_stderr_path if self.shell_state else None
18
- status = getattr(self.shell_state, "termweb_status", None)
19
- live_status = getattr(self.shell_state, "termweb_live_status", None)
20
- status_checked = getattr(self.shell_state, "termweb_live_checked_time", None)
21
- shared_console.print(
22
- f"[bold cyan][termweb] Current run status: {status} | Last health check: {live_status} at {status_checked}"
23
- )
24
- if not stdout_path and not stderr_path:
25
- shared_console.print(
26
- "[yellow][termweb] No termweb log files found for this session.[/yellow]"
27
- )
28
- return
29
- stdout_lines = stderr_lines = None
30
- if stdout_path:
31
- try:
32
- with open(stdout_path, encoding="utf-8") as f:
33
- stdout_lines = f.readlines()[-lines:]
34
- if stdout_lines:
35
- shared_console.print(
36
- f"[yellow][termweb][stdout] Tail of {stdout_path}:\n"
37
- + "".join(stdout_lines)
38
- )
39
- except Exception:
40
- pass
41
- if stderr_path:
42
- try:
43
- with open(stderr_path, encoding="utf-8") as f:
44
- stderr_lines = f.readlines()[-lines:]
45
- if stderr_lines:
46
- shared_console.print(
47
- f"[red][termweb][stderr] Tail of {stderr_path}:\n"
48
- + "".join(stderr_lines)
49
- )
50
- except Exception:
51
- pass
52
- if (not stdout_path or not stdout_lines) and (
53
- not stderr_path or not stderr_lines
54
- ):
55
- shared_console.print("[termweb] No output or errors captured in logs.")
56
-
57
-
58
- def handle_termweb_status(*args, shell_state=None, **kwargs):
59
- if shell_state is None:
60
- console.print(
61
- "[red]No shell state available. Cannot determine termweb status.[/red]"
62
- )
63
- return
64
- from janito.cli.config import get_termweb_port
65
-
66
- port = get_termweb_port()
67
- port_source = "config"
68
- pid = getattr(shell_state, "termweb_pid", None)
69
- stdout_path = getattr(shell_state, "termweb_stdout_path", None)
70
- stderr_path = getattr(shell_state, "termweb_stderr_path", None)
71
- running = False
72
- if port and hasattr(shell_state, "termweb_live_status"):
73
- running = shell_state.termweb_live_status == "online"
74
- console.print("[bold cyan]TermWeb Server Status:[/bold cyan]")
75
- console.print(f" Running: {'[green]Yes[/green]' if running else '[red]No[/red]'}")
76
- if pid:
77
- console.print(f" PID: {pid}")
78
- if port:
79
- console.print(f" Port: {port} (from {port_source})")
80
- url = f"http://localhost:{port}/"
81
- console.print(f" URL: [underline blue]{url}[/underline blue]")
82
- else:
83
- console.print(" [yellow]No port configured in config.[/yellow]")
84
- if stdout_path:
85
- console.print(f" Stdout log: {stdout_path}")
86
- if stderr_path:
87
- console.print(f" Stderr log: {stderr_path}")
88
-
89
-
90
- handle_termweb_status.help_text = (
91
- "Show status information about the running termweb server"
92
- )
@@ -1,122 +0,0 @@
1
- import sys
2
- import subprocess
3
- import tempfile
4
- import time
5
- import http.client
6
- import os
7
- import threading
8
- import queue
9
- from rich.console import Console
10
- from janito.i18n import tr
11
- from janito.cli.config import get_termweb_port
12
-
13
-
14
- def wait_for_termweb(port, timeout=3.0):
15
- """Polls the Bottle app root endpoint until it responds or timeout (seconds) is reached."""
16
- deadline = time.time() + timeout
17
- while time.time() < deadline:
18
- try:
19
- conn = http.client.HTTPConnection("localhost", port, timeout=0.5)
20
- conn.request("GET", "/")
21
- resp = conn.getresponse()
22
- if resp.status == 200:
23
- return True
24
- except Exception:
25
- pass
26
- time.sleep(0.1)
27
- return False
28
-
29
-
30
- def termweb_start_and_watch(shell_state, shellstate_lock, selected_port=None):
31
- """
32
- Start the termweb server on the given port in a background thread.
33
- Communicates (termweb_proc, started: bool, stdout_path, stderr_path) via result_queue if provided.
34
- Returns the Thread object.
35
- """
36
-
37
- def termweb_worker(shell_state, shellstate_lock, selected_port, check_interval=2.0):
38
- """
39
- Worker to start termweb process, then monitor its running state/health, and update shell_state fields in a thread-safe manner.
40
- - shell_state: context or state object to update (must provide .termweb_pid, .termweb_status, etc.)
41
- - shellstate_lock: a threading.Lock or similar to synchronize access
42
- """
43
- console = Console()
44
- # Try to locate app.py
45
- app_py_path = os.path.join(os.path.dirname(__file__), "..", "termweb", "app.py")
46
- app_py_path = os.path.abspath(app_py_path)
47
- if not os.path.isfile(app_py_path):
48
- try:
49
- import janito_termweb
50
-
51
- app_py_path = janito_termweb.__file__.replace("__init__.py", "app.py")
52
- except ImportError:
53
- with shellstate_lock:
54
- shell_state.termweb_status = "notfound"
55
- shell_state.termweb_pid = None
56
- shell_state.termweb_stdout_path = None
57
- shell_state.termweb_stderr_path = None
58
- return
59
- termweb_stdout = tempfile.NamedTemporaryFile(
60
- delete=False, mode="w+", encoding="utf-8"
61
- )
62
- termweb_stderr = tempfile.NamedTemporaryFile(
63
- delete=False, mode="w+", encoding="utf-8"
64
- )
65
- port_to_use = selected_port if selected_port is not None else get_termweb_port()
66
- termweb_proc = subprocess.Popen(
67
- [sys.executable, app_py_path, "--port", str(port_to_use)],
68
- stdout=termweb_stdout,
69
- stderr=termweb_stderr,
70
- )
71
-
72
- # Step 1: Wait for server to become healthy (initial check)
73
- if wait_for_termweb(port_to_use, timeout=3.0):
74
- with shellstate_lock:
75
- shell_state.termweb_status = "running"
76
- shell_state.termweb_pid = termweb_proc.pid
77
- shell_state.termweb_stdout_path = termweb_stdout.name
78
- shell_state.termweb_stderr_path = termweb_stderr.name
79
- shell_state.termweb_port = port_to_use
80
- else:
81
- termweb_proc.terminate()
82
- termweb_proc.wait()
83
- # console.print(f"[red]Failed to start TermWeb on port {port_to_use}. Check logs for details.[/red]")
84
- with shellstate_lock:
85
- shell_state.termweb_status = "failed-start"
86
- shell_state.termweb_pid = None
87
- shell_state.termweb_stdout_path = termweb_stdout.name
88
- shell_state.termweb_stderr_path = termweb_stderr.name
89
- shell_state.termweb_port = None
90
- return
91
-
92
- # Step 2: Run watcher loop; exit and set fields if process or health fails
93
- import time
94
- from http.client import HTTPConnection
95
-
96
- while True:
97
- if termweb_proc.poll() is not None: # means process exited
98
- with shellstate_lock:
99
- shell_state.termweb_status = "terminated"
100
- shell_state.termweb_pid = None
101
- break
102
- try:
103
- conn = HTTPConnection("localhost", port_to_use, timeout=0.5)
104
- conn.request("GET", "/")
105
- resp = conn.getresponse()
106
- if resp.status != 200:
107
- raise Exception("Bad status")
108
- except Exception:
109
- # console.print(f"[red]TermWeb on port {port_to_use} appears to have stopped responding![/red]")
110
- with shellstate_lock:
111
- shell_state.termweb_status = "unresponsive"
112
- break
113
- time.sleep(check_interval)
114
-
115
- # Launch background thread
116
- t = threading.Thread(
117
- target=termweb_worker,
118
- args=(shell_state, shellstate_lock, selected_port),
119
- daemon=True,
120
- )
121
- t.start()
122
- return t
janito/termweb/app.py DELETED
@@ -1,95 +0,0 @@
1
- from quart import Quart, send_from_directory, request, jsonify, websocket
2
- import os
3
-
4
- app = Quart(__name__)
5
-
6
- BASE_DIR = os.getcwd()
7
-
8
-
9
- @app.route("/")
10
- async def index():
11
- static_dir = os.path.join(os.path.dirname(__file__), "static")
12
- file_path = request.args.get("path")
13
- if file_path:
14
- return await send_from_directory(static_dir, "editor.html")
15
- return await send_from_directory(static_dir, "index.html")
16
-
17
-
18
- @app.route("/static/<path:filepath>")
19
- async def server_static(filepath):
20
- static_dir = os.path.join(os.path.dirname(__file__), "static")
21
- return await send_from_directory(static_dir, filepath)
22
-
23
-
24
- @app.route("/api/explorer/")
25
- async def api_explorer_root():
26
- return await api_explorer(".")
27
-
28
-
29
- @app.route("/api/explorer/<path:path>", methods=["GET", "POST"])
30
- async def api_explorer(path="."):
31
- abs_path = os.path.abspath(os.path.join(BASE_DIR, path))
32
- # Security: Only allow files/dirs within BASE_DIR
33
- if not abs_path.startswith(BASE_DIR):
34
- return jsonify({"error": "Acesso negado."}), 403
35
-
36
- if request.method == "POST":
37
- # Gravação de arquivo
38
- if os.path.isdir(abs_path):
39
- return jsonify({"error": "Não é possível gravar em um diretório."}), 400
40
- try:
41
- data = await request.get_json()
42
- content = data.get("content", "")
43
- with open(abs_path, "w", encoding="utf-8") as f:
44
- f.write(content)
45
- return jsonify({"success": True})
46
- except Exception as e:
47
- return jsonify({"error": str(e)}), 500
48
-
49
- # GET: comportamento actual
50
- if os.path.isdir(abs_path):
51
- entries = []
52
- walker = walk_dir_with_gitignore(abs_path, max_depth=1)
53
- for root, dirs, files in walker:
54
- for entry in sorted(dirs):
55
- entries.append({"name": entry, "is_dir": True})
56
- for entry in sorted(files):
57
- entries.append({"name": entry, "is_dir": False})
58
- return jsonify({"type": "dir", "path": path, "entries": entries})
59
- elif os.path.isfile(abs_path):
60
- with open(abs_path, "r", encoding="utf-8", errors="replace") as f:
61
- content = f.read()
62
- return jsonify({"type": "file", "path": path, "content": content})
63
- else:
64
- return jsonify({"error": "Não encontrado."}), 404
65
-
66
-
67
- # Example WebSocket endpoint
68
- @app.websocket("/ws")
69
- async def ws():
70
- while True:
71
- data = await websocket.receive()
72
- await websocket.send(f"Echo: {data}")
73
-
74
-
75
- # Catch-all route for SPA navigation (excluding /static and /api)
76
- @app.route("/<path:catchall>")
77
- async def spa_catch_all(catchall):
78
- static_dir = os.path.join(os.path.dirname(__file__), "static")
79
- return await send_from_directory(static_dir, "index.html")
80
-
81
-
82
- if __name__ == "__main__":
83
- import sys
84
-
85
- port = 8088
86
- # Allow override from CLI for direct execution/testing
87
- if "--port" in sys.argv:
88
- idx = sys.argv.index("--port")
89
- if idx + 1 < len(sys.argv):
90
- try:
91
- port = int(sys.argv[idx + 1])
92
- except ValueError:
93
- pass
94
- print(f"Iniciando servidor web Quart em http://localhost:{port}")
95
- app.run(host="localhost", port=port, debug=True)
janito/version.py DELETED
@@ -1,4 +0,0 @@
1
- # janito/version.py
2
- """Single source of truth for the janito package version."""
3
-
4
- __version__ = "2.3.0"