permaweb / aos

An operating system for AO: The hyper parallel computer
https://ao.g8way.io
Other
68 stars 46 forks source link

feat: keep history between instances #329

Closed twilson63 closed 1 week ago

twilson63 commented 2 weeks ago

Problem

The history is only available for a process while aos console is running. So if you stop and restart the history is not available.

Solution

Before console exits drop the last 100 items in history to a .{pid}.history file in the home directory, and then when the pid starts load it from file.

twilson63 commented 2 weeks ago

Need to handle before exist and save file to users home directory as a dot file

https://nodejs.org/api/process.html#event-beforeexit

twilson63 commented 1 week ago

Here is where want to check for a history file

https://github.com/permaweb/aos/blob/aecfaccdacaa99e6e0a19cce548c4ebbe45c6fee/src/index.js#L132

It would be a good to create a history service with a read and write method.