git-subtree-dir: vendor/trainer git-subtree-mainline:c7c2956e15git-subtree-split:a2a9f4edcf
13 lines
447 B
Bash
Executable File
13 lines
447 B
Bash
Executable File
#!/bin/sh
|
|
# LLM backend that hands each prompt to whoever watches $MAILBOX:
|
|
# prompt-N.md goes out, the reply is read from reply-N.md. For driving
|
|
# the generator from an agent session, or by hand.
|
|
set -eu
|
|
: "${MAILBOX:?set MAILBOX to a directory}"
|
|
mkdir -p "$MAILBOX"
|
|
n=$(( $(ls "$MAILBOX" | grep -c '^prompt-' || true) + 1 ))
|
|
cat > "$MAILBOX/prompt-$n.md"
|
|
until [ -s "$MAILBOX/reply-$n.md" ]; do sleep 2; done
|
|
sleep 1
|
|
cat "$MAILBOX/reply-$n.md"
|