spec: skills may call a plain HTTP API directly; bridges are opt-in
Reframe bridges as a deliberate choice rather than the mandatory path to any third-party system. A skill body may call a service's own HTTP API directly with a stdlib transport; a bridge is warranted only when a simple, repeatable skill file would be inconsistent, inconvenient, or unsafe — state (especially auth state), sanitized connectivity, or a native/heavy protocol. When a bridge fronts a service, the body calls the bridge and must never reach around it. Updates CODEGEN.md, PACKGEN.md, TESTGEN.md, README.md, AGENTS.md, the bridges/__init__.py docstring, the codegen BODY_DIRECTIVES + describe_ bridges() prompt strings, and the tests pinning their wording.
This commit is contained in:
1 parent
f379c0a746
commit
0b02a3feac
10 files changed
+122
-59
No files matched your search
@@ -2,13 +2,14 @@
|
||||
|
||||
A **bridge service** is a standalone process that exposes one third-party system
|
||||
(SimpleX, the local language model, Nextcloud, Microsoft Graph / Outlook, a real
|
||||
web browser via Playwright) to
|
||||
codegen-authored skill bodies
|
||||
over a local, token-guarded HTTP API. It exists so a generated body never speaks
|
||||
a system's native protocol (WebSocket, SMTP, CalDAV, an OpenAI-compatible chat
|
||||
API, a CLI's private flags) directly: it calls a small, documented, uniform HTTP
|
||||
surface instead, and the bridge owns the messy integration details and
|
||||
credentials.
|
||||
web browser via Playwright) to codegen-authored skill bodies over a local,
|
||||
token-guarded HTTP API. A skill body can call a plain HTTP API directly; a
|
||||
bridge is a deliberate choice for a system that needs state (especially auth
|
||||
state), a native or heavy protocol, or one sanitized surface. When a bridge
|
||||
fronts a service, a generated body never speaks that system's native protocol
|
||||
(WebSocket, SMTP, CalDAV, an OpenAI-compatible chat API, a CLI's private flags)
|
||||
directly: it calls a small, documented, uniform HTTP surface instead, and the
|
||||
bridge owns the messy integration details and credentials.
|
||||
|
||||
Two boundaries matter:
|
||||
|
||||
|
||||
@@ -80,9 +80,12 @@ def describe_bridges() -> str:
|
||||
bridge needs to be running or enabled.
|
||||
"""
|
||||
lines = [
|
||||
"Available bridge services (call these over HTTP with urllib.request; "
|
||||
"never speak a service's native protocol directly; read every value "
|
||||
"from ctx.config):",
|
||||
"Available bridge services — call a service's own HTTP API directly "
|
||||
"when it is a plain HTTP API; use one of these bridges when the service "
|
||||
"needs state/auth, a native or heavy protocol, or a sanitized surface. "
|
||||
"For a service a bridge fronts, call the bridge over HTTP with "
|
||||
"urllib.request rather than reaching around it; read every value from "
|
||||
"ctx.config:",
|
||||
]
|
||||
for info in known_infos():
|
||||
lines.append(f"- {info.name} (service: {info.service}): {info.description}")
|
||||
|
||||
+11
-7
@@ -140,17 +140,21 @@ BODY_DIRECTIVES = (
|
||||
"body.\n"
|
||||
"Declare the integration as a module-level `INTEGRATION` dict exactly as "
|
||||
"CODEGEN.md specifies: service, transport, config_vars.\n"
|
||||
"If this skill interacts with one of the available bridge services listed "
|
||||
"below, call that bridge over HTTP with the URL from its config variable — "
|
||||
"never speak the service's native protocol directly (no WebSocket to "
|
||||
"simplex-chat, no direct daemon access). Whenever you have a set of "
|
||||
"To reach a service, call its HTTP API directly with a stdlib transport "
|
||||
"when it is a plain HTTP API; use one of the bridge services listed below "
|
||||
"when the service needs state/auth, a native or heavy protocol, or a "
|
||||
"sanitized surface — and when a bridge fronts a service, call the bridge "
|
||||
"over HTTP with the URL from its config variable rather than reaching "
|
||||
"around it (no WebSocket to simplex-chat, no direct daemon access, no "
|
||||
"DAV/OCS hand-rolling). Whenever you have a set of "
|
||||
"candidates to choose from (contacts, conversations, calendars, targets), "
|
||||
"employ a `ctx.engine` SemIf sub-decision over them and return the "
|
||||
"`(DecisionRequest, DecisionResult)` pairs on `ActionResult.decisions`; "
|
||||
"send only when the reusable goal calls for it.\n"
|
||||
"Keep the body small: it is ingested whole by the decision engine's "
|
||||
"fidelity check, so delegate protocol details to a bridge instead of "
|
||||
"hand-rolling them, and keep `act` to one purpose.\n"
|
||||
"fidelity check, so delegate complex protocol details to a bridge instead "
|
||||
"of hand-rolling them (a simple HTTP call needs no bridge), and keep `act` "
|
||||
"to one purpose.\n"
|
||||
)
|
||||
|
||||
|
||||
@@ -661,7 +665,7 @@ def _retry_prompt(
|
||||
guidance = (
|
||||
"The previous attempt was too long to fit the decision engine's "
|
||||
"context. Emit a SHORTER body: keep `act` minimal and delegate "
|
||||
"protocol details to a bridge.\n"
|
||||
"complex protocol details to a bridge.\n"
|
||||
)
|
||||
else:
|
||||
guidance = "You are looping; emit the final Python now.\n"
|
||||
|
||||
Reference in new issue
Block a user