janito 2.3.1__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 (96) hide show
  1. janito/__init__.py +1 -1
  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/commands/__init__.py +13 -7
  11. janito/cli/chat_mode/shell/commands/_priv_check.py +5 -0
  12. janito/cli/chat_mode/shell/commands/conversation_restart.py +30 -0
  13. janito/cli/chat_mode/shell/commands/execute.py +42 -0
  14. janito/cli/chat_mode/shell/commands/help.py +6 -3
  15. janito/cli/chat_mode/shell/commands/model.py +28 -0
  16. janito/cli/chat_mode/shell/commands/read.py +37 -0
  17. janito/cli/chat_mode/shell/commands/tools.py +45 -18
  18. janito/cli/chat_mode/shell/commands/write.py +37 -0
  19. janito/cli/chat_mode/shell/commands.bak.zip +0 -0
  20. janito/cli/chat_mode/shell/session.bak.zip +0 -0
  21. janito/cli/chat_mode/toolbar.py +44 -27
  22. janito/cli/cli_commands/list_tools.py +44 -11
  23. janito/cli/cli_commands/model_utils.py +95 -95
  24. janito/cli/cli_commands/show_system_prompt.py +57 -14
  25. janito/cli/config.py +5 -6
  26. janito/cli/core/getters.py +33 -33
  27. janito/cli/core/runner.py +25 -18
  28. janito/cli/core/setters.py +10 -1
  29. janito/cli/main_cli.py +28 -5
  30. janito/cli/prompt_core.py +18 -2
  31. janito/cli/prompt_setup.py +56 -0
  32. janito/cli/single_shot_mode/handler.py +14 -73
  33. janito/cli/verbose_output.py +1 -1
  34. janito/config_manager.py +125 -112
  35. janito/drivers/dashscope.bak.zip +0 -0
  36. janito/drivers/openai/README.md +20 -0
  37. janito/drivers/openai_responses.bak.zip +0 -0
  38. janito/event_bus/event.py +2 -2
  39. janito/i18n/pt.py +0 -1
  40. janito/llm/README.md +23 -0
  41. janito/llm/agent.py +80 -16
  42. janito/llm/auth.py +63 -63
  43. janito/llm/driver.py +8 -0
  44. janito/provider_registry.py +178 -176
  45. janito/providers/azure_openai/model_info.py +16 -16
  46. janito/providers/dashscope.bak.zip +0 -0
  47. janito/providers/registry.py +26 -26
  48. janito/shell.bak.zip +0 -0
  49. janito/tools/DOCSTRING_STANDARD.txt +33 -0
  50. janito/tools/README.md +3 -0
  51. janito/tools/__init__.py +20 -6
  52. janito/tools/adapters/local/__init__.py +65 -62
  53. janito/tools/adapters/local/adapter.py +18 -35
  54. janito/tools/adapters/local/ask_user.py +3 -4
  55. janito/tools/adapters/local/copy_file.py +2 -2
  56. janito/tools/adapters/local/create_directory.py +2 -2
  57. janito/tools/adapters/local/create_file.py +2 -2
  58. janito/tools/adapters/local/delete_text_in_file.py +2 -2
  59. janito/tools/adapters/local/fetch_url.py +2 -2
  60. janito/tools/adapters/local/find_files.py +2 -1
  61. janito/tools/adapters/local/get_file_outline/core.py +2 -2
  62. janito/tools/adapters/local/get_file_outline/search_outline.py +2 -2
  63. janito/tools/adapters/local/move_file.py +2 -2
  64. janito/tools/adapters/local/open_html_in_browser.py +2 -1
  65. janito/tools/adapters/local/open_url.py +2 -2
  66. janito/tools/adapters/local/python_code_run.py +3 -3
  67. janito/tools/adapters/local/python_command_run.py +3 -3
  68. janito/tools/adapters/local/python_file_run.py +3 -3
  69. janito/tools/adapters/local/remove_directory.py +2 -2
  70. janito/tools/adapters/local/remove_file.py +2 -2
  71. janito/tools/adapters/local/replace_text_in_file.py +2 -2
  72. janito/tools/adapters/local/run_bash_command.py +3 -3
  73. janito/tools/adapters/local/run_powershell_command.py +3 -3
  74. janito/tools/adapters/local/search_text/core.py +2 -2
  75. janito/tools/adapters/local/validate_file_syntax/core.py +2 -2
  76. janito/tools/adapters/local/view_file.py +2 -1
  77. janito/tools/outline_file.bak.zip +0 -0
  78. janito/tools/permissions.py +45 -0
  79. janito/tools/permissions_parse.py +12 -0
  80. janito/tools/tool_base.py +14 -1
  81. janito/tools/tool_utils.py +4 -6
  82. janito/tools/tools_adapter.py +25 -20
  83. {janito-2.3.1.dist-info → janito-2.4.0.dist-info}/METADATA +51 -16
  84. {janito-2.3.1.dist-info → janito-2.4.0.dist-info}/RECORD +88 -74
  85. janito/agent/templates/profiles/system_prompt_template_base_pt.txt.j2 +0 -13
  86. janito/agent/templates/profiles/system_prompt_template_main.txt.j2 +0 -37
  87. janito/cli/chat_mode/shell/commands/edit.py +0 -25
  88. janito/cli/chat_mode/shell/commands/exec.py +0 -27
  89. janito/cli/chat_mode/shell/commands/termweb_log.py +0 -92
  90. janito/cli/termweb_starter.py +0 -122
  91. janito/termweb/app.py +0 -95
  92. janito/version.py +0 -4
  93. {janito-2.3.1.dist-info → janito-2.4.0.dist-info}/WHEEL +0 -0
  94. {janito-2.3.1.dist-info → janito-2.4.0.dist-info}/entry_points.txt +0 -0
  95. {janito-2.3.1.dist-info → janito-2.4.0.dist-info}/licenses/LICENSE +0 -0
  96. {janito-2.3.1.dist-info → janito-2.4.0.dist-info}/top_level.txt +0 -0
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.1"
File without changes