praetorian-cli 2.2.10__py3-none-any.whl → 2.2.11__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.
@@ -9,15 +9,16 @@ def handle_set(menu, args):
9
9
  return
10
10
 
11
11
  selection = args[0]
12
- selected_agent = parse_agent_identifier(selection, menu.agents)
12
+ selected_agent = parse_agent_identifier(selection, menu.displayed_agents, menu.agents)
13
13
 
14
14
  if selected_agent:
15
15
  menu.selected_agent = selected_agent
16
16
  hostname = selected_agent.hostname
17
17
  menu.console.print(f"\n Selected: {hostname}\n")
18
18
  else:
19
+ displayed_count = len(menu.displayed_agents)
19
20
  menu.console.print(f"\n[red] Agent not found:[/red] {selection}")
20
- menu.console.print(f"[dim] Use agent number (1-{len(menu.agents)}), client ID, or hostname[/dim]\n")
21
+ menu.console.print(f"[dim] Use agent number (1-{displayed_count}), client ID, or hostname[/dim]\n")
21
22
  menu.pause()
22
23
 
23
24
 
@@ -54,7 +54,8 @@ class AegisMenu:
54
54
  self.selected_agent: Optional[Agent] = None
55
55
  self._first_render = True
56
56
  self.agent_computed_data = {}
57
- self.current_prompt = "> "
57
+ self.current_prompt = "> "
58
+ self.displayed_agents: List[Agent] = [] # Track currently displayed agents
58
59
 
59
60
  self.user_email, self.username = self.sdk.get_current_user()
60
61
 
@@ -173,6 +174,8 @@ class AegisMenu:
173
174
  if show_offline:
174
175
  display_agents = display_agents + offline_agents
175
176
 
177
+ self.displayed_agents = [agent for _, agent in display_agents]
178
+
176
179
  self.console.print()
177
180
 
178
181
  if not display_agents:
@@ -392,4 +395,4 @@ class AegisMenu:
392
395
  def run_aegis_menu(sdk: Chariot) -> None:
393
396
  """Run the Aegis menu interface"""
394
397
  menu = AegisMenu(sdk)
395
- menu.run()
398
+ menu.run()
@@ -132,31 +132,32 @@ def get_agent_display_style(group: str, colors: dict) -> dict:
132
132
  }
133
133
 
134
134
 
135
- def parse_agent_identifier(identifier: str, agents: List[Agent]) -> Optional[Agent]:
136
- """Parse agent identifier and return matching agent"""
137
- if not agents:
135
+ def parse_agent_identifier(identifier: str, displayed_agents: List[Agent], all_agents: Optional[List[Agent]] = None) -> Optional[Agent]:
136
+ """Parse agent identifier and return matching agent
137
+ """
138
+ if not displayed_agents:
138
139
  return None
139
140
 
140
- # Try numeric index first
141
+ # Use all_agents for fallback searches, or displayed_agents if not provided
142
+ search_agents = all_agents if all_agents is not None else displayed_agents
143
+
141
144
  if identifier.isdigit():
142
145
  agent_num = int(identifier)
143
- if 1 <= agent_num <= len(agents):
144
- return agents[agent_num - 1]
146
+ if 1 <= agent_num <= len(displayed_agents):
147
+ return displayed_agents[agent_num - 1]
145
148
 
146
- # Try client ID match
147
- for agent in agents:
149
+ for agent in search_agents:
148
150
  try:
149
151
  if agent.client_id and agent.client_id.lower() == identifier.lower():
150
152
  return agent
151
153
  except AttributeError:
152
154
  continue
153
155
 
154
- # Try hostname match
155
- for agent in agents:
156
+ for agent in search_agents:
156
157
  try:
157
158
  if agent.hostname and agent.hostname.lower() == identifier.lower():
158
159
  return agent
159
160
  except AttributeError:
160
161
  continue
161
162
 
162
- return None
163
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: praetorian-cli
3
- Version: 2.2.10
3
+ Version: 2.2.11
4
4
  Summary: For interacting with the Chariot API
5
5
  Home-page: https://github.com/praetorian-inc/praetorian-cli
6
6
  Author: Praetorian
@@ -85,20 +85,20 @@ praetorian_cli/sdk/test/utils.py,sha256=svxMpzlaW4FRCij05cPgJFrTUEELVdt8G7SPKEds
85
85
  praetorian_cli/ui/__init__.py,sha256=wEgkrgIaoOguH1VVp2FndaGIxWmZ5CfAynXtNtZ6iTo,81
86
86
  praetorian_cli/ui/aegis/__init__.py,sha256=1HE5aQ6C6Qruf1X-KmKvDw1M3lzaUbPZoz9QOp4Lofs,123
