janito 2.3.1__py3-none-any.whl → 2.5.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 (107) hide show
  1. janito/__init__.py +1 -1
  2. janito/_version.py +57 -0
  3. janito/agent/setup_agent.py +95 -21
  4. janito/agent/templates/profiles/system_prompt_template_assistant.txt.j2 +1 -0
  5. janito/agent/templates/profiles/system_prompt_template_developer.txt.j2 +44 -0
  6. janito/cli/chat_mode/bindings.py +21 -2
  7. janito/cli/chat_mode/chat_entry.py +2 -3
  8. janito/cli/chat_mode/prompt_style.py +5 -0
  9. janito/cli/chat_mode/script_runner.py +153 -0
  10. janito/cli/chat_mode/session.py +128 -122
  11. janito/cli/chat_mode/session_profile_select.py +80 -0
  12. janito/cli/chat_mode/shell/commands/__init__.py +19 -9
  13. janito/cli/chat_mode/shell/commands/_priv_check.py +5 -0
  14. janito/cli/chat_mode/shell/commands/bang.py +36 -0
  15. janito/cli/chat_mode/shell/commands/conversation_restart.py +31 -24
  16. janito/cli/chat_mode/shell/commands/execute.py +42 -0
  17. janito/cli/chat_mode/shell/commands/help.py +7 -4
  18. janito/cli/chat_mode/shell/commands/model.py +28 -0
  19. janito/cli/chat_mode/shell/commands/prompt.py +0 -8
  20. janito/cli/chat_mode/shell/commands/read.py +37 -0
  21. janito/cli/chat_mode/shell/commands/tools.py +45 -18
  22. janito/cli/chat_mode/shell/commands/write.py +37 -0
  23. janito/cli/chat_mode/shell/commands.bak.zip +0 -0
  24. janito/cli/chat_mode/shell/input_history.py +1 -1
  25. janito/cli/chat_mode/shell/session/manager.py +0 -68
  26. janito/cli/chat_mode/shell/session.bak.zip +0 -0
  27. janito/cli/chat_mode/toolbar.py +44 -27
  28. janito/cli/cli_commands/list_tools.py +44 -11
  29. janito/cli/cli_commands/model_utils.py +95 -95
  30. janito/cli/cli_commands/show_system_prompt.py +57 -14
  31. janito/cli/config.py +5 -6
  32. janito/cli/core/getters.py +33 -33
  33. janito/cli/core/runner.py +27 -20
  34. janito/cli/core/setters.py +10 -1
  35. janito/cli/main_cli.py +40 -10
  36. janito/cli/prompt_core.py +18 -2
  37. janito/cli/prompt_setup.py +56 -0
  38. janito/cli/rich_terminal_reporter.py +21 -6
  39. janito/cli/single_shot_mode/handler.py +24 -77
  40. janito/cli/verbose_output.py +1 -1
  41. janito/config_manager.py +125 -112
  42. janito/drivers/dashscope.bak.zip +0 -0
  43. janito/drivers/driver_registry.py +0 -2
  44. janito/drivers/openai/README.md +20 -0
  45. janito/drivers/openai_responses.bak.zip +0 -0
  46. janito/event_bus/event.py +2 -2
  47. janito/formatting_token.py +7 -6
  48. janito/i18n/pt.py +0 -1
  49. janito/llm/README.md +23 -0
  50. janito/llm/agent.py +80 -16
  51. janito/llm/auth.py +63 -63
  52. janito/llm/driver.py +8 -0
  53. janito/provider_registry.py +178 -176
  54. janito/providers/__init__.py +0 -2
  55. janito/providers/azure_openai/model_info.py +16 -16
  56. janito/providers/dashscope.bak.zip +0 -0
  57. janito/providers/provider_static_info.py +0 -3
  58. janito/providers/registry.py +26 -26
  59. janito/shell.bak.zip +0 -0
  60. janito/tools/DOCSTRING_STANDARD.txt +33 -0
  61. janito/tools/README.md +3 -0
  62. janito/tools/__init__.py +20 -6
  63. janito/tools/adapters/local/__init__.py +65 -62
  64. janito/tools/adapters/local/adapter.py +18 -35
  65. janito/tools/adapters/local/ask_user.py +3 -4
  66. janito/tools/adapters/local/copy_file.py +2 -2
  67. janito/tools/adapters/local/create_directory.py +2 -2
  68. janito/tools/adapters/local/create_file.py +2 -2
  69. janito/tools/adapters/local/delete_text_in_file.py +2 -2
  70. janito/tools/adapters/local/fetch_url.py +2 -2
  71. janito/tools/adapters/local/find_files.py +2 -1
  72. janito/tools/adapters/local/get_file_outline/core.py +2 -2
  73. janito/tools/adapters/local/get_file_outline/search_outline.py +2 -2
  74. janito/tools/adapters/local/move_file.py +2 -2
  75. janito/tools/adapters/local/open_html_in_browser.py +2 -1
  76. janito/tools/adapters/local/open_url.py +2 -2
  77. janito/tools/adapters/local/python_code_run.py +3 -3
  78. janito/tools/adapters/local/python_command_run.py +3 -3
  79. janito/tools/adapters/local/python_file_run.py +3 -3
  80. janito/tools/adapters/local/remove_directory.py +2 -2
  81. janito/tools/adapters/local/remove_file.py +2 -2
  82. janito/tools/adapters/local/replace_text_in_file.py +2 -2
  83. janito/tools/adapters/local/run_bash_command.py +3 -3
  84. janito/tools/adapters/local/run_powershell_command.py +3 -3
  85. janito/tools/adapters/local/search_text/core.py +2 -2
  86. janito/tools/adapters/local/validate_file_syntax/core.py +3 -3
  87. janito/tools/adapters/local/view_file.py +2 -1
  88. janito/tools/outline_file.bak.zip +0 -0
  89. janito/tools/permissions.py +45 -0
  90. janito/tools/permissions_parse.py +12 -0
  91. janito/tools/tool_base.py +14 -11
  92. janito/tools/tool_utils.py +4 -6
  93. janito/tools/tools_adapter.py +25 -20
  94. {janito-2.3.1.dist-info → janito-2.5.0.dist-info}/METADATA +46 -24
  95. {janito-2.3.1.dist-info → janito-2.5.0.dist-info}/RECORD +99 -82
  96. janito/agent/templates/profiles/system_prompt_template_base_pt.txt.j2 +0 -13
  97. janito/agent/templates/profiles/system_prompt_template_main.txt.j2 +0 -37
  98. janito/cli/chat_mode/shell/commands/edit.py +0 -25
  99. janito/cli/chat_mode/shell/commands/exec.py +0 -27
  100. janito/cli/chat_mode/shell/commands/termweb_log.py +0 -92
  101. janito/cli/termweb_starter.py +0 -122
  102. janito/termweb/app.py +0 -95
  103. janito/version.py +0 -4
  104. {janito-2.3.1.dist-info → janito-2.5.0.dist-info}/WHEEL +0 -0
  105. {janito-2.3.1.dist-info → janito-2.5.0.dist-info}/entry_points.txt +0 -0
  106. {janito-2.3.1.dist-info → janito-2.5.0.dist-info}/licenses/LICENSE +0 -0
  107. {janito-2.3.1.dist-info → janito-2.5.0.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@ import os
3
3
  import sys
4
4
  import tempfile
5
5
  import threading
6
- from janito.tools.tool_base import ToolBase
6
+ from janito.tools.tool_base import ToolBase, ToolPermissions
7
7
  from janito.report_events import ReportAction
8
8
  from janito.tools.adapters.local.adapter import register_local_tool
9
9
  from janito.i18n import tr
@@ -14,14 +14,14 @@ class PythonFileRunTool(ToolBase):
14
14
  """
15
15
  Tool to execute a specified Python script file.
16
16
 
17
- Parameters:
17
+ Args:
18
18
  file_path (str): Path to the Python script file to execute.
19
19
  timeout (int): Timeout in seconds for the command. Defaults to 60.
20
20
 
21
21
  Returns:
22
22
  str: Output and status message, or file paths/line counts if output is large.
23
23
  """
24
- provides_execution = True
24
+ permissions = ToolPermissions(execute=True)
25
25
  tool_name = "python_file_run"
26
26
 
27
27
  def run(self, file_path: str, timeout: int = 60) -> str:
@@ -1,4 +1,4 @@
1
- from janito.tools.tool_base import ToolBase
1
+ from janito.tools.tool_base import ToolBase, ToolPermissions
2
2
  from janito.report_events import ReportAction
3
3
  from janito.tools.adapters.local.adapter import register_local_tool
4
4
  from janito.tools.tool_utils import pluralize, display_path
@@ -21,7 +21,7 @@ class RemoveDirectoryTool(ToolBase):
21
21
  - "Directory removed: /path/to/dir"
22
22
  - "Error removing directory: <error message>"
23
23
  """
24
-
24
+ permissions = ToolPermissions(write=True)
25
25
  tool_name = "remove_directory"
26
26
 
27
27
  def run(self, file_path: str, recursive: bool = False) -> str:
@@ -3,7 +3,7 @@ import shutil
3
3
  from janito.tools.adapters.local.adapter import register_local_tool
4
4
 
5
5
  from janito.tools.tool_utils import display_path
6
- from janito.tools.tool_base import ToolBase
6
+ from janito.tools.tool_base import ToolBase, ToolPermissions
7
7
  from janito.report_events import ReportAction
8
8
  from janito.i18n import tr
9
9
 
@@ -21,7 +21,7 @@ class RemoveFileTool(ToolBase):
21
21
  - " Successfully removed the file at ..."
22
22
  - " Cannot remove file: ..."
23
23
  """
24
-
24
+ permissions = ToolPermissions(write=True)
25
25
  tool_name = "remove_file"
26
26
 
27
27
  def run(self, file_path: str, backup: bool = False) -> str:
@@ -1,4 +1,4 @@
1
- from janito.tools.tool_base import ToolBase
1
+ from janito.tools.tool_base import ToolBase, ToolPermissions
2
2
  from janito.report_events import ReportAction
3
3
  from janito.tools.adapters.local.adapter import register_local_tool
4
4
  from janito.i18n import tr
@@ -28,7 +28,7 @@ class ReplaceTextInFileTool(ToolBase):
28
28
  - "No changes made. [Warning: Search text not found in file] Please review the original file."
29
29
  - "Error replacing text: <error message>"
30
30
  """
31
-
31
+ permissions = ToolPermissions(read=True, write=True)
32
32
  tool_name = "replace_text_in_file"
33
33
 
34
34
  def run(
@@ -1,4 +1,4 @@
1
- from janito.tools.tool_base import ToolBase
1
+ from janito.tools.tool_base import ToolBase, ToolPermissions
2
2
  from janito.report_events import ReportAction
3
3
  from janito.tools.adapters.local.adapter import register_local_tool
4
4
  from janito.i18n import tr
@@ -15,7 +15,7 @@ class RunBashCommandTool(ToolBase):
15
15
  Execute a non-interactive command using the bash shell and capture live output.
16
16
  This tool explicitly invokes the 'bash' shell (not just the system default shell), so it requires bash to be installed and available in the system PATH. On Windows, this will only work if bash is available (e.g., via WSL, Git Bash, or similar).
17
17
 
18
- Parameters:
18
+ Args:
19
19
  command (str): The bash command to execute.
20
20
  timeout (int): Timeout in seconds for the command. Defaults to 60.
21
21
  require_confirmation (bool): If True, require user confirmation before running. Defaults to False.
@@ -24,7 +24,7 @@ class RunBashCommandTool(ToolBase):
24
24
  Returns:
25
25
  str: File paths and line counts for stdout and stderr.
26
26
  """
27
- provides_execution = True
27
+ permissions = ToolPermissions(execute=True)
28
28
  tool_name = "run_bash_command"
29
29
 
30
30
  def _stream_output(self, stream, file_obj, report_func, count_func, counter):
@@ -1,4 +1,4 @@
1
- from janito.tools.tool_base import ToolBase
1
+ from janito.tools.tool_base import ToolBase, ToolPermissions
2
2
  from janito.report_events import ReportAction
3
3
  from janito.tools.adapters.local.adapter import register_local_tool
4
4
  from janito.i18n import tr
@@ -17,7 +17,7 @@ class RunPowershellCommandTool(ToolBase):
17
17
  $OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8;
18
18
  For file output, it is recommended to use -Encoding utf8 in your PowerShell commands (e.g., Out-File -Encoding utf8) to ensure correct file encoding.
19
19
 
20
- Parameters:
20
+ Args:
21
21
  command (str): The PowerShell command to execute. This string is passed directly to PowerShell using the --Command argument (not as a script file).
22
22
  timeout (int): Timeout in seconds for the command. Defaults to 60.
23
23
  require_confirmation (bool): If True, require user confirmation before running. Defaults to False.
@@ -26,7 +26,7 @@ class RunPowershellCommandTool(ToolBase):
26
26
  Returns:
27
27
  str: Output and status message, or file paths/line counts if output is large.
28
28
  """
29
- provides_execution = True
29
+ permissions = ToolPermissions(execute=True)
30
30
  tool_name = "run_powershell_command"
31
31
 
32
32
  def _confirm_and_warn(self, command, require_confirmation, requires_user_input):
@@ -1,4 +1,4 @@
1
- from janito.tools.tool_base import ToolBase
1
+ from janito.tools.tool_base import ToolBase, ToolPermissions
2
2
  from janito.report_events import ReportAction
3
3
  from janito.tools.adapters.local.adapter import register_local_tool
4
4
  from janito.tools.tool_utils import pluralize, display_path
@@ -29,7 +29,7 @@ class SearchTextTool(ToolBase):
29
29
  If count_only is True, returns per-file and total match counts.
30
30
  If max_results is reached, appends a note to the output.
31
31
  """
32
-
32
+ permissions = ToolPermissions(read=True)
33
33
  tool_name = "search_text"
34
34
 
35
35
  def _handle_file(
@@ -1,6 +1,6 @@
1
1
  import os
2
2
  from janito.i18n import tr
3
- from janito.tools.tool_base import ToolBase
3
+ from janito.tools.tool_base import ToolBase, ToolPermissions
4
4
  from janito.report_events import ReportAction
5
5
  from janito.tools.adapters.local.adapter import register_local_tool
6
6
  from janito.tools.tool_utils import display_path
@@ -82,7 +82,7 @@ class ValidateFileSyntaxTool(ToolBase):
82
82
  - "⚠️ Warning: Syntax error: <error message>"
83
83
  - "⚠️ Warning: Unsupported file extension: <ext>"
84
84
  """
85
-
85
+ permissions = ToolPermissions(read=True)
86
86
  tool_name = "validate_file_syntax"
87
87
 
88
88
  def run(self, file_path: str) -> str:
@@ -96,7 +96,7 @@ class ValidateFileSyntaxTool(ToolBase):
96
96
  )
97
97
  result = validate_file_syntax(
98
98
  file_path,
99
- report_info=self.report_info,
99
+
100
100
  report_warning=self.report_warning,
101
101
  report_success=self.report_success,
102
102
  )
@@ -1,4 +1,4 @@
1
- from janito.tools.tool_base import ToolBase
1
+ from janito.tools.tool_base import ToolBase, ToolPermissions
2
2
  from janito.report_events import ReportAction
3
3
  from janito.tools.adapters.local.adapter import register_local_tool
4
4
  from janito.tools.tool_utils import pluralize
@@ -25,6 +25,7 @@ class ViewFileTool(ToolBase):
25
25
  - "❗ not found"
26
26
  """
27
27
 
28
+ permissions = ToolPermissions(read=True)
28
29
  tool_name = "view_file"
29
30
 
30
31
  def run(self, file_path: str, from_line: int = None, to_line: int = None) -> str:
Binary file
@@ -0,0 +1,45 @@
1
+ from janito.tools.tool_base import ToolPermissions
2
+
3
+ class AllowedPermissionsState:
4
+ _instance = None
5
+ _permissions = ToolPermissions(read=False, write=False, execute=False)
6
+ _default_permissions = None
7
+
8
+ def __new__(cls):
9
+ if cls._instance is None:
10
+ cls._instance = super().__new__(cls)
11
+ return cls._instance
12
+
13
+ @classmethod
14
+ def get_permissions(cls):
15
+ return cls._permissions
16
+
17
+ @classmethod
18
+ def set_permissions(cls, permissions):
19
+ if not isinstance(permissions, ToolPermissions):
20
+ raise ValueError("permissions must be a ToolPermissions instance")
21
+ cls._permissions = permissions
22
+
23
+ @classmethod
24
+ def set_default_permissions(cls, permissions):
25
+ if not isinstance(permissions, ToolPermissions):
26
+ raise ValueError("permissions must be a ToolPermissions instance")
27
+ cls._default_permissions = permissions
28
+
29
+ @classmethod
30
+ def get_default_permissions(cls):
31
+ return cls._default_permissions
32
+
33
+ # Convenience functions
34
+
35
+ def get_global_allowed_permissions():
36
+ return AllowedPermissionsState.get_permissions()
37
+
38
+ def set_global_allowed_permissions(permissions):
39
+ AllowedPermissionsState.set_permissions(permissions)
40
+
41
+ def set_default_allowed_permissions(permissions):
42
+ AllowedPermissionsState.set_default_permissions(permissions)
43
+
44
+ def get_default_allowed_permissions():
45
+ return AllowedPermissionsState.get_default_permissions()
@@ -0,0 +1,12 @@
1
+ from janito.tools.tool_base import ToolPermissions
2
+
3
+ def parse_permissions_string(perm_str: str) -> ToolPermissions:
4
+ """
5
+ Parse a string like 'rwx', 'rw', 'r', etc. into a ToolPermissions object.
6
+ """
7
+ perm_str = perm_str.lower()
8
+ return ToolPermissions(
9
+ read='r' in perm_str,
10
+ write='w' in perm_str,
11
+ execute='x' in perm_str,
12
+ )
janito/tools/tool_base.py CHANGED
@@ -2,14 +2,27 @@ from janito.report_events import ReportEvent, ReportSubtype, ReportAction
2
2
  from janito.event_bus.bus import event_bus as default_event_bus
3
3
 
4
4
 
5
+ from collections import namedtuple
6
+
7
+ class ToolPermissions(namedtuple('ToolPermissions', ['read', 'write', 'execute'])):
8
+ __slots__ = ()
9
+ def __new__(cls, read=False, write=False, execute=False):
10
+ return super().__new__(cls, read, write, execute)
11
+
12
+ def __repr__(self):
13
+ return f"ToolPermissions(read={self.read}, write={self.write}, execute={self.execute})"
14
+
15
+
5
16
  class ToolBase:
6
17
  """
7
18
  Base class for all tools in the janito project.
8
19
  Extend this class to implement specific tool functionality.
9
20
  """
10
- provides_execution = False # Indicates if the tool provides execution capability (default: False)
21
+ permissions: 'ToolPermissions' = None # Required: must be set by subclasses
11
22
 
12
23
  def __init__(self, name=None, event_bus=None):
24
+ if self.permissions is None or not isinstance(self.permissions, ToolPermissions):
25
+ raise ValueError(f"Tool '{self.__class__.__name__}' must define a 'permissions' attribute of type ToolPermissions.")
13
26
  self.name = name or self.__class__.__name__
14
27
  self._event_bus = event_bus or default_event_bus
15
28
 
@@ -35,16 +48,6 @@ class ToolBase:
35
48
  )
36
49
  )
