Something went wrong. Try again.
small gleam coding and (not yet) persistent agent daemon with a detachable cli forked from okami.mom/albedo
Something went wrong. Try again.
12345678910111213141516171819202122232425262728#!/usr/bin/env bash# Compile the daemon and copy its code into $1 beside a launcher, then print the# launcher's path for ALBEDO_DAEMON. Test daemons boot from the copy instead of# `gleam run`: none of them takes the build lock, so they boot side by side and# beside a running `gleam test`, and a rebuild during the run cannot change the# code under a daemon that is still loading modules.set -euo pipefailroot="$(cd "$(dirname "$0")/.." && pwd)"out="$1"(cd "$root" && gleam build) >&2mkdir -p "$out"for ebin in "$root"/build/dev/erlang/*/ebin; do package="$(dirname "$ebin")" name="$(basename "$package")" mkdir -p "$out/$name" cp -R "$ebin" "$out/$name/ebin" # priv keeps pointing at the source tree, as under `gleam run`. if [ -e "$package/priv" ]; then ln -s "$(cd "$package/priv" && pwd -P)" "$out/$name/priv" fidonecat >"$out/albedo-daemon" <<EOF#!/bin/shexec erl -pa "$out"/*/ebin -eval 'albedo@@main:run(albedo)' -noshell -extraEOFchmod +x "$out/albedo-daemon"echo "$out/albedo-daemon"