-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathassistant.py
More file actions
60 lines (48 loc) · 1.94 KB
/
Copy pathassistant.py
File metadata and controls
60 lines (48 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from prompt_engine import generate_action_plan
from step_executor import execute_plan
from memory import remember, recall_all, clear_memory
def main():
print("Hi This tool should support you in working on linux.")
print("Type a task, 'memory' to view log, or 'exit' to quit.\n")
while True:
try:
user_input = input("\nYou: ").strip()
if user_input.lower() in ("exit", "quit"):
print(" Exiting AetherShell.")
break
elif user_input.lower() == "memory":
mem = recall_all()
if not mem:
print("Memory is empty.")
else:
print("\n Memory Log:")
for i, entry in enumerate(mem, 1):
print(f"[{i}] Task: {entry['task']}")
print(f" Result: {entry['result']}\n")
continue
elif user_input.lower() == "clear memory":
clear_memory()
print(" Memory cleared.")
continue
plan = generate_action_plan(user_input)
if "error" in plan:
print(f" Error: {plan['error']}")
continue
print(f"\n Goal: {plan['goal']}")
print(" Steps:")
for step in plan['steps']:
print(f" - {step}")
print(f"\n Final Command:\n{plan['final_command']}")
confirm = input("\nRun final command? [y/N]: ").strip().lower()
if confirm == 'y':
execute_plan(plan['final_command'])
remember(user_input, plan['final_command']) # Save to memory
else:
print("Command not executed.")
except KeyboardInterrupt:
print("\nExiting AetherShell.")
break
except Exception as e:
print(f" Unexpected error: {e}")
if __name__ == "__main__":
main()