37
50
 
38
- def report_info(self, message: str, context: dict = None):
39
- self._event_bus.publish(
40
- ReportEvent(
41
- subtype=ReportSubtype.ACTION_INFO,
42
- message=message,
43
- action=None,
44
- tool=self.name,
45
- context=context,
46
- )
47
- )
48
51
 
49
52
  def report_error(self, message: str, context: dict = None):
50
53
  self._event_bus.publish(
@@ -20,9 +20,8 @@ def display_path(path):
20
20
  Returns:
21
21
  str: Display path, as an ANSI hyperlink.
22
22
  """
23
- from janito.cli.config import get_termweb_port
24
-
25
- port = get_termweb_port()
23
+
24
+ port = 8088
26
25
  if os.path.isabs(path):
27
26
  cwd = os.path.abspath(os.getcwd())
28
27
  abs_path = os.path.abspath(path)
@@ -33,9 +32,8 @@ def display_path(path):
33
32
  disp = path
34
33
  else:
35
34
  disp = os.path.relpath(path)
36
- url = f"http://localhost:{port}/?path={urllib.parse.quote(path)}"
37
- # Use Rich markup for hyperlinks
38
- return f"[link={url}]{disp}[/link]"
35
+ # URL injection removed; just return display path
36
+ return disp
39
37
 
40
38
 
41
39
  def pluralize(word: str, count: int) -> str:
@@ -1,8 +1,7 @@
1
1
  from janito.tools.tool_base import ToolBase
2
2
  from janito.tools.tool_events import ToolCallStarted, ToolCallFinished, ToolCallError
3
3
  from janito.exceptions import ToolCallException
4
- from typing import Optional
5
-
4
+ from janito.tools.tool_base import ToolPermissions
6
5
 
7
6
  class ToolsAdapterBase:
8
7
  """
@@ -13,11 +12,10 @@ class ToolsAdapterBase:
13
12
  """
14
13
 
15
14
  def __init__(
16
- self, tools=None, event_bus=None, enabled_tools: Optional[list] = None
15
+ self, tools=None, event_bus=None
17
16
  ):
18
17
  self._tools = tools or []
19
18
  self._event_bus = event_bus # event bus can be set on all adapters
20
- self._enabled_tools = set(enabled_tools) if enabled_tools is not None else None
21
19
  self.verbose_tools = False
22
20
 
23
21
  def set_verbose_tools(self, value: bool):
@@ -31,11 +29,28 @@ class ToolsAdapterBase:
31
29
  def event_bus(self, bus):
32
30
  self._event_bus = bus
33
31
 
32
+ def is_tool_allowed(self, tool):
33
+ """Check if a tool is allowed based on current global AllowedPermissionsState."""
34
+ from janito.tools.permissions import get_global_allowed_permissions
35
+ allowed_permissions = get_global_allowed_permissions()
36
+ perms = tool.permissions # permissions are mandatory and type-checked
37
+ # If all permissions are False, block all tools
38
+ if not (allowed_permissions.read or allowed_permissions.write or allowed_permissions.execute):
39
+ return False
40
+ for perm in ['read', 'write', 'execute']:
41
+ if getattr(perms, perm) and not getattr(allowed_permissions, perm):
42
+ return False
43
+ return True
44
+
34
45
  def get_tools(self):
35
- """Return the list of enabled tools managed by this provider."""
36
- if self._enabled_tools is None:
37
- return self._tools
38
- return [tool for tool in self._tools if getattr(tool, 'tool_name', None) in self._enabled_tools]
46
+ """Return the list of enabled tools managed by this provider, filtered by allowed permissions."""
47
+ tools = [tool for tool in self._tools if self.is_tool_allowed(tool)]
48
+ return tools
49
+
50
+ def set_allowed_permissions(self, allowed_permissions):
51
+ """Set the allowed permissions at runtime. This now updates the global AllowedPermissionsState only."""
52
+ from janito.tools.permissions import set_global_allowed_permissions
53
+ set_global_allowed_permissions(allowed_permissions)
39
54
 
40
55
  def add_tool(self, tool):
41
56
  self._tools.append(tool)
@@ -231,18 +246,8 @@ class ToolsAdapterBase:
231
246
  )
232
247
 
233
248
  def _check_tool_permissions(self, tool_name, request_id, arguments):
234
- if self._enabled_tools is not None and tool_name not in self._enabled_tools:
235
- error_msg = f"Tool '{tool_name}' is not enabled in this adapter."
236
- if self._event_bus:
237
- self._event_bus.publish(
238
- ToolCallError(
239
- tool_name=tool_name,
240
- request_id=request_id,
241
- error=error_msg,
242
- arguments=arguments,
243
- )
244
- )
245
- raise ToolCallException(tool_name, error_msg, arguments=arguments)
249
+ # No enabled_tools check anymore; permission checks are handled by is_tool_allowed
250
+ pass
246
251
 
247
252
  def _ensure_tool_exists(self, tool, tool_name, request_id, arguments):
248
253
  if tool is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janito
3
- Version: 2.3.1
3
+ Version: 2.5.0
4
4
  Summary: A new Python package called janito.
5
5
  Author-email: João Pinto <lamego.pinto@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/janito-dev/janito
@@ -17,7 +17,7 @@ Requires-Dist: prompt_toolkit>=3.0.51
17
17
  Requires-Dist: lxml>=5.4.0
18
18
  Requires-Dist: requests>=2.32.4
19
19
  Requires-Dist: bs4>=0.0.2
20
- Requires-Dist: openai
20
+ Requires-Dist: questionary>=2.0.1
21
21
  Provides-Extra: dev
22
22
  Requires-Dist: pytest; extra == "dev"
23
23
  Requires-Dist: pre-commit; extra == "dev"
@@ -25,7 +25,8 @@ Requires-Dist: ruff==0.11.9; extra == "dev"
25
25
  Requires-Dist: detect-secrets==1.4.0; extra == "dev"
26
26
  Requires-Dist: codespell==2.4.1; extra == "dev"
27
27
  Requires-Dist: black; extra == "dev"
28
- Requires-Dist: openai; extra == "dev"
28
+ Requires-Dist: questionary>=2.0.1; extra == "dev"
29
+ Requires-Dist: setuptools_scm>=8.0; extra == "dev"
29
30
  Dynamic: license-file
30
31
 
31
32
  # Janito
@@ -106,6 +107,21 @@ janito -set provider=PROVIDER
106
107
 
107
108
  After installation, use the `janito` command in your terminal.
108
109
 
110
+ Janito supports both general-purpose and specialized assistance through the use of **profiles**. Profiles allow you to select a specific system prompt template and behavior for the agent, enabling workflows tailored to different roles or tasks (e.g., developer, writer, data analyst), or to use Janito as a generic AI assistant.
111
+
112
+ ### Profiles: General-Purpose and Specialized Assistance
113
+
114
+ - By default, Janito acts as a general-purpose assistant.
115
+ - You can select a specialized profile using the `--profile` option:
116
+ ```bash
117
+ janito --profile developer "Refactor this code for better readability."
118
+ janito --profile writer "Draft a blog post about AI in healthcare."
119
+ ```
120
+ - Profiles change the system prompt and agent behavior to suit the selected role or workflow.
121
+ - To see available profiles or customize them, refer to the documentation or the `agent/templates/profiles/` directory.
122
+
123
+ > **Tip:** Use `--profile` for targeted workflows, or omit it for a general-purpose assistant.
124
+
109
125
  Janito has configuration options, like `--set api-key API_KEY` and `--set provider=PROVIDER`, that create durable configurations and single shoot options, like `-p PROVIDER` and `-m MODEL`, that are active for the single run of the command or session.
110
126
 
111
127
  ### Basic Commands
@@ -151,27 +167,27 @@ Janito has configuration options, like `--set api-key API_KEY` and `--set provid
151
167
 
152
168
  ### Advanced Options
153
169
 
154
- - **Enable Inline Web File Viewer for Clickable Links**
155
-
156
- 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:
170
+ - **Enable Execution Tools (Code/Shell Execution)**
157
171
 
158
- ```bash
159
- janito -w
160
- ```
172
+ By default, **all tool privileges (read, write, execute)** are disabled for safety. This means Janito starts with no permissions to run tools that read, write, or execute code/shell commands unless you explicitly enable them.
161
173
 
162
- 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.
163
-
164
- > **Tip:** Use with the interactive shell for the best experience with clickable file links.
174
+ - To enable **read** tools (e.g., file reading, searching): add `-r` or `--read`
175
+ - To enable **write** tools (e.g., file editing): add `-w` or `--write`
176
+ - To enable **execution** tools (code/shell execution): add `-x` or `--exec`
165
177
 
178
+ You can combine these flags as needed. For example, to enable both read and write tools:
166
179
 
167
- - **Enable Execution Tools (Code/Shell Execution)**
168
-
169
- 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:
170
-
171
- ```bash
172
- janito -x "Run this code: print('Hello, world!')"
173
- ```
174
- > **Warning:** Enabling execution tools allows running arbitrary code or shell commands. Only use `--exec` if you trust your prompt and environment.
180
+ ```bash
181
+ janito -r -w "Read and update this file: ..."
182
+ ```
183
+
184
+ To enable all permissions (read, write, execute):
185
+
186
+ ```bash
187
+ janito -r -w -x "Run this code: print('Hello, world!')"
188
+ ```
189
+
190
+ > **Warning:** Enabling execution tools allows running arbitrary code or shell commands. Only use `--exec` if you trust your prompt and environment.
175
191
 
176
192
  - **Set a System Prompt**
177
193
  ```bash
@@ -203,7 +219,7 @@ Janito has configuration options, like `--set api-key API_KEY` and `--set provid
203
219
  ### Core CLI Options
204
220
  | Option | Description |
205
221
  |------------------------|-----------------------------------------------------------------------------|
206
- | `-w`, `--web` | Enable the builtin lightweight web file viewer for clickable file links (termweb). |
222
+
207
223
  | `--version` | Show program version |
208
224
  | `--list-tools` | List all registered tools |
209
225
  | `--list-providers` | List all supported LLM providers |
@@ -212,7 +228,7 @@ Janito has configuration options, like `--set api-key API_KEY` and `--set provid
212
228
  | `--set provider=name` | Set the current LLM provider (e.g., `janito --set provider=openai`) |
213
229
  | `--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`) |
214
230
  | `-s`, `--system` | Set a system prompt (e.g., `janito -s path/to/system_prompt.txt "Your prompt here"`) |
215
- | `-r`, `--role` | Set the role for the agent (overrides config) (e.g., `janito -r "assistant" "Your prompt here"`) |
231
+
216
232
  | `-p`, `--provider` | Select LLM provider (overrides config) (e.g., `janito -p openai "Your prompt here"`) |
217
233
  | `-m`, `--model` | Select model for the provider (e.g., `janito -m gpt-3.5-turbo "Your prompt here"`) |
218
234
  | `-v`, `--verbose` | Print extra information before answering |
@@ -246,8 +262,8 @@ Once inside the interactive chat mode, you can use these slash commands:
246
262
  | Command | Description |
247
263
  |----------------------|----------------------------------------------|
248
264
  | `/tools` | List available tools |
249
- | `/termweb-status` | Show status of termweb server |
250
- | `/termweb-logs` | Show last lines of termweb logs |
265
+ | `/-status` | Show status of server |
266
+ | `/-logs` | Show last lines of logs |
251
267
  | `/livelogs` | Show live updates from server log file |
252
268
  | `/edit <filename>` | Open file in browser-based editor |
253
269
 
@@ -274,6 +290,12 @@ See [docs/supported-providers-models.md](docs/supported-providers-models.md) for
274
290
 
275
291
  Contributions are welcome! Please see the `CONTRIBUTING.md` (if available) or open an issue to get started.
276
292
 
293
+ ---
294
+
295
+ ## Developer Documentation
296
+
297
+ For developer-specific setup, versioning, and contribution guidelines, see [README-dev.md](./README-dev.md).
298
+
277
299
  ## License
278
300
 
279
301
  This project is licensed under the terms of the MIT license.