bootstrap: first-run interview + answer-driven config and installs

Bootstrap now asks the questions that make a fresh machine work and installs
only what the answers require. `cli setup` (new `semif_agent/setup.py`) runs
the interview — decision engine (local SemIf 4B or remote Winnow), new-skill
authoring mode (+ llm/codegen endpoints/keys when enabled), capability packs,
gateways, timezone — and writes the split config + secrets.json from the
answers, plus a machine-readable install plan.

Both ends of the spectrum work end to end: the minimum is the local SemIf 4B
engine + the essentials pack (canned replies, time/timers, calculator) with no
gateway, authoring, or heavy downloads; the maximum enables every pack, a
remote engine, remote llm/codegen, and all gateways. `--yes` takes the minimum
unattended; `--answers FILE` replays a saved answer set; a rerun skips the
interview and `--reconfigure` re-runs it.

The plan drives the conditional stages: engine clone/GGUF/tokenizer and
requirements/engine.txt only for a local engine; requirements/transports.txt
only when a SimpleX/LXMF transport is selected; the simplex-chat binary,
Playwright, and the voice stack only when their pack/gateway is on; and only
the systemd units the answers need (a reconfigure retires dropped ones).

Also fixed:
- `config-init`/`setup` could never run on a fresh machine: main() loaded
  config before parsing the subcommand. Config-independent subcommands now run
  before the config is required.
- codegen was mandatory at startup even with authoring disabled (SystemExit on
  an empty model); build_codegen_client now returns None, and the scheduler
  guards every create door. build_llm_client likewise returns None for a
  non-semif provider with no model.
- the gateway unit ran `--platform all`, which would try the foreground-only
  voice platform in a headless service; it now runs the explicit daemon list.

requirements/ is split by concern (core/engine/transports + voice/browser);
staging.txt is the union. Docs updated (README, AGENTS). New
tests/test_setup.py covers both paths, interview branching, secrets merge, and
the plan round-trip.
This commit is contained in:
gabby committed 2026-10-14 02:07:18 +00:00
1 parent d67ea26f3d
commit 2296801b22
12 files changed
+1789 -386

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
# Core agent deps (the agent itself is stdlib-only; this is the test runner).
#
# Every host installs this. The decision engine, messaging transports, voice,
# and browser stacks are separate, optional files (engine.txt, transports.txt,
# voice.txt, browser.txt) so a host installs only what its answers require.
# `staging.txt` includes all of them for a full provision.
pytest
+18
View File
@@ -0,0 +1,18 @@
# Local decision-engine deps (SemIf / llama.cpp, CPU path).
#
# Only needed on a host whose `engine.provider` is the local SemIf GGUF. A host
# pointed at a remote Winnow decision server (engine.provider == "winnow")
# installs neither this file nor the SemIf engine clone / GGUF / tokenizer.
#
# semIF (semif-phase1) hard-pins torch/accelerate/safetensors/sentencepiece/
# protobuf/numpy==2.2.6 in its BASE dependencies, but the llamacpp backend
# never imports torch (it's lazy inside direct.score), and numpy 2.2.6 has no
# cp314 wheel (source build fails). So semif-phase1 is installed with
# `--no-deps` and exactly this set is brought in instead. The pins match the
# proven staging venv; huggingface-hub is pinned to 1.31.0 (semif-phase1's
# declared version) so the pip resolver stays quiet about it.
numpy==2.3.5
transformers==5.17.0
tokenizers==0.23.2
huggingface-hub==1.31.0
llama-cpp-python==0.3.35
+12 -22
View File
@@ -1,23 +1,13 @@
# Staging-machine engine deps (CPU llama.cpp path).
# Full provision: every dependency this repo can need, for a host that runs the
# local decision engine, all messaging transports, the voice gateway, and the
# browser bridge. This is the union of the per-concern files below; a
# `scripts/bootstrap.sh` run installs only the subset its answers require, so
# prefer those files (engine.txt, transports.txt, voice.txt, browser.txt) when
# provisioning by hand.
#
# semIF (semif-phase1) hard-pins torch/accelerate/safetensors/sentencepiece/
# protobuf/numpy==2.2.6 in its BASE dependencies, but the llamacpp backend
# never imports torch (it's lazy inside direct.score), and numpy 2.2.6 has no
# cp314 wheel (source build fails). So semif-phase1 is installed with
# `--no-deps` and exactly this set is brought in instead. The pins match the
# proven staging venv; huggingface-hub is pinned to 1.31.0 (semif-phase1's
# declared version) so the pip resolver stays quiet about it.
numpy==2.3.5
transformers==5.17.0
tokenizers==0.23.2
huggingface-hub==1.31.0
llama-cpp-python==0.3.35
pytest
# Messaging gateway transport (SimpleX adapter). Optional: lazy-imported, the
# gateway refuses to start without it. Not needed by the decision engine.
websockets==15.0.1
# LXMF (Reticulum) gateway transport. Optional: lazy-imported, the gateway
# refuses to start without it. Runs in-process — there is no daemon binary.
# rns pulls cryptography + pyserial transitively (resolved by pip).
lxmf==1.2.0
rns==1.5.7
# Voice and browser stacks are hardware/optional and are NOT included here —
# install them with `scripts/bootstrap.sh --voice` / `--browser` (or
# `pip install -r requirements/voice.txt` / `browser.txt`).
-r core.txt
-r engine.txt
-r transports.txt
+13
View File
@@ -0,0 +1,13 @@
# Messaging transport deps (SimpleX + LXMF gateways/bridges).
#
# Only needed on a host that enables the SimpleX gateway or bridge (which uses
# `websockets` against its simplex-chat daemon) or the LXMF gateway (in-process
# `lxmf`/`rns`). Both are lazy-imported, so a host without them still runs every
# other front end; the gateway refuses to start with an install hint.
#
# `websockets` is shared by the command gateway and the forwarding bridge (the
# neutral `semif_agent/simplex_ws.py`). `lxmf` pulls `rns` (Reticulum) and
# cryptography transitively; both are pinned so the resolver stays quiet.
websockets==15.0.1
lxmf==1.2.0
rns==1.5.7