codegen: move bridge specifics into the catalog

Bridge specifics (service, base-URL config var, auth header/token var,
config-var docs, endpoints with error shapes) now live in BridgeInfo and
render through describe_bridges(), which is injected into body, retry,
regen, elicitation, and testgen prompts. SKILL.md/TESTGEN.md carry only
the generic pattern.

- regen prompt regains the catalog (was a dangling reference)
- elicitation integration hint rides body/retry/regen as an advisory
- top-level simplex_bridge_token config var; bootstrap syncs it
- simplex seeds read the token and send X-Semif-Token when set
This commit is contained in:
Denton Social committed 2026-09-28 23:30:44 -05:00
1 parent d0df6f16c4
commit 98ec4ee5e2
19 files changed
+324 -89

No files matched your search

+19 -2
View File
@@ -240,12 +240,29 @@ def test_stop_closes_the_daemon():
def test_known_infos_include_simplex():
infos = {info.name: info for info in known_infos()}
assert "simplex" in infos
assert infos["simplex"].url_config_var == "simplex_bridge_url"
info = infos["simplex"]
assert info.service == "simplex"
assert info.url_config_var == "simplex_bridge_url"
assert info.auth_header == "X-Semif-Token"
assert info.auth_config_var == "simplex_bridge_token"
def test_describe_bridges_names_the_service_and_config_var():
def test_every_bridge_documents_its_config_vars_and_auth():
for info in known_infos():
docs = dict(info.config_var_docs)
assert set(info.config_vars) <= set(docs), info.name
assert all(description.strip() for description in docs.values()), info.name
if info.auth_header or info.auth_config_var:
assert info.auth_header and info.auth_config_var, info.name
assert info.auth_config_var in info.config_vars, info.name
def test_describe_bridges_renders_service_auth_and_endpoints():
text = describe_bridges()
assert "simplex" in text
assert "service: simplex" in text
assert "simplex_bridge_url" in text
assert "X-Semif-Token" in text
assert "simplex_bridge_token" in text
assert "/inbox/next" in text
assert "never speak" in text
+60 -4
View File
@@ -23,6 +23,7 @@ from semif_agent.codegen import (
_retry_prompt,
build_elicitation_prompt,
build_skill_body_prompt,
build_testgen_base_prompt,
extract_integration,
generate_data_contract,
generate_requirements,
@@ -42,6 +43,7 @@ from semif_agent.codegen import (
run_skill_test,
skill_contract_ref,
)
from semif_agent.bridges.registry import describe_bridges
from semif_agent.decisions import Request
from semif_agent.skills import (
Skill,
@@ -1681,12 +1683,14 @@ def test_skill_contract_lists_all_transports():
assert transport in text
def test_skill_contract_documents_bridge_services():
def test_skill_contract_documents_bridge_pattern_only():
text = read_skill_contract()
assert "simplex_bridge_url" in text
assert "/inbox/next" in text
assert "/send" in text
# The generic pattern lives in SKILL.md; the bridge specifics do not.
assert "describe_bridges()" in text
assert "never speak a service's native protocol" in text
assert "simplex_bridge_url" not in text
assert "/inbox/next" not in text
assert "X-Semif-Token" not in text
def test_body_directives_expose_bridge_services():
@@ -1704,6 +1708,8 @@ def test_body_prompts_require_real_action_and_integration():
assert "Perform the real action" in joined
assert "INTEGRATION" in joined
assert "hermetic mechanics check" in joined
assert "service: simplex" in joined
assert "simplex_bridge_url" in joined
retry = _retry_prompt(
Request("check if the service is up"),
"tracking",
@@ -1713,6 +1719,56 @@ def test_body_prompts_require_real_action_and_integration():
)
assert "INTEGRATION" in retry[1]["content"]
assert BODY_DIRECTIVES in retry[1]["content"]
assert "service: simplex" in retry[1]["content"]
def test_body_prompt_carries_the_advisory_integration_hint():
tree = build_tree(build_skills({"skills": {}}))
draft = SkillDraft(
name="probe",
description="Probe the service.",
integration={"service": "simplex", "transport": "http"},
)
messages = build_skill_body_prompt(
Request("send a message"), "messaging", draft, tree, "THE CONTRACT"
)
joined = messages[1]["content"]
assert "advisory only" in joined
assert "service=simplex" in joined
assert "transport=http" in joined
def test_regen_prompt_includes_catalog_and_integration_hint():
from semif_agent.codegen import _regen_body_prompt
draft = SkillDraft(
name="probe",
description="Probe the service.",
integration={"service": "simplex", "transport": "http"},
)
messages = _regen_body_prompt(
Request("send a message"),
"messaging",
draft,
"THE CONTRACT",
GOOD_BODY,
{"error": "boom"},
reason_kind="run_failure",
)
joined = messages[1]["content"]
assert "service: simplex" in joined
assert "simplex_bridge_url" in joined
assert "service=simplex" in joined
assert BODY_DIRECTIVES in joined
def test_testgen_base_prompt_includes_catalog():
messages = build_testgen_base_prompt(
Request("send a message"), "messaging", "send_message", GOOD_BODY, "THE CONTRACT"
)
joined = messages[1]["content"]
assert describe_bridges().strip() in joined
assert "simplex_bridge_url" in joined
def test_retry_prompt_carries_requirements():