autosh 0.0.4__py3-none-any.whl → 0.0.6__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.
@@ -39,7 +39,6 @@ def __print_code_preview_banner(
39
39
  panel = Panel.fit(content, title=f"[magenta]{title}[/magenta]", title_align="left")
40
40
  rich.print()
41
41
  rich.print(panel)
42
- rich.print()
43
42
 
44
43
 
45
44
  def code_preview_banner(
@@ -61,6 +60,7 @@ def code_result_panel(
61
60
  ):
62
61
  if CLI_OPTIONS.quiet:
63
62
  return
63
+ print()
64
64
  if isinstance(out, str):
65
65
  out = out.strip()
66
66
  if isinstance(err, str):
@@ -72,8 +72,6 @@ def code_result_panel(
72
72
  text += (("\n---\n" if out else "") + err) if err else ""
73
73
  panel = Panel.fit(text, title=title, title_align="left", style="dim")
74
74
  rich.print(panel)
75
- if not CLI_OPTIONS.quiet:
76
- rich.print()
77
75
 
78
76
 
79
77
  from . import calc
autosh/plugins/cli.py CHANGED
@@ -67,6 +67,7 @@ class CLIPlugin(Plugin):
67
67
  if not os.path.exists(path):
68
68
  raise FileNotFoundError(f"Path `{path}` does not exist.")
69
69
  os.chdir(path)
70
+ return f"DONE"
70
71
 
71
72
  @tool(metadata={"banner": simple_banner("GET ARGV")})
72
73
  def get_argv(self):
@@ -269,3 +270,4 @@ class CLIPlugin(Plugin):
269
270
  Exit the current shell session with an optional exit code.
270
271
  """
271
272
  sys.exit(exitcode)
273
+ return f"EXITED with code {exitcode}"
autosh/session.py CHANGED
@@ -1,4 +1,3 @@
1
- import asyncio
2
1
  from pathlib import Path
3
2
  import sys
4
3
  from agentia import (
@@ -7,7 +6,7 @@ from agentia import (
7
6
  Event,
8
7
  ToolCallEvent,
9
8
  MessageStream,
10
- ChatCompletion,
9
+ Run,
11
10
  UserConsentEvent,
12
11
  )
13
12
  from agentia.plugins import PluginInitError
@@ -87,8 +86,8 @@ class Session:
87
86
  """,
88
87
  )
89
88
  agent.history.add(self.__get_argv_message())
90
- completion = agent.chat_completion(prompt, stream=True)
91
- async for stream in completion:
89
+ run = agent.run(prompt, stream=True)
90
+ async for stream in run:
92
91
  await self.__render_streamed_markdown(stream)
93
92
  sys.exit(0)
94
93
 
@@ -117,7 +116,7 @@ class Session:
117
116
  ):
118
117
  await self._print_help_and_exit(prompt)
119
118
  # Execute the prompt
120
- loading = self.__create_loading_indicator()
119
+ loading = self.__create_loading_indicator() if sys.stdout.isatty() else None
121
120
  CLI_OPTIONS.prompt = prompt
122
121
  self.agent.history.add(self.__get_argv_message())
123
122
  if CLI_OPTIONS.stdin_has_data():
@@ -141,8 +140,8 @@ class Session:
141
140
  role="user",
142
141
  )
143
142
  )
144
- completion = self.agent.chat_completion(prompt, stream=True, events=True)
145
- await self.__process_completion(completion, loading)
143
+ run = self.agent.run(prompt, stream=True, events=True)
144
+ await self.__process_run(run, loading, False)
146
145
 
147
146
  async def exec_from_stdin(self):
148
147
  if sys.stdin.isatty():
@@ -170,32 +169,37 @@ class Session:
170
169
  if CLI_OPTIONS.yes:
171
170
  return True
172
171
  result = Confirm.ask(
173
- f"[magenta]{message}[/magenta]", default=True, case_sensitive=False
172
+ f"\n[magenta]{message}[/magenta]", default=True, case_sensitive=False
174
173
  )
175
- if not CLI_OPTIONS.quiet:
176
- rich.print()
177
174
  return result
178
175
 
