LocalStorageStore
A persistent Store for apps that run in a browser. It keeps each item in an entry of the page's localStorage, so what an agent remembers is still there after the page is reloaded or the browser is closed.
val config = GraphConfig(
threadId = "plan-7",
checkpointer = LocalStorageCheckpointer(KotlinxStateSerializer<Trip>()),
store = LocalStorageStore().within("traveller"),
)What LocalStorageCheckpointer says about localStorage holds here too: it belongs to the origin of the page, so give keyPrefix a name of your own; a browser keeps about 5 MB for an origin, and a put into a full storage throws a LocalStorageStoreException and leaves the items as they were; the person using the browser can read and change it; and it is not available in a web worker, on Node.js, or when the browser blocks storage for the page.
The key of an entry is keyPrefix, then each part of the namespace followed by /, then the key, with % and / in a part or the key written as %25 and %2F. Its value is JSON with the value of the item and its time. list reads the keys of every entry of the page, which is quick for the size localStorage has.
Parameters
gives StoreItem.updatedAt. Two writes of one store never get the same time, and a store starts after the last write it finds, so list keeps their order also with the clock of a browser, which counts milliseconds.