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

+25
View File
@@ -833,6 +833,8 @@ class Scheduler:
inside it and hands off to the codegen body worker. On failure the
request is not re-dispatched and the user is told.
"""
if self.llm is None:
return self._authoring_unavailable(request, None)
self._queue_draft(request, None, "category")
return DispatchResult(
kind="create_category",
@@ -855,6 +857,8 @@ class Scheduler:
"""
if self._category_locked(category):
return self._blocked_create(request, category)
if self.llm is None:
return self._authoring_unavailable(request, category)
pending = request.meta.get("awaiting_skill_body")
if pending is not None:
category_pending, name = pending
@@ -875,6 +879,27 @@ class Scheduler:
),
)
def _authoring_unavailable(
self, request: Request, category: str | None
) -> DispatchResult:
"""The create door is open but no `llm` model is configured.
A deterministic configuration fact (traced), surfaced as a plain failure
so the user is not left waiting on a body that will never land. The
setup wizard prevents this by requiring an `llm` endpoint when authoring
is enabled, but a hand-edited config can still reach it.
"""
with self._lock:
self.trace.append(
"authoring_unavailable", request.id, category=category
)
message = (
"I can't write a new skill on this host — skill authoring is not "
"configured (no llm endpoint)."
)
self._notify_outbox(request.id, message)
return DispatchResult(kind="error", summary=message)
# ---- new-skill creation modes (deterministic per-category create door) ----
def _category_mode(self, category: str) -> str: