bridges: derive skill config vars from the bridge block

Bridge listener addresses were hand-maintained duplicates of
bridges.<name>.host/port at the top level (simplex_bridge_url,
llm_bridge_url, nextcloud_bridge_url, plus their _token). A host
provisioned before a bridge was added never gained the key, so a skill
for that bridge could not resolve its URL: the contract config search
fell back to 'ask' and a front end captured an unrelated reply as the
value (a voice task request was recorded as nextcloud_bridge_url).

Add bridges.registry.derived_config_vars(config): for every catalog
bridge, derive <name>_bridge_url/<name>_bridge_token from its own
bridges.<name> host/port/token. build_scheduler injects these into the
config the scheduler and ctx.config expose, so the contract config
search finds them and skills read them with no top-level duplicate.
A block with no port contributes no URL, leaving an unconfigured bridge
as an unresolved variable the operator is asked for. Bind-all hosts
normalize to 127.0.0.1.

Remove the six redundant top-level keys from config.example.json and
update README/AGENTS/bootstrap notes. Tests cover derivation, bind-all
normalization, and the unconfigured-bridge skip.
This commit is contained in:
gabby committed 2026-10-08 00:17:53 +00:00
1 parent d9cc7e4fed
commit 228886f7cd
8 files changed
+113 -36

No files matched your search

+13 -9
View File
@@ -734,9 +734,9 @@ CLI, unit tests (24) + integration tests (2).
`codegen.timeout: 3600`, the SimpleX gateway enabled
(`gateway.simplex.enabled = true`, `ws_url` from `simplex_chat.port`) and the
standalone forwarding bridge enabled (`bridges.simplex.enabled = true`,
`ws_url` from `simplex_chat.forward_port`, top-level `simplex_bridge_url`) and
the LLM bridge enabled (`bridges.llm.enabled = true`, top-level
`llm_bridge_url`; it reuses the `llm` model);
`ws_url` from `simplex_chat.forward_port`) and
the LLM bridge enabled (`bridges.llm.enabled = true`; it reuses the `llm`
model);
the operator sets `llm.model`/`llm.base_url` and `codegen.model`/
`codegen.base_url`. Bootstrap renders/enables four user services:
`semif-simplex.service` (the command `simplex-chat` bot daemon,
@@ -1273,9 +1273,13 @@ CLI, unit tests (24) + integration tests (2).
(surviving bridge restarts), unlike the live `/inbox` buffer; both are
read-only because v7 has no mark-read command (acking is a client-side read
receipt).
- **Skill-facing config.** The top-level `simplex_bridge_url` is the address a
body calls (the data-contract config search auto-populates it); bootstrap keeps
it in sync with the bridge port. Skills reach a bridge with the ordinary `http`
- **Skill-facing config.** A body calls a bridge at the address derived from that
bridge's own `bridges.<name>` block (`host`/`port`/`token`) — the
`simplex_bridge_url` / `llm_bridge_url` / `nextcloud_bridge_url` var (+ `_token`)
is injected into `ctx.config` by `build_scheduler` via
`bridges.registry.derived_config_vars`, so there is no duplicate top-level key to
keep in sync and the data-contract config search finds it and auto-populates the
skill config. Skills reach a bridge with the ordinary `http`
transport, so their hermetic tests are loopback HTTP like any other HTTP body.
`simplex.next_message` and `simplex.connect_link` are the seeds.
- **LLM bridge** (`bridges/llm.py`). A generic `POST /chat`
@@ -1287,7 +1291,7 @@ CLI, unit tests (24) + integration tests (2).
scheduler's already-configured `llm` client through `run_bridges`/`build_bridge`
into `LLMBridge`, so the endpoint/model/sampler stay configured once in the
top-level `llm` block; the `bridges.llm` block carries only the local listener
(`enabled`/`host`/`port`/`token`). Bodies reach it via the top-level
(`enabled`/`host`/`port`/`token`). Bodies reach it via the derived
`llm_bridge_url` (+ optional `llm_bridge_token`). It runs inside the existing
`semif-bridge.service` process (all enabled bridges start together); with no
client it reports `502`, never a fabricated reply. `calendar.create_event` is
@@ -1306,7 +1310,7 @@ CLI, unit tests (24) + integration tests (2).
`nextcloud_url`/`nextcloud_username`/`nextcloud_app_password`/
`nextcloud_default_calendar`/`nextcloud_default_addressbook` as a fallback, so
the same account the calendar seeds collect is configured once and a block value
wins. Bodies reach it via the top-level `nextcloud_bridge_url` (+ optional
wins. Bodies reach it via the derived `nextcloud_bridge_url` (+ optional
`nextcloud_bridge_token`); the `BridgeInfo` declares only those two config vars.
Routes (reads `GET`, mutations `POST`): files (`/files`, `/files/stat`,
`/files/read` text-or-base64, `/files/search`, `/files/write|mkdir|delete|move|copy`),
@@ -1357,7 +1361,7 @@ The bridge read path (`simplex.next_message`) and contact-link lookup
- [x] **4. LLM bridge** (`bridges/llm.py`). Shipped: `LLMBridge` exposes a
generic `POST /chat` in front of the scheduler's configured `llm` client
(threaded through `run_bridges`/`build_bridge`, never re-configured), registered
in `CATALOG` and seeded under `bridges.llm` + top-level `llm_bridge_url`.
in `CATALOG` and seeded under `bridges.llm` (its URL is derived from that block).
`calendar.create_event` extracts its title + description through it.
- [x] **5. More bridges.** Each new third-party API gets its own `bridges/<name>.py`
+ config block + `CATALOG` entry; the codegen prompts pick it up automatically