ledgerloops / ledgerloops-earthstar

LedgerLoops over Earthstar
Apache License 2.0
0 stars 0 forks source link

Copy Alice/Bob server from ledgerloops-cabal #1

Open michielbdejong opened 3 months ago

michielbdejong commented 3 months ago

I think I want to run the agents from the terminal (with deno), not from browser windows. So I can use src/server/sync_test.ts as a starting point. Have to work out how to send/receive messages there, maybe I can copy that from src/client/chat.js

michielbdejong commented 3 months ago

I should use new Earthstar.ReplicaDriverMemory(shareKeypair.shareAddress) instead of new Earthstar.ReplicaDriverWeb(shareKeypair.shareAddress)

michielbdejong commented 3 months ago

I can now write message from src/server/sync_test.ts to src/client/chat.js but not yet in the other direction

michielbdejong commented 3 months ago

I need to decide whether to plug LedgerLoops into an Earthstar node or plug Earthstar into a LedgerLoops node.

michielbdejong commented 3 months ago

Given that I was already using the BasicMessageForwarder and BatchedMessageForwarder in Strategy Pit, it might make a lot of sense to plug in there.

Also, I want to have code where Earthstar is easily pluggable/replaceable with e.g. Cabal, SSB, Braid, etc.

michielbdejong commented 3 months ago

At the same time, moving beyond proof-of-concept with this, I want the strategies to be pluggable. So I think what I need is a base object where you plug in a messenger and a strategist.

michielbdejong commented 3 months ago

I think this repo should export an implementation of MessageForwarder. For now, I'll also implement the simulator in it, since that is just like 20 lines of code. And I'll use Saiga from the local checkout next to it, the factory makes it too complicated.

michielbdejong commented 3 months ago

I eventually want to run this in separate processes but as a first step I'll just have a single MessageForwarder object, like I did in Strategy Pit, just going over Earthstar each time instead of directly delivering messages through in-process memory.

michielbdejong commented 3 months ago

Trouble is the MessageForwarder from Strategy Pit wants to deal with Node objects, maybe it should just emit events instead?