179
- async def __process_completion(
180
- self, completion: ChatCompletion[Event | MessageStream], loading: Loading
176
+ async def __process_run(
177
+ self, run: Run[Event | MessageStream], loading: Loading | None, repl: bool
181
178
  ):
182
- async for stream in completion:
183
- await loading.finish()
179
+ async for e in run:
180
+ if loading:
181
+ await loading.finish()
184
182
 
185
- if isinstance(stream, Event):
186
- await self.__process_event(stream)
183
+ if isinstance(e, Event):
184
+ await self.__process_event(e)
187
185
  else:
188
- print()
189
- await self.__render_streamed_markdown(stream)
190
- print()
186
+ if repl or not CLI_OPTIONS.quiet:
187
+ print()
188
+ await self.__render_streamed_markdown(e)
191
189
 
192
- loading = self.__create_loading_indicator()
190
+ if loading:
191
+ loading = self.__create_loading_indicator()
193
192
 
194
- await loading.finish()
193
+ if loading:
194
+ await loading.finish()
195
195
 
196
196
  async def run_repl(self):
197
+ first = True
197
198
  while True:
198
199
  try:
200
+ if not first:
201
+ print()
202
+ first = False
199
203
  prompt = (
200
204
  await ng.input("> ", sync=False, persist="/tmp/autosh-history")
201
205
  ).strip()
@@ -204,10 +208,8 @@ class Session:
204
208
  if len(prompt) == 0:
205
209
  continue
206
210
  loading = self.__create_loading_indicator()
207
- completion = self.agent.chat_completion(
208
- prompt, stream=True, events=True
209
- )
210
- await self.__process_completion(completion, loading)
211
+ run = self.agent.run(prompt, stream=True, events=True)
212
+ await self.__process_run(run, loading, True)
211
213
  except KeyboardInterrupt:
212
214
  break
213
215
 
@@ -1,13 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autosh
3
- Version: 0.0.4
4
- Summary: Add your description here
3
+ Version: 0.0.6
4
+ Summary: The AI-powered, noob-friendly interactive shell
5
+ Author-email: Wenyu Zhao <wenyuzhaox@gmail.com>
6
+ License-Expression: MIT
5
7
  License-File: LICENSE
6
- Requires-Python: >=3.13
7
- Requires-Dist: agentia>=0.0.7
8
+ Keywords: agent,chatgpt,cli,command line,gpt,interactive,llm,openai,openrouter,shell,terminal
9
+ Requires-Python: >=3.12
10
+ Requires-Dist: agentia>=0.0.8
8
11
  Requires-Dist: asyncio>=3.4.3
9
12
  Requires-Dist: markdownify>=1.1.0
10
- Requires-Dist: neongrid
13
+ Requires-Dist: neongrid>=0.0.1
11
14
  Requires-Dist: prompt-toolkit>=3.0.51
12
15
  Requires-Dist: pydantic>=2.11.3
13
16
  Requires-Dist: python-dotenv>=1.1.0
@@ -2,16 +2,16 @@ autosh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  autosh/config-template.toml,sha256=iLdCBHIK0czWgNHtwAgvuhV670aiNc-IOmaPHP12i0Y,269
3
3
  autosh/config.py,sha256=7DXUSsqHm8dPsXln-NTu8D0_Uwcs2h4sT8pFtQM8tso,2654
4
4
  autosh/main.py,sha256=bgWkYpU9cmyU2AyWt4o8Mcj6LH_UGYSYrFx4Qkl8vqk,5117
5
- autosh/session.py,sha256=fOJySGU9abjFReNOyvQf-s9rFQdGy8Pv01GgplqrRuw,7943
6
- autosh/plugins/__init__.py,sha256=oUtO7M1AuZKshbaS-kO0fbV4CYal0uOvg-GpYVFE16I,2996
5
+ autosh/session.py,sha256=AOhDTuTg9MlqW-VDKmHsiqqEg7PkDMUj0mknubE97cQ,7962
6
+ autosh/plugins/__init__.py,sha256=LzaRWYpXv-e2YPr3VP1Ggd1rjNlQDjGRMPVTK7Hdfnk,2940
7
7
  autosh/plugins/calc.py,sha256=x_fZW3kkStlAAQEhejcD2_MQnpqCd5ghU72CNSjqIsg,672
8
- autosh/plugins/cli.py,sha256=G4WqTWeCi7OxdB36lAUiR1OBdtSvxmKRcQGGLdMcxms,9230
8
+ autosh/plugins/cli.py,sha256=P8orcjsTfD_k7oEmaoW4xrrIpzg_XXKvV8ok3br6B44,9299
9
9
  autosh/plugins/clock.py,sha256=gIrYBz3GmnAJTujzd3B8ewuThXpF-OvWYBugcZMYGTQ,570
10
10
  autosh/plugins/code.py,sha256=HK7cd7gNit2yZAukaCnTGXb6BAh31cPh0EHCx6msOWc,2457
11
11
  autosh/plugins/search.py,sha256=aWbIDJ7E5m-Xrw2A1DB6w53oGiFe1Uc3EuZikIH5eTs,2984
12
12
  autosh/plugins/web.py,sha256=LxE7ed7IS9B4spWCm-3aBMLfC9ghcNnmJzMiD6ayLdc,2648
13
- autosh-0.0.4.dist-info/METADATA,sha256=cv69lLqKHEFwz5AZWEmmL0scvhzYv8-ECPdEiRzOaus,1959
14
- autosh-0.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- autosh-0.0.4.dist-info/entry_points.txt,sha256=BV7bzUnxG6Z5InEkrfajGCxjooYORC5tZDDZctOPenQ,67
16
- autosh-0.0.4.dist-info/licenses/LICENSE,sha256=BnLDJsIJe-Dm18unR9DOoSv7QOfAz6LeIQc1yHAjxp0,1066
17
- autosh-0.0.4.dist-info/RECORD,,
13
+ autosh-0.0.6.dist-info/METADATA,sha256=3Bkxyj284hbhWISqxLtQQ3jbjSxX6S6cGYhmlvGuboA,2154
14
+ autosh-0.0.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ autosh-0.0.6.dist-info/entry_points.txt,sha256=BV7bzUnxG6Z5InEkrfajGCxjooYORC5tZDDZctOPenQ,67
16
+ autosh-0.0.6.dist-info/licenses/LICENSE,sha256=BnLDJsIJe-Dm18unR9DOoSv7QOfAz6LeIQc1yHAjxp0,1066
17
+ autosh-0.0.6.dist-info/RECORD,,
File without changes