mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-12-01 09:24:46 +00:00
feat(hub): "Use c0mpute network" session: chat for members, TUI for operators (#183)
New hub Sessions entry that opens the c0mpute network (free-tier AI chat on open models) inside the member's pod, never on the BBS host: - pods/Containerfile installs the c0mpute client stack (c0mpute binary, pinned bun, signed c0mpute-tui) via the official installer with --no-start and no peers, under /opt/c0mpute, linked onto PATH. unzip added (bun ships as a zip; without it the installer silently skipped the TUI). The build now fails if the TUI or bun is missing, and drops the installer's build-time config so no node identity ships in the image. - pods/agentbbs-c0mpute signs the member in to their own c0mpute account on first use (device code; free account = free tier), then runs `c0mpute chat`, or `c0mpute tui` for operators. The key persists in /home/dev. - Gated like the pod Shell: members only, verified email, pods available. Tested: slim image with the same layer on ubuntu:26.04 builds; as uid 1000 with an empty home the launcher shows the c0mpute.com/cli/approve device code, and `c0mpute tui` renders (Chat/Jobs/Node/Network/Settings/Fleet). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
52f8118ee5
commit
e8ac55e27a
4 changed files with 104 additions and 1 deletions
|
|
@ -613,6 +613,24 @@ func (a *app) sessionApps(s ssh.Session, su store.User, guest bool) []hub.Sessio
|
||||||
Cmd: sessionExec{run: func() error { return a.pods.Attach(s, su.Name) }},
|
Cmd: sessionExec{run: func() error { return a.pods.Attach(s, su.Name) }},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// c0mpute network — free-tier AI chat on open models (c0mpute.com). Runs
|
||||||
|
// in the member's pod (never on the host) under their own c0mpute account:
|
||||||
|
// the launcher signs them in on first use and the key persists in their
|
||||||
|
// pod home. Operators get the full `c0mpute tui` (chat, jobs, network,
|
||||||
|
// settings); members get `c0mpute chat`.
|
||||||
|
c0mputeMode, c0mputeDesc := "chat", "free AI chat on open models (sign in once, free tier)"
|
||||||
|
if !guest && auth.IsAdmin(su.Name) {
|
||||||
|
c0mputeMode, c0mputeDesc = "tui", "c0mpute TUI: chat, jobs, network, settings (operator)"
|
||||||
|
}
|
||||||
|
apps = append(apps, hub.SessionApp{
|
||||||
|
Title: "Use c0mpute network",
|
||||||
|
Description: c0mputeDesc,
|
||||||
|
Locked: podLock,
|
||||||
|
Cmd: sessionExec{run: func() error {
|
||||||
|
return a.pods.Exec(s, su.Name, []string{"/usr/local/bin/agentbbs-c0mpute", c0mputeMode})
|
||||||
|
}},
|
||||||
|
})
|
||||||
|
|
||||||
// IRC is members-only but accessed with an external client (or web) at
|
// IRC is members-only but accessed with an external client (or web) at
|
||||||
// irc.profullstack.com — not an in-BBS route — so it's not a hub menu item.
|
// irc.profullstack.com — not an in-BBS route — so it's not a hub menu item.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,14 @@ the host OS*.
|
||||||
1), pids-limit 256, idle SSH timeout from the server.
|
1), pids-limit 256, idle SSH timeout from the server.
|
||||||
- **Identity:** the SSH key fingerprint is the account; `pod@` looks the key up
|
- **Identity:** the SSH key fingerprint is the account; `pod@` looks the key up
|
||||||
and refuses unregistered keys with a pointer to `join@`.
|
and refuses unregistered keys with a pointer to `join@`.
|
||||||
|
- **c0mpute network:** the pod image ships the `c0mpute` client and
|
||||||
|
`c0mpute tui` (client only, no worker). The hub's **Use c0mpute network**
|
||||||
|
entry runs `/usr/local/bin/agentbbs-c0mpute` in the member's pod: on first use
|
||||||
|
it signs them in to their own c0mpute account (device code, approved on
|
||||||
|
c0mpute.com; a free account chats on the free tier), then opens
|
||||||
|
`c0mpute chat`. Operators (`AGENTBBS_ADMINS`) get `c0mpute tui` instead
|
||||||
|
(chat, jobs, network, settings). The sign-in key lives in the member's
|
||||||
|
`/home/dev`, so it is a one-time step, and nothing runs on the BBS host.
|
||||||
|
|
||||||
## Membership & CoinPay
|
## Membership & CoinPay
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ca-certificates curl gnupg \
|
ca-certificates curl gnupg unzip \
|
||||||
git openssh-client \
|
git openssh-client \
|
||||||
vim nano less ripgrep jq \
|
vim nano less ripgrep jq \
|
||||||
&& install -d -m 0755 /usr/share/keyrings \
|
&& install -d -m 0755 /usr/share/keyrings \
|
||||||
|
|
@ -32,11 +32,35 @@ RUN apt-get update \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# c0mpute network client (free-tier AI chat on open models): the `c0mpute`
|
||||||
|
# binary plus `c0mpute tui` (bun + c0mpute-tui), from the signed release via
|
||||||
|
# the official installer. Client only: --no-start means no worker, and the
|
||||||
|
# peers (coinpay, infernet) and ffmpeg are skipped. Installed under
|
||||||
|
# /opt/c0mpute (not $HOME, which is the member's volume) and linked onto PATH.
|
||||||
|
# Each member signs in with their own c0mpute account; the key lands in their
|
||||||
|
# persisted home, never in the image. The hub's "Use c0mpute network" entry
|
||||||
|
# runs /usr/local/bin/agentbbs-c0mpute.
|
||||||
|
COPY agentbbs-c0mpute /usr/local/bin/agentbbs-c0mpute
|
||||||
|
RUN mkdir -p /opt/c0mpute \
|
||||||
|
&& curl -fsSL https://c0mpute.com/install.sh -o /tmp/c0mpute-install.sh \
|
||||||
|
&& HOME=/opt/c0mpute NO_STORAGE_RELOCATE=1 sh /tmp/c0mpute-install.sh \
|
||||||
|
--no-start --no-coinpay --no-infernet --no-transcode --no-exec </dev/null \
|
||||||
|
&& rm -f /tmp/c0mpute-install.sh \
|
||||||
|
&& ln -sf /opt/c0mpute/.c0mpute/bin/c0mpute /usr/local/bin/c0mpute \
|
||||||
|
&& ln -sf /opt/c0mpute/.c0mpute/bin/c0mpute-tui /usr/local/bin/c0mpute-tui \
|
||||||
|
&& ln -sf /opt/c0mpute/.bun/bin/bun /usr/local/bin/bun \
|
||||||
|
&& chmod -R a+rX /opt/c0mpute \
|
||||||
|
&& chmod 0755 /usr/local/bin/agentbbs-c0mpute \
|
||||||
|
&& rm -rf /opt/c0mpute/.config /opt/c0mpute/.local/share \
|
||||||
|
&& test -x /opt/c0mpute/.c0mpute/bin/c0mpute-tui \
|
||||||
|
&& bun --version && c0mpute --version
|
||||||
|
|
||||||
# A login hint so members know the AI tools are present and BYO-key.
|
# A login hint so members know the AI tools are present and BYO-key.
|
||||||
RUN printf '%s\n' \
|
RUN printf '%s\n' \
|
||||||
'AgentBBS pod — coding tools ready:' \
|
'AgentBBS pod — coding tools ready:' \
|
||||||
' claude (Claude Code) — export ANTHROPIC_API_KEY=... or run: claude' \
|
' claude (Claude Code) — export ANTHROPIC_API_KEY=... or run: claude' \
|
||||||
' codex (OpenAI Codex) — export OPENAI_API_KEY=... or run: codex' \
|
' codex (OpenAI Codex) — export OPENAI_API_KEY=... or run: codex' \
|
||||||
|
' c0mpute (c0mpute.com) — free AI chat: c0mpute chat login, then c0mpute chat' \
|
||||||
' git push → git@git.profullstack.com (your BBS SSH key is your git key)' \
|
' git push → git@git.profullstack.com (your BBS SSH key is your git key)' \
|
||||||
> /etc/motd \
|
> /etc/motd \
|
||||||
&& printf '[ -n "$PS1" ] && [ -r /etc/motd ] && cat /etc/motd\n' \
|
&& printf '[ -n "$PS1" ] && [ -r /etc/motd ] && cat /etc/motd\n' \
|
||||||
|
|
|
||||||
53
pods/agentbbs-c0mpute
Executable file
53
pods/agentbbs-c0mpute
Executable file
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# agentbbs-c0mpute [chat|tui]: the hub's "Use c0mpute network" entry, run
|
||||||
|
# inside the member's pod. Signs the member in to their own c0mpute account on
|
||||||
|
# first use (free account; chat runs on the free tier until they add a
|
||||||
|
# balance), then opens `c0mpute chat` (members) or `c0mpute tui` (operators).
|
||||||
|
# The sign-in key lives in the member's persisted home, so this is a one-time
|
||||||
|
# step per member.
|
||||||
|
mode="${1:-chat}"
|
||||||
|
# c0mpute logs an INFO "tracing initialised" line to the terminal; keep the
|
||||||
|
# screen clean unless the member asks for more.
|
||||||
|
export RUST_LOG="${RUST_LOG:-warn}"
|
||||||
|
|
||||||
|
pause() {
|
||||||
|
printf '\n%s' "Press Enter to return to the BBS menu. "
|
||||||
|
read -r _ || true
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! command -v c0mpute >/dev/null 2>&1; then
|
||||||
|
echo "c0mpute is not installed in this pod yet. It arrives with the next pod image."
|
||||||
|
pause
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! c0mpute chat whoami >/dev/null 2>&1; then
|
||||||
|
cat <<'EOF'
|
||||||
|
c0mpute network: free AI chat on open models (c0mpute.com).
|
||||||
|
|
||||||
|
Sign in once with your own c0mpute account (free: chat runs on the free tier).
|
||||||
|
This pod remembers the sign-in, so you only do this the first time.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
if ! c0mpute chat login; then
|
||||||
|
echo
|
||||||
|
echo "Sign-in did not finish. Pick 'Use c0mpute network' again to retry."
|
||||||
|
pause
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$mode" in
|
||||||
|
tui) c0mpute tui ;;
|
||||||
|
*)
|
||||||
|
echo "c0mpute chat: type a message. Quit the chat to return to the BBS menu."
|
||||||
|
c0mpute chat
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
rc=$?
|
||||||
|
if [ "$rc" -ne 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "c0mpute exited with status $rc."
|
||||||
|
pause
|
||||||
|
fi
|
||||||
|
exit "$rc"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue