autosh 0.0.5__tar.gz → 0.0.6__tar.gz
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.
- {autosh-0.0.5 → autosh-0.0.6}/PKG-INFO +7 -4
- {autosh-0.0.5 → autosh-0.0.6}/autosh/plugins/__init__.py +1 -3
- {autosh-0.0.5 → autosh-0.0.6}/autosh/plugins/cli.py +2 -0
- {autosh-0.0.5 → autosh-0.0.6}/autosh/session.py +27 -25
- {autosh-0.0.5 → autosh-0.0.6}/pyproject.toml +19 -4
- {autosh-0.0.5 → autosh-0.0.6}/.gitignore +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/LICENSE +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/README.md +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/autosh/__init__.py +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/autosh/config-template.toml +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/autosh/config.py +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/autosh/main.py +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/autosh/plugins/calc.py +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/autosh/plugins/clock.py +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/autosh/plugins/code.py +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/autosh/plugins/search.py +0 -0
- {autosh-0.0.5 → autosh-0.0.6}/autosh/plugins/web.py +0 -0
@@ -1,10 +1,13 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: autosh
|
3
|
-
Version: 0.0.
|
4
|
-
Summary:
|
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
|
-
|
7
|
-
Requires-
|
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
13
|
Requires-Dist: neongrid>=0.0.1
|
@@ -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
|
@@ -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}"
|
@@ -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
|
-
|
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
|
-
|
91
|
-
async for stream in
|
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
|
-
|
145
|
-
await self.
|
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
|
180
|
-
self,
|
176
|
+
async def __process_run(
|
177
|
+
self, run: Run[Event | MessageStream], loading: Loading | None, repl: bool
|
181
178
|
):
|
182
|
-
async for
|
183
|
-
|
179
|
+
async for e in run:
|
180
|
+
if loading:
|
181
|
+
await loading.finish()
|
184
182
|
|
185
|
-
if isinstance(
|
186
|
-
await self.__process_event(
|
183
|
+
if isinstance(e, Event):
|
184
|
+
await self.__process_event(e)
|
187
185
|
else:
|
188
|
-
|
189
|
-
|
190
|
-
|
186
|
+
if repl or not CLI_OPTIONS.quiet:
|
187
|
+
print()
|
188
|
+
await self.__render_streamed_markdown(e)
|
191
189
|
|
192
|
-
loading
|
190
|
+
if loading:
|
191
|
+
loading = self.__create_loading_indicator()
|
193
192
|
|
194
|
-
|
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
|
-
|
208
|
-
|
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,9 +1,24 @@
|
|
1
1
|
[project]
|
2
2
|
name = "autosh"
|
3
|
-
version = "0.0.
|
4
|
-
description = "
|
3
|
+
version = "0.0.6"
|
4
|
+
description = "The AI-powered, noob-friendly interactive shell"
|
5
|
+
authors = [{ name = "Wenyu Zhao", email = "wenyuzhaox@gmail.com" }]
|
6
|
+
requires-python = ">=3.12"
|
5
7
|
readme = "README.md"
|
6
|
-
|
8
|
+
license = "MIT"
|
9
|
+
keywords = [
|
10
|
+
"terminal",
|
11
|
+
"shell",
|
12
|
+
"command line",
|
13
|
+
"cli",
|
14
|
+
"interactive",
|
15
|
+
"chatgpt",
|
16
|
+
"gpt",
|
17
|
+
"llm",
|
18
|
+
"agent",
|
19
|
+
"openai",
|
20
|
+
"openrouter",
|
21
|
+
]
|
7
22
|
dependencies = [
|
8
23
|
"asyncio>=3.4.3",
|
9
24
|
"markdownify>=1.1.0",
|
@@ -15,7 +30,7 @@ dependencies = [
|
|
15
30
|
"typer>=0.12.5",
|
16
31
|
"tzlocal>=5.3.1",
|
17
32
|
"neongrid>=0.0.1",
|
18
|
-
"agentia>=0.0.
|
33
|
+
"agentia>=0.0.8",
|
19
34
|
]
|
20
35
|
|
21
36
|
[project.scripts]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|