okami.mom/albedo

git clone https://git.nkp.pet/okami.mom/albedo

nekomimi.petrpc: pass host calls to routes as a method and arguments, and reply once59e1387

main
664 B25 linesraw
1//// Default extension wiring for standalone kernel tests.
2
3import albedo/daemon/store
4import albedo/harness/extensions/python/kernel as python
5import albedo/harness/extensions/work/ledger as work
6import albedo/harness/extensions/work/rpc
7import albedo/harness/rpc as harness_rpc
8import gleam/result
9
10pub fn local(
11  ledger: store.Store,
12  cwd: String,
13) -> Result(python.Kernel, python.Error) {
14  use _ <- result.try(
15    work.initialise(ledger) |> result.map_error(python.Unavailable),
16  )
17  python.local_with_plugins(
18    ledger,
19    cwd,
20    fn(method, args) {
21      rpc.handle(ledger, cwd, method, args) |> harness_rpc.reply
22    },
23    ["run", "work"],
24  )
25}