janito 2.5.0__py3-none-any.whl → 2.5.1__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.
@@ -156,6 +156,7 @@ def setup_agent(
156
156
  agent.template_vars["profile"] = profile
157
157
  # Store template path and context for dynamic prompt refresh
158
158
  agent.system_prompt_template = str(template_path)
159
+
159
160
  agent._template_vars = context.copy()
160
161
  agent._original_template_vars = context.copy()
161
162
  return agent
@@ -17,8 +17,7 @@ def handle_restart(shell_state=None):
17
17
  # Reset system prompt to original template context if available
18
18
  if hasattr(shell_state.agent, "_original_template_vars"):
19
19
  shell_state.agent._template_vars = shell_state.agent._original_template_vars.copy()
20
- if hasattr(shell_state.agent, "_refresh_system_prompt_from_template"):
21
- shell_state.agent._refresh_system_prompt_from_template()
20
+ shell_state.agent.refresh_system_prompt_from_template()
22
21
  # No need to print the system prompt after restart
23
22
 
24
23
  # Reset tool use tracker
@@ -62,8 +61,8 @@ def handle_restart(shell_state=None):
62
61
  janito.tools.local_tools_adapter.set_allowed_permissions(ToolPermissions(read=False, write=False, execute=False))
63
62
  msg = "[green]All tool permissions have been set to OFF (read, write, execute = False).[/green]"
64
63
  # Refresh system prompt to reflect new permissions
65
- if hasattr(shell_state, "agent") and shell_state.agent and hasattr(shell_state.agent, "_refresh_system_prompt_from_template"):
66
- shell_state.agent._refresh_system_prompt_from_template()
64
+ if hasattr(shell_state, "agent") and shell_state.agent and hasattr(shell_state.agent, "refresh_system_prompt_from_template"):
65
+ shell_state.agent.refresh_system_prompt_from_template()
67
66
  if msg:
68
67
  shared_console.print(msg)
69
68
 
@@ -33,8 +33,7 @@ class ExecuteShellHandler(ShellCmdHandler):
33
33
  # Refresh system prompt if agent is available
34
34
  agent = getattr(self.shell_state, "agent", None)
35
35
  if agent:
36
- if hasattr(agent, "_refresh_system_prompt_from_template"):
37
- agent._refresh_system_prompt_from_template()
36
+ agent.refresh_system_prompt_from_template()
38
37
  # No need to print the system prompt after permission change
39
38
  if enable:
40
39
  shared_console.print("[green]Execution tools ENABLED. Tools can now execute code and commands.[/green]")
@@ -41,14 +41,7 @@ class RoleShellHandler(ShellCmdHandler):
41
41
  if agent and hasattr(agent, "set_template_var"):
42
42
  agent.set_template_var("role", new_role)
43
43
  # Refresh the system prompt with the new role if possible
44
- if (
45
- hasattr(agent, "set_system_using_template")
46
- and hasattr(agent, "_system_prompt_template_file")
47
- and agent._system_prompt_template_file
48
- ):
49
- agent.set_system_using_template(
50
- agent._system_prompt_template_file, **agent.template_vars
51
- )
44
+ agent.refresh_system_prompt_from_template()
52
45
  shared_console.print(
53
46
  f"[bold green]System role updated to:[/bold green] {new_role}"
54
47
  )
@@ -28,8 +28,7 @@ class ReadShellHandler(ShellCmdHandler):
28
28
  # Refresh system prompt if agent is available
29
29
  agent = getattr(self.shell_state, "agent", None)
30
30
  if agent:
31
- if hasattr(agent, "_refresh_system_prompt_from_template"):
32
- agent._refresh_system_prompt_from_template()
31
+ agent.refresh_system_prompt_from_template()
33
32
  # No need to print the system prompt after permission change
34
33
  if enable:
35
34
  shared_console.print("[green]Read permissions ENABLED. Tools can now read files and data.[/green]")
@@ -20,15 +20,8 @@ class RoleCommandShellHandler(ShellCmdHandler):
20
20
  new_role = " ".join(args)
21
21
  self.handler.agent.template_vars["role"] = new_role
22
22
  # Refresh the system prompt with the new role if possible
23
- if (
24
- hasattr(self.handler.agent, "set_system_using_template")
25
- and hasattr(self.handler.agent, "_system_prompt_template_file")
26
- and self.handler.agent._system_prompt_template_file
27
- ):
28
- self.handler.agent.set_system_using_template(
29
- self.handler.agent._system_prompt_template_file,
30
- **self.handler.agent.template_vars,
31
- )
23
+ self.handler.agent.refresh_system_prompt_from_template()
24
+
32
25
  return f"Role set to: {new_role}"
33
26
 
34
27
  def get_completions(self, document, complete_event):
@@ -28,8 +28,7 @@ class WriteShellHandler(ShellCmdHandler):
28
28
  # Refresh system prompt if agent is available
29
29
  agent = getattr(self.shell_state, "agent", None)
30
30
  if agent:
31
- if hasattr(agent, "_refresh_system_prompt_from_template"):
32
- agent._refresh_system_prompt_from_template()
31
+ agent.refresh_system_prompt_from_template()
33
32
  # No need to print the system prompt after permission change
34
33
  if enable:
35
34
  shared_console.print("[green]Write permissions ENABLED. Tools can now write files and data.[/green]")
janito/llm/agent.py CHANGED
@@ -87,7 +87,7 @@ class LLMAgent:
87
87
  template = env.get_template(Path(template_path).name)
88
88
  self.system_prompt = template.render(**kwargs)
89
89
 
90
- def _refresh_system_prompt_from_template(self):
90
+ def refresh_system_prompt_from_template(self):
91
91
  if hasattr(self, "_template_vars") and hasattr(self, "system_prompt_template"):
92
92
  env = Environment(
93
93
  loader=FileSystemLoader(Path(self.system_prompt_template).parent),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janito
3
- Version: 2.5.0
3
+ Version: 2.5.1
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
@@ -18,7 +18,7 @@ janito/provider_registry.py,sha256=THlyJLhAr0hTb4OuLHc7BcOjTYy0LG-THc-kZRk3PCI,7
18
18
  janito/report_events.py,sha256=q4OR_jTZNfcqaQF_fzTjgqo6_VlUIxSGWfhpT4nJWcw,938
19
19
  janito/shell.bak.zip,sha256=hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU,22
20
20
  janito/utils.py,sha256=eXSsMgM69YyzahgCNrJQLcEbB8ssLI1MQqaa20ONxbE,376
21
- janito/agent/setup_agent.py,sha256=CdhXRhnEJ6s3ZyIypBKVhyc9wJKzEKUw5Ph6a25sQAI,8568
21
+ janito/agent/setup_agent.py,sha256=Q0scfZWoPu_juZMRjYJWpBX5z4Jev4_i5WZMqEuVBO4,8574
22
22
  janito/agent/templates/profiles/system_prompt_template_assistant.txt.j2,sha256=dTV9aF8ji2r9dzi-l4b9r95kHrbKmjvnRxk5cVpopN4,28
23
23
  janito/agent/templates/profiles/system_prompt_template_developer.txt.j2,sha256=gIXF3dPgGxQnVqRBnT8r2sUGu7F_Sl0F4YF-TfyOKgI,2586
24
24
  janito/cli/__init__.py,sha256=xaPDOrWphBbCR63Xpcx_yfpXSJIlCaaICc4j2qpWqrM,194
@@ -48,23 +48,23 @@ janito/cli/chat_mode/shell/commands/_priv_check.py,sha256=LfIa_IbJBIhKT17K2cACbf
48
48
  janito/cli/chat_mode/shell/commands/bang.py,sha256=PE79ZDKb9l4cFGbHLdJbpBcKmJRvhyFQQcCrtofY0HQ,1746
49
49
  janito/cli/chat_mode/shell/commands/base.py,sha256=I6-SVOcRd7q4PpoutLdrbhbqeUpJic2oyPhOSMgMihA,288
50
50
  janito/cli/chat_mode/shell/commands/clear.py,sha256=wYEHGYcAohUoCJlbEhiXKfDbJvuzAVK4e9uirskIllw,422
51
- janito/cli/chat_mode/shell/commands/conversation_restart.py,sha256=CDPYOZMWkgBlq-xMJEwOTXTpw_nNY9eBSfbqLtB1e00,3725
52
- janito/cli/chat_mode/shell/commands/execute.py,sha256=OS7RHl2JS-tFOA9-YAvWEYnb7HvAKOFOr7MHagV6imM,2190
51
+ janito/cli/chat_mode/shell/commands/conversation_restart.py,sha256=oid5wjvE7HoutS5OXzIXkHJUJSPZXbeR8tN2T0qvuI0,3638
52
+ janito/cli/chat_mode/shell/commands/execute.py,sha256=P1JeTRQDN0nYDO3qeE5NQsrSwY9tTlWUxbphbaGyqbY,2113
53
53
  janito/cli/chat_mode/shell/commands/help.py,sha256=MvjnTskb7_z0aTbPML11Py2XYqBvLymzwIZgwE4bMpI,947
54
54
  janito/cli/chat_mode/shell/commands/history_view.py,sha256=9dyxYpDHjT77LEIikjBQA03Ep3P2AmKXUwUnVsG0OQc,3584
55
55
  janito/cli/chat_mode/shell/commands/lang.py,sha256=uIelDs3gPYDZ9X9gw7iDMmiwefT7TiBo32420pq2tW8,837
56
56
  janito/cli/chat_mode/shell/commands/livelogs.py,sha256=uJI14qyubXEz8m0Cajd-vURPYxC__7p_CNCq6PVOHN0,2142
57
57
  janito/cli/chat_mode/shell/commands/model.py,sha256=2tORoA5vdkAknbS9mnMi03gNKcLEkgmIuHPUHDGWxYo,1390
58
58
  janito/cli/chat_mode/shell/commands/multi.py,sha256=HAAk0fAO3n8KFta3I4hT_scOAlz4SxWDyaNBUJBQ4nc,1985
59
- janito/cli/chat_mode/shell/commands/prompt.py,sha256=z59Nbx0ny51AqBOj3CtK6GdvIt7ZvgEnFHwlaAhPZTI,2104
60
- janito/cli/chat_mode/shell/commands/read.py,sha256=AFdkfFWasoUQ8icvHROVEExyCip-sGPLumoUXNkqIFY,1972
61
- janito/cli/chat_mode/shell/commands/role.py,sha256=7A2S2wzE6lcv1rg4iLGH8vVy-TnzRE0Tn_wPRhBHLpY,1474
59
+ janito/cli/chat_mode/shell/commands/prompt.py,sha256=G3JTHXy1MiZ5TMIY_UrGCOGr9ZIsIE3i7cJ14m7YR4U,1794
60
+ janito/cli/chat_mode/shell/commands/read.py,sha256=pz1Nfa2xdFXxgwuxPfsW53-VgPRUm67h5ajHIWF4Vm0,1895
61
+ janito/cli/chat_mode/shell/commands/role.py,sha256=4Mt3okuNwOjqHbNhOFawcWB9KCLkpTDuLoDJFeXr3-E,1079
62
62
  janito/cli/chat_mode/shell/commands/session.py,sha256=9wsw5U24-KJgTT70KAwnGuS8MVPyvpxCJfAt_Io76O0,1574
63
63
  janito/cli/chat_mode/shell/commands/session_control.py,sha256=tmMGJ8IvWoBwSIJu7T6GPnFYFrmXWIG2Gr9tTni4y3U,1307
64
64
  janito/cli/chat_mode/shell/commands/tools.py,sha256=G7tqjfkjXmTkMFIf6kHOhvYVq66LMPhGQdRyjpZO-xg,3190
65
65
  janito/cli/chat_mode/shell/commands/utility.py,sha256=K982P-UwgPLzpEvSuSBGwiQ3zC34S_6T2ork_djweQw,847
66
66
  janito/cli/chat_mode/shell/commands/verbose.py,sha256=HDTe0NhdcjBuhh-eJSW8iLPDeeBO95K5iSDAMAljxa4,953
67
- janito/cli/chat_mode/shell/commands/write.py,sha256=kst0CBxR7UQurAjpx1junYwjm2bWsGVfSK80kJXAm54,1982
67
+ janito/cli/chat_mode/shell/commands/write.py,sha256=kBd04L32NVkwEyAi7DoXm6K5RshjB_apQ1q8M08KtLc,1905
68
68
  janito/cli/chat_mode/shell/session/__init__.py,sha256=uTYE_QpZFEn7v9QE5o1LdulpCWa9vmk0OsefbBGWg_c,37
69
69
  janito/cli/chat_mode/shell/session/history.py,sha256=tYav6GgjAZkvWhlI_rfG6OArNqW6Wn2DTv39Hb20QYc,1262
70
70
  janito/cli/chat_mode/shell/session/manager.py,sha256=m6cQe-9SeIqBnnWVEGtZiBtCpStqIwqRzP09XPhJrdM,1005
@@ -102,7 +102,7 @@ janito/i18n/messages.py,sha256=fBuwOTFoygyHPkYphm6Y0r1iE8497Z4iryVAmPhMEkg,1851
102
102
  janito/i18n/pt.py,sha256=NlTgpDSftUfFG7FGbs7TK54vQlJVMyaZDHGcWjelwMc,4168
103
103
  janito/llm/README.md,sha256=6GRqCu_a9va5HCB1YqNqbshyWKFyAGlnXugrjom-xj8,1213
104
104
  janito/llm/__init__.py,sha256=dpyVH51qVRCw-PDyAFLAxq0zd4jl5MDcuV6Cri0D-dQ,134
105
- janito/llm/agent.py,sha256=mHQhKspA1WH0xLLQwqbqUNlISiOhF60gufVkr6p6m5c,21254
105
+ janito/llm/agent.py,sha256=isy-UfOiHq5LnNq_PmKTPuL5ZlTda52g6kjrZPdT_Ro,21253
106
106
  janito/llm/auth.py,sha256=8Dl_orUEPhn2X6XjkO2Nr-j1HFT2YDxk1qJl9hSFI88,2286
107
107
  janito/llm/driver.py,sha256=mepQ00QK0ouK8LHz4blQctUTolzlDatXNWWQEmSdpO8,10037
108
108
  janito/llm/driver_config.py,sha256=OW0ae49EfgKDqaThuDjZBiaN78voNzwiZ6szERMqJos,1406
@@ -190,9 +190,9 @@ janito/tools/adapters/local/validate_file_syntax/ps1_validator.py,sha256=cP1jsMh
190
190
  janito/tools/adapters/local/validate_file_syntax/python_validator.py,sha256=lHzjlA4g9nCF9hXkGx3izWF0b0vJH3yV7Pu3buLyBbI,140
191
191
  janito/tools/adapters/local/validate_file_syntax/xml_validator.py,sha256=3CK7BEGO7gKI3bpeTtCFe0kJ5aKDZVh3Kh67bGIhcuc,294
192
192
  janito/tools/adapters/local/validate_file_syntax/yaml_validator.py,sha256=XLmOp7Ef6pLd97ICVnF3PxNKL1Yo5tLZsasvxPY478Y,165
193
- janito-2.5.0.dist-info/licenses/LICENSE,sha256=GSAKapQH5ZIGWlpQTA7v5YrfECyaxaohUb1vJX-qepw,1090
194
- janito-2.5.0.dist-info/METADATA,sha256=WqfY2ffIWvjuk6WAdM70c_dZYUcQCXjNgm6VChozTeE,16364
195
- janito-2.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
196
- janito-2.5.0.dist-info/entry_points.txt,sha256=wIo5zZxbmu4fC-ZMrsKD0T0vq7IqkOOLYhrqRGypkx4,48
197
- janito-2.5.0.dist-info/top_level.txt,sha256=m0NaVCq0-ivxbazE2-ND0EA9Hmuijj_OGkmCbnBcCig,7
198
- janito-2.5.0.dist-info/RECORD,,
193
+ janito-2.5.1.dist-info/licenses/LICENSE,sha256=GSAKapQH5ZIGWlpQTA7v5YrfECyaxaohUb1vJX-qepw,1090
194
+ janito-2.5.1.dist-info/METADATA,sha256=HX7_vYERiZRZ0svylDcdPZpv4QPHFP2SH3BbmSyx18E,16364
195
+ janito-2.5.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
196
+ janito-2.5.1.dist-info/entry_points.txt,sha256=wIo5zZxbmu4fC-ZMrsKD0T0vq7IqkOOLYhrqRGypkx4,48
197
+ janito-2.5.1.dist-info/top_level.txt,sha256=m0NaVCq0-ivxbazE2-ND0EA9Hmuijj_OGkmCbnBcCig,7
198
+ janito-2.5.1.dist-info/RECORD,,
File without changes