87
87
  praetorian_cli/ui/aegis/constants.py,sha256=trr62uBwdBwm4LrFVms7_moThdtOPJi2uzCeIv4m3VU,578
88
- praetorian_cli/ui/aegis/menu.py,sha256=8byIJAafsL5Atu8UrEQkLKF4VOpBC7fKkFz_qzqF7sk,14470
89
- praetorian_cli/ui/aegis/utils.py,sha256=l5NiWUU0jIWNJG-LSg_Fa6MdWNtIXHWAd1YcbtqIYkg,5052
88
+ praetorian_cli/ui/aegis/menu.py,sha256=vLdIBJxDOSFClW319YMtPMwqHD2_qPo79xkVk2BsyEU,14633
89
+ praetorian_cli/ui/aegis/utils.py,sha256=2sXVwSzXcwPNhB-Rg80kc-4hECRko1wQBQWzu8cBcgI,5233
90
90
  praetorian_cli/ui/aegis/commands/__init__.py,sha256=Af3AE-KqPevE_N-NWFTpTPaUkRhkaMAug6hCr_soHEU,39
91
91
  praetorian_cli/ui/aegis/commands/help.py,sha256=ucalA21yUy5EFtN1RbDBwTjfFQnrwWwd36HFzzqaSRg,3366
92
92
  praetorian_cli/ui/aegis/commands/info.py,sha256=AcvaIeZqnugk1BFUXB25xOVkYYe0UzTiFiT_2m8tgIE,5516
93
93
  praetorian_cli/ui/aegis/commands/job.py,sha256=BUcp47K-4PBIYq9nyUQTKhOakZwXM4fOf2TSWIDKoLE,14591
94
94
  praetorian_cli/ui/aegis/commands/list.py,sha256=puIiy0skYE59Q2hVSMsla1tKiYYAFTOaz8oPM17tCyI,352
95
- praetorian_cli/ui/aegis/commands/set.py,sha256=ODa9u_6yW2dbKVQBuV9YeiS_ty_R_Xk_vPz7YrW3OWs,1101
95
+ praetorian_cli/ui/aegis/commands/set.py,sha256=WJ0Qt30fBa_hyWEaawyA3h3rSeWHFPbJSKY8A0k6SC0,1176
96
96
  praetorian_cli/ui/aegis/commands/ssh.py,sha256=KGsNlN0i-Cwp6gWyr-cjML9_L13oE7xFenysF2pC8Rc,3045
97
97
  praetorian_cli/ui/conversation/__init__.py,sha256=sNhNN_ZG1Va_7OLTaoXlIFL6ageKHWdufFVYw6F_aV8,90
98
98
  praetorian_cli/ui/conversation/textual_chat.py,sha256=gGgEs7HhNAto9rTVrGbz62mG10OqmtArI-aKxFLSfVs,24405
99
- praetorian_cli-2.2.10.dist-info/licenses/LICENSE,sha256=Zv97QripiVALv-WokW_Elsiz9vtOfbtNt1aLZhhk67I,1067
100
- praetorian_cli-2.2.10.dist-info/METADATA,sha256=Ph8KnJnjGdNkTwbcS0HubrSrf2Zbr9-3NVJw_kVRHDI,7752
101
- praetorian_cli-2.2.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
102
- praetorian_cli-2.2.10.dist-info/entry_points.txt,sha256=uJbDvZdkYaLiCh2DMvXPUGKFm2p5ZfzJCizUK3-PUEE,56
103
- praetorian_cli-2.2.10.dist-info/top_level.txt,sha256=QbUdRPGEj_TyHO-E7AD5BxFfR8ore37i273jP4Gn43c,15
104
- praetorian_cli-2.2.10.dist-info/RECORD,,
99
+ praetorian_cli-2.2.11.dist-info/licenses/LICENSE,sha256=Zv97QripiVALv-WokW_Elsiz9vtOfbtNt1aLZhhk67I,1067
100
+ praetorian_cli-2.2.11.dist-info/METADATA,sha256=S38eZTVQ_ckoHoD6gFKzDanvXEcyOFjyJEWcIuFFZnU,7752
101
+ praetorian_cli-2.2.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
102
+ praetorian_cli-2.2.11.dist-info/entry_points.txt,sha256=uJbDvZdkYaLiCh2DMvXPUGKFm2p5ZfzJCizUK3-PUEE,56
103
+ praetorian_cli-2.2.11.dist-info/top_level.txt,sha256=QbUdRPGEj_TyHO-E7AD5BxFfR8ore37i273jP4Gn43c,15
104
+ praetorian_cli-2.2.11.dist-info/RECORD,,