janito 1.6.0__py3-none-any.whl → 1.8.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 (117) hide show
  1. janito/__init__.py +1 -1
  2. janito/agent/config.py +3 -3
  3. janito/agent/config_defaults.py +3 -2
  4. janito/agent/conversation.py +73 -27
  5. janito/agent/conversation_api.py +104 -4
  6. janito/agent/conversation_exceptions.py +6 -0
  7. janito/agent/conversation_tool_calls.py +17 -3
  8. janito/agent/event.py +24 -0
  9. janito/agent/event_dispatcher.py +24 -0
  10. janito/agent/event_handler_protocol.py +5 -0
  11. janito/agent/event_system.py +15 -0
  12. janito/agent/message_handler.py +4 -1
  13. janito/agent/message_handler_protocol.py +5 -0
  14. janito/agent/openai_client.py +5 -6
  15. janito/agent/openai_schema_generator.py +23 -4
  16. janito/agent/platform_discovery.py +90 -0
  17. janito/agent/profile_manager.py +34 -110
  18. janito/agent/queued_message_handler.py +22 -3
  19. janito/agent/rich_message_handler.py +3 -1
  20. janito/agent/templates/profiles/system_prompt_template_base.txt.j2 +14 -0
  21. janito/agent/templates/profiles/system_prompt_template_base_pt.txt.j2 +13 -0
  22. janito/agent/test_handler_protocols.py +47 -0
  23. janito/agent/tests/__init__.py +1 -0
  24. janito/agent/tool_base.py +1 -1
  25. janito/agent/tool_executor.py +109 -0
  26. janito/agent/tool_registry.py +3 -75
  27. janito/agent/tool_use_tracker.py +46 -0
  28. janito/agent/tools/__init__.py +11 -8
  29. janito/agent/tools/ask_user.py +26 -12
  30. janito/agent/tools/create_directory.py +50 -18
  31. janito/agent/tools/create_file.py +60 -29
  32. janito/agent/tools/dir_walk_utils.py +16 -0
  33. janito/agent/tools/fetch_url.py +10 -11
  34. janito/agent/tools/find_files.py +49 -40
  35. janito/agent/tools/get_lines.py +60 -25
  36. janito/agent/tools/memory.py +48 -0
  37. janito/agent/tools/move_file.py +72 -23
  38. janito/agent/tools/outline_file/__init__.py +85 -0
  39. janito/agent/tools/outline_file/formatting.py +20 -0
  40. janito/agent/tools/outline_file/markdown_outline.py +14 -0
  41. janito/agent/tools/outline_file/python_outline.py +71 -0
  42. janito/agent/tools/present_choices.py +62 -0
  43. janito/agent/tools/present_choices_test.py +18 -0
  44. janito/agent/tools/remove_directory.py +31 -26
  45. janito/agent/tools/remove_file.py +31 -13
  46. janito/agent/tools/replace_text_in_file.py +135 -36
  47. janito/agent/tools/run_bash_command.py +113 -97
  48. janito/agent/tools/run_powershell_command.py +169 -0
  49. janito/agent/tools/run_python_command.py +53 -29
  50. janito/agent/tools/search_outline.py +17 -0
  51. janito/agent/tools/search_text.py +208 -0
  52. janito/agent/tools/tools_utils.py +47 -4
  53. janito/agent/tools/utils.py +14 -15
  54. janito/agent/tools/validate_file_syntax.py +163 -0
  55. janito/cli/_print_config.py +1 -1
  56. janito/cli/arg_parser.py +36 -4
  57. janito/cli/config_commands.py +1 -1
  58. janito/cli/logging_setup.py +7 -2
  59. janito/cli/main.py +97 -3
  60. janito/cli/runner/__init__.py +0 -2
  61. janito/cli/runner/_termweb_log_utils.py +17 -0
  62. janito/cli/runner/cli_main.py +121 -89
  63. janito/cli/runner/config.py +6 -4
  64. janito/cli/termweb_starter.py +73 -0
  65. janito/cli_chat_shell/chat_loop.py +52 -13
  66. janito/cli_chat_shell/chat_state.py +1 -1
  67. janito/cli_chat_shell/chat_ui.py +2 -3
  68. janito/cli_chat_shell/commands/__init__.py +17 -6
  69. janito/cli_chat_shell/commands/{history_reset.py → history_start.py} +13 -5
  70. janito/cli_chat_shell/commands/lang.py +16 -0
  71. janito/cli_chat_shell/commands/prompt.py +42 -0
  72. janito/cli_chat_shell/commands/session_control.py +36 -1
  73. janito/cli_chat_shell/commands/sum.py +49 -0
  74. janito/cli_chat_shell/commands/termweb_log.py +86 -0
  75. janito/cli_chat_shell/commands/utility.py +5 -2
  76. janito/cli_chat_shell/commands/verbose.py +29 -0
  77. janito/cli_chat_shell/load_prompt.py +47 -8
  78. janito/cli_chat_shell/session_manager.py +9 -1
  79. janito/cli_chat_shell/shell_command_completer.py +20 -0
  80. janito/cli_chat_shell/ui.py +110 -93
  81. janito/i18n/__init__.py +35 -0
  82. janito/i18n/messages.py +23 -0
  83. janito/i18n/pt.py +46 -0
  84. janito/rich_utils.py +43 -43
  85. janito/termweb/app.py +95 -0
  86. janito/termweb/static/editor.html +238 -0
  87. janito/termweb/static/editor.html.bak +238 -0
  88. janito/termweb/static/explorer.html.bak +59 -0
  89. janito/termweb/static/favicon.ico +0 -0
  90. janito/termweb/static/favicon.ico.bak +0 -0
  91. janito/termweb/static/index.html +55 -0
  92. janito/termweb/static/index.html.bak +55 -0
  93. janito/termweb/static/index.html.bak.bak +175 -0
  94. janito/termweb/static/landing.html.bak +36 -0
  95. janito/termweb/static/termicon.svg +1 -0
  96. janito/termweb/static/termweb.css +235 -0
  97. janito/termweb/static/termweb.css.bak +286 -0
  98. janito/termweb/static/termweb.js +187 -0
  99. janito/termweb/static/termweb.js.bak +187 -0
  100. janito/termweb/static/termweb.js.bak.bak +157 -0
  101. janito/termweb/static/termweb_quickopen.js +135 -0
  102. janito/termweb/static/termweb_quickopen.js.bak +125 -0
  103. janito/web/app.py +10 -13
  104. {janito-1.6.0.dist-info → janito-1.8.0.dist-info}/METADATA +73 -32
  105. janito-1.8.0.dist-info/RECORD +127 -0
  106. {janito-1.6.0.dist-info → janito-1.8.0.dist-info}/WHEEL +1 -1
  107. janito/agent/tool_registry_core.py +0 -2
  108. janito/agent/tools/get_file_outline.py +0 -117
  109. janito/agent/tools/py_compile_file.py +0 -40
  110. janito/agent/tools/replace_file.py +0 -51
  111. janito/agent/tools/search_files.py +0 -71
  112. janito/cli/runner/scan.py +0 -44
  113. janito/cli_chat_shell/commands/system.py +0 -73
  114. janito-1.6.0.dist-info/RECORD +0 -81
  115. {janito-1.6.0.dist-info → janito-1.8.0.dist-info}/entry_points.txt +0 -0
  116. {janito-1.6.0.dist-info → janito-1.8.0.dist-info}/licenses/LICENSE +0 -0
  117. {janito-1.6.0.dist-info → janito-1.8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,175 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <link rel="icon" type="image/svg+xml" href="/static/termicon.svg">
5
+ <link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico">
6
+ <meta charset="UTF-8">
7
+ <title>Welcome to TermWeb &mdash; janito.dev</title>
8
+ <link rel="stylesheet" href="/static/termweb.css">
9
+ <style>
10
+ /* Additional enhancements */
11
+ .header {
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: flex-start;
15
+ gap: 1.2em;
16
+ position: relative;
17
+ padding-top: 1.2em;
18
+ padding-bottom: 1.2em;
19
+ }
20
+ .header-logo {
21
+ width: 2.4em;
22
+ height: 2.4em;
23
+ margin-right: 0.5em;
24
+ vertical-align: middle;
25
+ }
26
+ .header-title {
27
+ font-size: 1.7em;
28
+ font-weight: bold;
29
+ letter-spacing: 0.04em;
30
+ color: #8be9fd;
31
+ text-shadow: 0 2px 8px #222a, 0 1px 0 #222a;
32
+ }
33
+ .header-subtitle {
34
+ font-size: 1.1em;
35
+ font-weight: 400;
36
+ opacity: 0.7;
37
+ margin-left: 0.5em;
38
+ color: #90caf9;
39
+ }
40
+ .toolbar {
41
+ display: flex;
42
+ justify-content: flex-end;
43
+ align-items: center;
44
+ gap: 0.7em;
45
+ background: #23272b;
46
+ border-bottom: 1px solid #1a73e8;
47
+ padding: 0.7em 2em;
48
+ margin-bottom: 0.5em;
49
+ box-shadow: 0 2px 8px #0002;
50
+ }
51
+ .view-toggle {
52
+ background: #23272b;
53
+ color: #90caf9;
54
+ border: 1px solid #1a73e8;
55
+ border-radius: 0.5em;
56
+ padding: 0.5em 1.2em;
57
+ font-size: 1.1em;
58
+ cursor: pointer;
59
+ transition: background 0.15s, color 0.15s, box-shadow 0.15s;
60
+ margin-left: 0.2em;
61
+ }
62
+ .view-toggle.active, .view-toggle:hover {
63
+ background: #1a73e8;
64
+ color: #fff;
65
+ box-shadow: 0 2px 8px #1976d255;
66
+ }
67
+ .main {
68
+ display: flex;
69
+ flex-direction: row;
70
+ gap: 2em;
71
+ padding: 2em;
72
+ min-height: 60vh;
73
+ background: transparent;
74
+ }
75
+ #explorer-main, #explorer-preview {
76
+ background: #22262b;
77
+ border-radius: 1.1em;
78
+ box-shadow: 0 4px 24px #0004;
79
+ border: 1px solid #1a73e8;
80
+ padding: 1.5em 1.2em;
81
+ min-height: 40vh;
82
+ overflow: auto;
83
+ }
84
+ #explorer-main {
85
+ margin-right: 0.5em;
86
+ }
87
+ #explorer-preview {
88
+ margin-left: 0.5em;
89
+ }
90
+ @media (max-width: 900px) {
91
+ .main {
92
+ flex-direction: column;
93
+ gap: 1em;
94
+ padding: 1em;
95
+ }
96
+ #explorer-main, #explorer-preview {
97
+ min-height: 20vh;
98
+ padding: 1em 0.7em;
99
+ }
100
+ }
101
+ </style>
102
+ </head>
103
+ <body>
104
+ <!-- Quick Open Modal (Ctrl+P) -->
105
+ <div id="quickopen-modal" style="display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:1000;background:rgba(0,0,0,0.35);align-items:center;justify-content:center;">
106
+ <div style="background:#222;padding:2em 2em 1em 2em;border-radius:1em;box-shadow:0 8px 32px #000a;min-width:340px;max-width:90vw;">
107
+ <input id="quickopen-input" type="text" placeholder="Type to search files..." style="width:100%;padding:0.7em 1em;font-size:1.1em;background:#111;color:#fff;border:1px solid #444;border-radius:0.5em;outline:none;" autocomplete="off" />
108
+ <ul id="quickopen-results" style="margin:1em 0 0 0;padding:0;list-style:none;max-height:260px;overflow-y:auto;"></ul>
109
+ <div style="text-align:right;margin-top:0.5em;"><small>Press Esc to close</small></div>
110
+ </div>
111
+ </div>
112
+
113
+ <div class="header">
114
+ <img src="/static/termicon.svg" alt="TermWeb Logo" class="header-logo">
115
+ <span class="header-title">TermWeb</span>
116
+ <span class="header-subtitle">AI-powered Project Explorer</span>
117
+ <button class="theme-switcher" id="theme-switcher">Switch to Light Theme</button>
118
+ </div>
119
+ <div class="toolbar" id="explorer-toolbar">
120
+ <button id="view-list" class="view-toggle active" title="List View">&#9776; List</button>
121
+ <button id="view-icons" class="view-toggle" title="Icon View">&#9632; Icons</button>
122
+ </div>
123
+ <div class="main">
124
+ <div id="explorer-main" style="flex:0 0 440px;min-width:0;"></div>
125
+ <div id="explorer-preview" class="preview-pane" style="flex:1 1 0;min-width:0;display:flex;flex-direction:column;"></div>
126
+ </div>
127
+ <div class="footer">
128
+ <div class="subtitle">
129
+ Powered by <a href="https://janito.dev" target="_blank">janito.dev</a> &mdash; AI-powered coding agent
130
+ </div>
131
+ <ul>
132
+ <li>🌐 <a href="https://janito.dev" target="_blank">janito.dev</a></li>
133
+ <li>📚 <a href="https://docs.janito.dev" target="_blank">Documentation</a></li>
134
+ <li>💻 <a href="https://github.com/joaompinto/janito" target="_blank">GitHub</a></li>
135
+ </ul>
136
+ <span style="font-size:0.9em;opacity:0.7;">_generated by janito.dev_</span>
137
+ </div>
138
+ <script src="/static/termweb.js"></script>
139
+ <script src="/static/termweb_quickopen.js"></script>
140
+ <script>
141
+ // Theme switcher logic
142
+ function setTheme(dark) {
143
+ if (dark) {
144
+ document.body.classList.add('dark-theme');
145
+ document.body.classList.remove('light-theme');
146
+ localStorage.setItem('theme', 'dark');
147
+ document.getElementById('theme-switcher').textContent = 'Switch to Light Theme';
148
+ } else {
149
+ document.body.classList.remove('dark-theme');
150
+ document.body.classList.add('light-theme');
151
+ localStorage.setItem('theme', 'light');
152
+ document.getElementById('theme-switcher').textContent = 'Switch to Dark Theme';
153
+ }
154
+ }
155
+ document.addEventListener('DOMContentLoaded', function() {
156
+ // Initial theme
157
+ var theme = localStorage.getItem('theme') || 'dark';
158
+ setTheme(theme === 'dark');
159
+ document.getElementById('theme-switcher').onclick = function() {
160
+ setTheme(document.body.classList.contains('light-theme'));
161
+ };
162
+ renderExplorer('.')
163
+ setExplorerView(localStorage.getItem('explorerView') || 'list');
164
+ document.getElementById('view-list').onclick = function() {
165
+ setExplorerView('list');
166
+ renderExplorer('.')
167
+ };
168
+ document.getElementById('view-icons').onclick = function() {
169
+ setExplorerView('icons');
170
+ renderExplorer('.')
171
+ };
172
+ });
173
+ </script>
174
+ </body>
175
+ </html>
@@ -0,0 +1,36 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <link rel="icon" type="image/svg+xml" href="/static/termicon.svg">
5
+ <link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico">
6
+ <meta charset="UTF-8">
7
+ <title>Welcome to TermWeb &mdash; janito.dev</title>
8
+ <link rel="stylesheet" href="/static/termweb.css">
9
+ <script>
10
+ // Automatically redirect to explorer on load
11
+ window.onload = function() {
12
+ window.location.href = '/explorer/.';
13
+ };
14
+ </script>
15
+ </head>
16
+ <body>
17
+ <div class="header">
18
+ Welcome to TermWeb
19
+ </div>
20
+ <div class="main" style="text-align:center;margin-top:60px;">
21
+ <h2>AI-powered Coding Agent</h2>
22
+ <!-- Directory explorer now loads automatically -->
23
+ </div>
24
+ <div class="footer">
25
+ <div class="subtitle">
26
+ Powered by <a href="https://janito.dev" target="_blank">janito.dev</a> &mdash; AI-powered coding agent
27
+ </div>
28
+ <ul>
29
+ <li>🌐 <a href="https://janito.dev" target="_blank">janito.dev</a></li>
30
+ <li>📚 <a href="https://docs.janito.dev" target="_blank">Documentation</a></li>
31
+ <li>💻 <a href="https://github.com/joaompinto/janito" target="_blank">GitHub</a></li>
32
+ </ul>
33
+ <span style="font-size:0.9em;opacity:0.7;">_generated by janito.dev_</span>
34
+ </div>
35
+ </body>
36
+ </html>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="12" fill="#222"/><text x="50%" y="50%" text-anchor="middle" dy=".35em" font-size="32" fill="#0f0" font-family="monospace">$</text></svg>
@@ -0,0 +1,235 @@
1
+ /* --- Layout and Theme --- */
2
+ html, body {
3
+ height: 100%;
4
+ margin: 0;
5
+ padding: 0;
6
+ }
7
+ body {
8
+ display: flex;
9
+ flex-direction: column;
10
+ min-height: 100vh;
11
+ background: #181a1b;
12
+ color: #f1f1f1;
13
+ transition: background 0.2s, color 0.2s;
14
+ }
15
+ body.light-theme {
16
+ background: #f5f5f5;
17
+ color: #181a1b;
18
+ }
19
+
20
+ .header {
21
+ background: #23272b;
22
+ color: #f1f1f1;
23
+ padding: 1em 2em;
24
+ font-size: 1.5em;
25
+ font-weight: bold;
26
+ letter-spacing: 0.04em;
27
+ border-bottom: 2px solid #1a73e8;
28
+ position: relative;
29
+ transition: background 0.2s, color 0.2s;
30
+ }
31
+ body.dark-theme .header {
32
+ background: #181a1b;
33
+ color: #f1f1f1;
34
+ border-bottom: 2px solid #1976d2;
35
+ }
36
+ body.light-theme .header {
37
+ background: #eaeaea;
38
+ color: #181a1b;
39
+ border-bottom: 2px solid #1565c0;
40
+ }
41
+
42
+ /* --- Enhanced Header --- */
43
+ .header-logo {
44
+ width: 2.4em;
45
+ height: 2.4em;
46
+ margin-right: 0.5em;
47
+ vertical-align: middle;
48
+ }
49
+ .header-title {
50
+ font-size: 1.7em;
51
+ font-weight: bold;
52
+ letter-spacing: 0.04em;
53
+ color: #8be9fd;
54
+ text-shadow: 0 2px 8px #222a, 0 1px 0 #222a;
55
+ }
56
+ .header-subtitle {
57
+ font-size: 1.1em;
58
+ font-weight: 400;
59
+ opacity: 0.7;
60
+ margin-left: 0.5em;
61
+ color: #90caf9;
62
+ }
63
+
64
+ /* --- Explorer Entry Flex Alignment --- */
65
+ .explorer-entry {
66
+ display: flex;
67
+ align-items: center;
68
+ gap: 0.7em;
69
+ }
70
+ .explorer-icon {
71
+ font-size: 1.2em;
72
+ min-width: 1.6em;
73
+ text-align: center;
74
+ margin-right: 0.2em;
75
+ }
76
+ .explorer-name {
77
+ font-size: 1em;
78
+ word-break: break-all;
79
+ }
80
+
81
+ .main {
82
+ flex: 1 1 auto;
83
+ display: flex;
84
+ flex-direction: row;
85
+ gap: 2em;
86
+ padding: 2em;
87
+ min-height: 60vh;
88
+ background: transparent;
89
+ }
90
+ #explorer-main, #explorer-preview {
91
+ background: #22262b;
92
+ border-radius: 1.1em;
93
+ box-shadow: 0 4px 24px #0004;
94
+ border: 1px solid #1a73e8;
95
+ padding: 1.5em 1.2em;
96
+ min-height: 40vh;
97
+ overflow: auto;
98
+ }
99
+ #explorer-main {
100
+ margin-right: 0.5em;
101
+ }
102
+ #explorer-preview {
103
+ margin-left: 0.5em;
104
+ display: flex;
105
+ flex-direction: column;
106
+ flex: 1 1 0;
107
+ min-width: 0;
108
+ }
109
+
110
+ /* --- CodeMirror Integration for Preview --- */
111
+ #explorer-codemirror-preview {
112
+ flex: 1 1 auto;
113
+ min-height: 0;
114
+ min-width: 0;
115
+ display: flex;
116
+ flex-direction: column;
117
+ }
118
+ .CodeMirror {
119
+ flex: 1 1 auto;
120
+ height: 60vh !important;
121
+ min-height: 0;
122
+ font-size: 1.1em;
123
+ background: #23272b;
124
+ color: #f8f8f2;
125
+ border-radius: 0.5em;
126
+ border: none;
127
+ transition: background 0.2s, color 0.2s;
128
+ }
129
+ body.light-theme .CodeMirror {
130
+ background: #fff;
131
+ color: #181a1b;
132
+ }
133
+
134
+ .footer {
135
+ flex-shrink: 0;
136
+ background: #23272b;
137
+ color: #f1f1f1;
138
+ padding: 1.2em 2em 1em 2em;
139
+ font-size: 1em;
140
+ border-top: 2px solid #1a73e8;
141
+ text-align: center;
142
+ display: flex;
143
+ flex-direction: column;
144
+ align-items: center;
145
+ justify-content: center;
146
+ position: fixed;
147
+ left: 0;
148
+ bottom: 0;
149
+ width: 100%;
150
+ z-index: 100;
151
+ transition: background 0.2s, color 0.2s;
152
+ }
153
+ body.dark-theme .footer {
154
+ background: #181a1b;
155
+ color: #f1f1f1;
156
+ border-top: 2px solid #1976d2;
157
+ }
158
+ body.light-theme .footer {
159
+ background: #eaeaea;
160
+ color: #181a1b;
161
+ border-top: 2px solid #1565c0;
162
+ }
163
+ .footer a {
164
+ color: #90caf9;
165
+ text-decoration: underline;
166
+ }
167
+ body.light-theme .footer a {
168
+ color: #1976d2;
169
+ }
170
+ .footer ul {
171
+ list-style: none;
172
+ padding: 0;
173
+ margin: 0.5em 0 0 0;
174
+ display: flex;
175
+ gap: 1.5em;
176
+ justify-content: center;
177
+ align-items: center;
178
+ }
179
+ .footer li {
180
+ display: inline;
181
+ }
182
+
183
+ .theme-switcher {
184
+ position: absolute;
185
+ right: 20px;
186
+ top: 10px;
187
+ background: #444;
188
+ color: #f1f1f1;
189
+ border: none;
190
+ border-radius: 4px;
191
+ padding: 6px 14px;
192
+ cursor: pointer;
193
+ font-size: 1em;
194
+ transition: background 0.2s, color 0.2s;
195
+ }
196
+ body.light-theme .theme-switcher {
197
+ background: #ddd;
198
+ color: #181a1b;
199
+ }
200
+ body.dark-theme .theme-switcher {
201
+ background: #23272b;
202
+ color: #f1f1f1;
203
+ }
204
+
205
+ /* Explorer file/dir links */
206
+ .explorer-link, .explorer-link:visited {
207
+ color: #90caf9;
208
+ text-decoration: none;
209
+ font-weight: 500;
210
+ }
211
+ body.light-theme .explorer-link, body.light-theme .explorer-link:visited {
212
+ color: #1976d2;
213
+ }
214
+ .explorer-link:hover {
215
+ text-decoration: underline;
216
+ color: #42a5f5;
217
+ }
218
+ body.light-theme .explorer-link:hover {
219
+ color: #1565c0;
220
+ }
221
+
222
+ @media (max-width: 900px) {
223
+ .main {
224
+ flex-direction: column;
225
+ gap: 1em;
226
+ padding: 1em;
227
+ }
228
+ #explorer-main, #explorer-preview {
229
+ min-height: 20vh;
230
+ padding: 1em 0.7em;
231
+ }
232
+ #explorer-preview {
233
+ margin-left: 0;
234
+ }
235
+ }