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
@@ -1514,8 +1514,12 @@ CLI, unit tests (24) + integration tests (2).
|
|||||||
### bridges (third-party API services)
|
### bridges (third-party API services)
|
||||||
|
|
||||||
- **What they are.** A bridge service is a standalone process that stands up a
|
- **What they are.** A bridge service is a standalone process that stands up a
|
||||||
simple, secure localhost HTTP layer in front of one third-party system so a
|
simple, secure localhost HTTP layer in front of one third-party system,
|
||||||
codegen-authored skill body never speaks that system's native protocol.
|
warranted when the system needs state (especially auth state), a native or
|
||||||
|
heavy protocol, or one sanitized surface; a system with a plain HTTP API needs
|
||||||
|
no bridge — its skill calls the API directly. When a bridge fronts a service, a
|
||||||
|
codegen-authored skill body calls the bridge and never speaks that system's
|
||||||
|
native protocol.
|
||||||
SimpleX is the first; adding a service means adding a class to
|
SimpleX is the first; adding a service means adding a class to
|
||||||
`bridges/registry.py` `CATALOG`, a `pack.json` whose `config` schema carries
|
`bridges/registry.py` `CATALOG`, a `pack.json` whose `config` schema carries
|
||||||
its block (see `semif_agent/packs.py`; a shared, skill-less bridge like the
|
its block (see `semif_agent/packs.py`; a shared, skill-less bridge like the
|
||||||
|
|||||||
+55
-19
@@ -13,7 +13,12 @@ contract `PACKGEN.md`.
|
|||||||
## What a skill is
|
## What a skill is
|
||||||
|
|
||||||
Semif-agent is an end-user application: an everyday person asks it to do a task,
|
Semif-agent is an end-user application: an everyday person asks it to do a task,
|
||||||
and it does that task using a combination of native python modules, user-provided data and a catalog of basic services known as bridges. A skill is the thing that performs one of those tasks: it is the leaf in the skill tree that the agent navigates to when it has resolved a request to a single, concrete action. Navigation is performed by an llm-based decision engine known as SemIf.
|
and it does that task using native python modules — including direct HTTP
|
||||||
|
requests to a service's own API — user-provided data, and, where warranted, a
|
||||||
|
catalog of basic services known as bridges. A skill is the thing that performs
|
||||||
|
one of those tasks: it is the leaf in the skill tree that the agent navigates to
|
||||||
|
when it has resolved a request to a single, concrete action. Navigation is
|
||||||
|
performed by an llm-based decision engine known as SemIf.
|
||||||
|
|
||||||
A skill is three things:
|
A skill is three things:
|
||||||
|
|
||||||
@@ -180,6 +185,14 @@ Rules:
|
|||||||
hand; a title is generated by the LLM, not assembled by string concatenation
|
hand; a title is generated by the LLM, not assembled by string concatenation
|
||||||
when it should be written; a date is parsed by code, not asked of a model.
|
when it should be written; a date is parsed by code, not asked of a model.
|
||||||
|
|
||||||
|
**Connectivity is separate from these three sources.** The table is about
|
||||||
|
*values*, not about how a body reaches a service. A body calls a **plain HTTP
|
||||||
|
API directly** with a stdlib transport (endpoint and credentials read from
|
||||||
|
`ctx.config`); a bridge is only for a service that needs state (especially auth
|
||||||
|
state), a native or heavy protocol, or one sanitized surface. See "Bridge
|
||||||
|
services" below for when to use one — and the hard rule for a service a bridge
|
||||||
|
already fronts.
|
||||||
|
|
||||||
## The registry entry
|
## The registry entry
|
||||||
|
|
||||||
The body writer does **not** author a manifest. The `llm` provider authors the
|
The body writer does **not** author a manifest. The `llm` provider authors the
|
||||||
@@ -557,29 +570,44 @@ therefore run as a later step of a chain.
|
|||||||
- **Keep the body small — it is ingested whole.** The fidelity decision reads
|
- **Keep the body small — it is ingested whole.** The fidelity decision reads
|
||||||
the *entire* body, so a body that exceeds the engine's context budget is
|
the *entire* body, so a body that exceeds the engine's context budget is
|
||||||
rejected outright (the pipeline retries once with a "make it shorter"
|
rejected outright (the pipeline retries once with a "make it shorter"
|
||||||
instruction). Delegate protocol details to a bridge instead of hand-rolling a
|
instruction). Delegate **complex** protocol details to a bridge instead of
|
||||||
client, and keep `act` to one purpose; a long body is a signal that the
|
hand-rolling a client (a simple HTTP call needs no bridge), and keep `act` to
|
||||||
integration belongs in a bridge.
|
one purpose; a long body is a signal that the integration belongs in a bridge.
|
||||||
- **The function is `act` exactly.** The module is imported under its registered
|
- **The function is `act` exactly.** The module is imported under its registered
|
||||||
leaf name; the entry point is a module-level `act(ctx, request)`.
|
leaf name; the entry point is a module-level `act(ctx, request)`.
|
||||||
|
|
||||||
## Bridge services
|
## Bridge services
|
||||||
|
|
||||||
Some real systems are reached through a **bridge service**: a standalone local
|
A body reaches a real service with a stdlib transport. A **plain HTTP API** is
|
||||||
process that stands up a small, token-guarded HTTP API in front of the system
|
called directly — `urllib.request` / `http.client`, endpoint and credentials read
|
||||||
and owns its native protocol and credentials. The concrete catalog of bridges —
|
from `ctx.config` — and needs no bridge. Some systems, however, are reached
|
||||||
which services exist, their base-URL config var, auth, config vars, and the
|
through a **bridge service**: a standalone local process that stands up a small,
|
||||||
exact endpoints with their request/response/error shapes — is injected into the
|
token-guarded HTTP API in front of the system and owns its native protocol,
|
||||||
prompt at authoring time (render it with
|
credentials, and connection state. Reach for a bridge only when a simple,
|
||||||
|
repeatable skill file would otherwise be inconsistent, inconvenient, or unsafe:
|
||||||
|
|
||||||
|
- **State, especially auth state.** The service needs an OAuth token, a session
|
||||||
|
cookie, a live daemon connection, a read cursor, or other state a stateless,
|
||||||
|
re-run-from-the-top `act` cannot own.
|
||||||
|
- **Sanitized connectivity.** You want one narrow, token-guarded, audited
|
||||||
|
surface instead of arbitrary bodies speaking the service's raw protocol.
|
||||||
|
- **A native or heavy protocol.** The service speaks WebSocket/DAV/OCS or needs
|
||||||
|
a third-party dependency (a browser, a mail client) a one-file stdlib body
|
||||||
|
must not carry.
|
||||||
|
|
||||||
|
When a bridge **does** front a service, the body calls the bridge and must never
|
||||||
|
reach around it to the service's native protocol — no WebSocket to
|
||||||
|
`simplex-chat`, no direct daemon access, no DAV/OCS hand-rolling. It calls the
|
||||||
|
bridge's HTTP API with the base URL from the bridge's config variable, exactly
|
||||||
|
like any other HTTP integration:
|
||||||
|
|
||||||
|
The concrete catalog of bridges — which services exist, their base-URL config
|
||||||
|
var, auth, config vars, and the exact endpoints with their request/response/error
|
||||||
|
shapes — is injected into the prompt at authoring time (render it with
|
||||||
`semif_agent.bridges.describe_bridges()`); read it rather than guessing. This
|
`semif_agent.bridges.describe_bridges()`); read it rather than guessing. This
|
||||||
section is only the generic pattern; the catalog is the source of truth for the
|
section is only the generic pattern; the catalog is the source of truth for the
|
||||||
bridge-specific details.
|
bridge-specific details.
|
||||||
|
|
||||||
A body must never speak a service's native protocol directly — no WebSocket to
|
|
||||||
`simplex-chat`, no direct daemon access. It calls the bridge's HTTP API with the
|
|
||||||
base URL from the bridge's config variable, exactly like any other HTTP
|
|
||||||
integration:
|
|
||||||
|
|
||||||
```python
|
```python
|
||||||
INTEGRATION = {
|
INTEGRATION = {
|
||||||
"service": "<the bridge's service id, from the catalog>",
|
"service": "<the bridge's service id, from the catalog>",
|
||||||
@@ -590,6 +618,9 @@ INTEGRATION = {
|
|||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
|
|
||||||
|
- **A plain HTTP service needs no bridge.** If the service exposes a normal HTTP
|
||||||
|
API and needs none of the three triggers above, call it directly with a stdlib
|
||||||
|
transport; declare its endpoint in `CONTRACT` and read it from `ctx.config`.
|
||||||
- **Read every value from `ctx.config`.** The base URL, any token, and any
|
- **Read every value from `ctx.config`.** The base URL, any token, and any
|
||||||
default (recipient/contact/target) come from the config vars the catalog
|
default (recipient/contact/target) come from the config vars the catalog
|
||||||
lists. Never hardcode a host, port, or bridge address in the body.
|
lists. Never hardcode a host, port, or bridge address in the body.
|
||||||
@@ -617,6 +648,9 @@ Rules:
|
|||||||
|
|
||||||
- Single purpose, single file, single module.
|
- Single purpose, single file, single module.
|
||||||
- Avoid duplicating an existing skill in the same category.
|
- Avoid duplicating an existing skill in the same category.
|
||||||
|
- Reach a plain HTTP API directly; use a bridge only for a service that needs
|
||||||
|
state/auth, a native or heavy protocol, or one sanitized surface — and never
|
||||||
|
reach around a bridge that fronts the service.
|
||||||
- `act` resolves ambiguity (arguments, recipients, targets) with SemIf
|
- `act` resolves ambiguity (arguments, recipients, targets) with SemIf
|
||||||
sub-decisions, mirroring how `nextcloud.create_event` resolves which calendar
|
sub-decisions, mirroring how `nextcloud.create_event` resolves which calendar
|
||||||
to write to.
|
to write to.
|
||||||
@@ -658,12 +692,14 @@ A generated skill is accepted only if:
|
|||||||
11. `INTEGRATION` is present, flat, string-valued, uses the transport vocabulary,
|
11. `INTEGRATION` is present, flat, string-valued, uses the transport vocabulary,
|
||||||
and is consistent with the body's `ctx.config` reads and behavior.
|
and is consistent with the body's `ctx.config` reads and behavior.
|
||||||
12. It does no network, file, or engine work at import time.
|
12. It does no network, file, or engine work at import time.
|
||||||
13. If it is a messaging skill, it uses a bridge service over HTTP (never a
|
13. If the service it targets is fronted by a bridge, it calls that bridge over
|
||||||
service's native protocol), resolves recipients with a SemIf sub-decision,
|
HTTP (never the service's native protocol); otherwise it may call the
|
||||||
and sends only on explicit user intent.
|
service's HTTP API directly. A messaging skill resolves recipients with a
|
||||||
|
SemIf sub-decision and sends only on explicit user intent.
|
||||||
14. It is small enough to be ingested whole by the fidelity decision (a body
|
14. It is small enough to be ingested whole by the fidelity decision (a body
|
||||||
over the engine's artifact budget is rejected as too long) — delegate
|
over the engine's artifact budget is rejected as too long) — delegate
|
||||||
protocol details to a bridge rather than hand-rolling them.
|
complex protocol details to a bridge rather than hand-rolling them (a simple
|
||||||
|
HTTP call needs no bridge).
|
||||||
|
|
||||||
Items 1 and 7 are hard checks in the parser (`parse_skill_body`) and reject the
|
Items 1 and 7 are hard checks in the parser (`parse_skill_body`) and reject the
|
||||||
body outright. The rest are not statically rejected: a missing or inconsistent
|
body outright. The rest are not statically rejected: a missing or inconsistent
|
||||||
|
|||||||
+16
-7
@@ -35,8 +35,10 @@ Three boundaries must stay crisp:
|
|||||||
- A **skill** is one leaf action (`packs/<name>/skills/<category>/<leaf>/`),
|
- A **skill** is one leaf action (`packs/<name>/skills/<category>/<leaf>/`),
|
||||||
governed by `CODEGEN.md`/`TESTGEN.md`. A pack contains skills; it is not one.
|
governed by `CODEGEN.md`/`TESTGEN.md`. A pack contains skills; it is not one.
|
||||||
- A **bridge** is a standalone process in front of a third-party system
|
- A **bridge** is a standalone process in front of a third-party system
|
||||||
(`semif_agent/bridges/`). A pack *references* a bridge by name; it never
|
(`semif_agent/bridges/`), warranted when the system needs state (especially
|
||||||
contains bridge code.
|
auth state), a native or heavy protocol, or one sanitized surface; a system
|
||||||
|
with a plain HTTP API needs no bridge — its skill calls the API directly. A
|
||||||
|
pack *references* a bridge by name; it never contains bridge code.
|
||||||
- A pack is **declarative structure** and is committed. Per-machine values are
|
- A pack is **declarative structure** and is committed. Per-machine values are
|
||||||
the split config; credentials live in `secrets.json`. A committed pack never
|
the split config; credentials live in `secrets.json`. A committed pack never
|
||||||
holds a secret.
|
holds a secret.
|
||||||
@@ -181,7 +183,9 @@ authored into one — and stops its bridge. The switch lives in the pack's
|
|||||||
## Referencing a bridge by name
|
## Referencing a bridge by name
|
||||||
|
|
||||||
A pack whose skills talk to a third-party system lists that bridge in
|
A pack whose skills talk to a third-party system lists that bridge in
|
||||||
`bridges` and carries its config block in `config`. The bridge itself is a
|
`bridges` and carries its config block in `config`. (A pack whose skills reach a
|
||||||
|
plain HTTP API directly needs no bridge: `bridges` stays empty and each leaf
|
||||||
|
declares the endpoint in its own `CONTRACT`.) The bridge itself is a
|
||||||
class in `semif_agent/bridges/` registered in `bridges/registry.py` `CATALOG`.
|
class in `semif_agent/bridges/` registered in `bridges/registry.py` `CATALOG`.
|
||||||
Its `BridgeInfo` (name, service, description, URL config var, other config
|
Its `BridgeInfo` (name, service, description, URL config var, other config
|
||||||
vars, auth header, endpoints) is injected into every codegen prompt via
|
vars, auth header, endpoints) is injected into every codegen prompt via
|
||||||
@@ -206,8 +210,11 @@ Rules:
|
|||||||
## Authoring a new bridge
|
## Authoring a new bridge
|
||||||
|
|
||||||
A **bridge** is a standalone process that stands up a simple, secure localhost
|
A **bridge** is a standalone process that stands up a simple, secure localhost
|
||||||
HTTP layer in front of one third-party system, so a skill body never speaks
|
HTTP layer in front of one third-party system. Author one when a skill body
|
||||||
that system's native protocol. Adding a service means:
|
cannot sanely talk to the system itself — because it holds auth/session state,
|
||||||
|
needs a native or heavy protocol, or should be reached through one sanitized
|
||||||
|
surface. A system with a plain HTTP API needs no bridge: its skill calls the API
|
||||||
|
directly. Adding a bridge means:
|
||||||
|
|
||||||
1. **Write the bridge class** in `semif_agent/bridges/<name>.py`, subclassing
|
1. **Write the bridge class** in `semif_agent/bridges/<name>.py`, subclassing
|
||||||
`BridgeService` (`semif_agent/bridges/base.py`). Set the `name` attribute and
|
`BridgeService` (`semif_agent/bridges/base.py`). Set the `name` attribute and
|
||||||
@@ -360,8 +367,10 @@ HTTP). For a bridge with top-level fallbacks, see `packs/nextcloud/`.
|
|||||||
|
|
||||||
1. Decide the concern and the category ids; write navigation-grade category
|
1. Decide the concern and the category ids; write navigation-grade category
|
||||||
descriptions.
|
descriptions.
|
||||||
2. If a third-party system is involved and no bridge fronts it, author the
|
2. If a third-party system is involved and it needs state/auth, a native or
|
||||||
bridge first (see "Authoring a new bridge") and register it in `CATALOG`.
|
heavy protocol, or one sanitized surface, author a bridge first (see
|
||||||
|
"Authoring a new bridge") and register it in `CATALOG`. A system with a plain
|
||||||
|
HTTP API needs no bridge — the skill calls it directly.
|
||||||
3. Create `packs/<name>/pack.json` with `name`, `title`, `concern`,
|
3. Create `packs/<name>/pack.json` with `name`, `title`, `concern`,
|
||||||
`categories`, `bridges` (if any), `requires`, `enabled_by_default`, and the
|
`categories`, `bridges` (if any), `requires`, `enabled_by_default`, and the
|
||||||
`config` schema.
|
`config` schema.
|
||||||
|
|||||||
@@ -354,8 +354,9 @@ fine-tuning loop — it is not yet the fine-tune itself.
|
|||||||
- **Messenger command gateway (SimpleX + LXMF)** — take commands and reply over DM.
|
- **Messenger command gateway (SimpleX + LXMF)** — take commands and reply over DM.
|
||||||
- **Voice gateway** — a local microphone front end: wake word + speech-to-text +
|
- **Voice gateway** — a local microphone front end: wake word + speech-to-text +
|
||||||
text-to-speech, all local (openWakeWord / faster-whisper / Piper).
|
text-to-speech, all local (openWakeWord / faster-whisper / Piper).
|
||||||
- **Standalone bridge services** — a token-guarded localhost HTTP layer in front
|
- **Standalone bridge services** — an optional token-guarded localhost HTTP
|
||||||
of third-party systems, so generated bodies never speak native protocols.
|
layer for third-party systems that need state/auth, a native protocol, or a
|
||||||
|
sanitized surface; a plain HTTP API is called directly.
|
||||||
- **Seeds** — shipped real starter skills: `nextcloud.create_event` (the
|
- **Seeds** — shipped real starter skills: `nextcloud.create_event` (the
|
||||||
authoritative worked example), `nextcloud.next_event` (Nextcloud CalDAV),
|
authoritative worked example), `nextcloud.next_event` (Nextcloud CalDAV),
|
||||||
`nextcloud.create_task` (Nextcloud task list),
|
`nextcloud.create_task` (Nextcloud task list),
|
||||||
@@ -748,9 +749,11 @@ python -m semif_agent.cli gateway --platform voice
|
|||||||
|
|
||||||
`cli bridge` runs standalone bridges: each is a process that stands up a small,
|
`cli bridge` runs standalone bridges: each is a process that stands up a small,
|
||||||
token-guarded localhost HTTP API in front of one third-party system (and, where
|
token-guarded localhost HTTP API in front of one third-party system (and, where
|
||||||
the system needs one, owns its own daemon/profile). Generated skill bodies call
|
the system needs one, owns its own daemon/profile). A bridge is a deliberate
|
||||||
them like any HTTP service (base URL from a config var), so they never speak a
|
choice for a system that needs state (especially auth state), a native or heavy
|
||||||
native protocol directly.
|
protocol, or one sanitized surface — a skill may call a plain HTTP API directly.
|
||||||
|
When a bridge fronts a service, generated skill bodies call it like any HTTP
|
||||||
|
service (base URL from a config var) and never speak the native protocol.
|
||||||
|
|
||||||
The first bridge is **SimpleX** (`semif_agent/bridges/simplex.py`), with its own
|
The first bridge is **SimpleX** (`semif_agent/bridges/simplex.py`), with its own
|
||||||
simplex-chat daemon separate from the gateway's. Its HTTP surface:
|
simplex-chat daemon separate from the gateway's. Its HTTP surface:
|
||||||
|
|||||||
+7
-6
@@ -87,12 +87,13 @@ A stdlib-only Python script that:
|
|||||||
Assert the server actually received the expected request (method, path,
|
Assert the server actually received the expected request (method, path,
|
||||||
headers, body) where practical. The loopback address exists only in the test;
|
headers, body) where practical. The loopback address exists only in the test;
|
||||||
the body must read its endpoint from config.
|
the body must read its endpoint from config.
|
||||||
- For a messaging skill (a body that talks to a bridge service), stand up a
|
- For a body that talks to a bridge service (or any fixed HTTP API), stand up a
|
||||||
loopback server implementing the bridge endpoints the body uses (the bridge
|
loopback server implementing the endpoints the body uses (the bridge catalog
|
||||||
catalog injected into this prompt lists them) and assert the body built the
|
injected into this prompt lists a bridge's; for a direct HTTP API, mirror the
|
||||||
real requests. If the catalog names an auth header, set the fixture token in
|
routes the body calls) and assert the body built the real requests. If the
|
||||||
the fixture config and assert the body sent that header. Never connect to a
|
catalog names an auth header, set the fixture token in the fixture config and
|
||||||
real service daemon or a live bridge.
|
assert the body sent that header. Never connect to a real service daemon or a
|
||||||
|
live bridge.
|
||||||
- For non-HTTP transports (IMAP, SMTP, subprocess, ...), exercise config
|
- For non-HTTP transports (IMAP, SMTP, subprocess, ...), exercise config
|
||||||
resolution, argument construction, and error paths (missing or misconfigured
|
resolution, argument construction, and error paths (missing or misconfigured
|
||||||
values) without performing the real I/O.
|
values) without performing the real I/O.
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
A **bridge service** is a standalone process that exposes one third-party system
|
A **bridge service** is a standalone process that exposes one third-party system
|
||||||
(SimpleX, the local language model, Nextcloud, Microsoft Graph / Outlook, a real
|
(SimpleX, the local language model, Nextcloud, Microsoft Graph / Outlook, a real
|
||||||
web browser via Playwright) to
|
web browser via Playwright) to codegen-authored skill bodies over a local,
|
||||||
codegen-authored skill bodies
|
token-guarded HTTP API. A skill body can call a plain HTTP API directly; a
|
||||||
over a local, token-guarded HTTP API. It exists so a generated body never speaks
|
bridge is a deliberate choice for a system that needs state (especially auth
|
||||||
a system's native protocol (WebSocket, SMTP, CalDAV, an OpenAI-compatible chat
|
state), a native or heavy protocol, or one sanitized surface. When a bridge
|
||||||
API, a CLI's private flags) directly: it calls a small, documented, uniform HTTP
|
fronts a service, a generated body never speaks that system's native protocol
|
||||||
surface instead, and the bridge owns the messy integration details and
|
(WebSocket, SMTP, CalDAV, an OpenAI-compatible chat API, a CLI's private flags)
|
||||||
credentials.
|
directly: it calls a small, documented, uniform HTTP surface instead, and the
|
||||||
|
bridge owns the messy integration details and credentials.
|
||||||
|
|
||||||
Two boundaries matter:
|
Two boundaries matter:
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,12 @@ def describe_bridges() -> str:
|
|||||||
bridge needs to be running or enabled.
|
bridge needs to be running or enabled.
|
||||||
"""
|
"""
|
||||||
lines = [
|
lines = [
|
||||||
"Available bridge services (call these over HTTP with urllib.request; "
|
"Available bridge services — call a service's own HTTP API directly "
|
||||||
"never speak a service's native protocol directly; read every value "
|
"when it is a plain HTTP API; use one of these bridges when the service "
|
||||||
"from ctx.config):",
|
"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():
|
for info in known_infos():
|
||||||
lines.append(f"- {info.name} (service: {info.service}): {info.description}")
|
lines.append(f"- {info.name} (service: {info.service}): {info.description}")
|
||||||
|
|||||||
+11
-7
@@ -140,17 +140,21 @@ BODY_DIRECTIVES = (
|
|||||||
"body.\n"
|
"body.\n"
|
||||||
"Declare the integration as a module-level `INTEGRATION` dict exactly as "
|
"Declare the integration as a module-level `INTEGRATION` dict exactly as "
|
||||||
"CODEGEN.md specifies: service, transport, config_vars.\n"
|
"CODEGEN.md specifies: service, transport, config_vars.\n"
|
||||||
"If this skill interacts with one of the available bridge services listed "
|
"To reach a service, call its HTTP API directly with a stdlib transport "
|
||||||
"below, call that bridge over HTTP with the URL from its config variable — "
|
"when it is a plain HTTP API; use one of the bridge services listed below "
|
||||||
"never speak the service's native protocol directly (no WebSocket to "
|
"when the service needs state/auth, a native or heavy protocol, or a "
|
||||||
"simplex-chat, no direct daemon access). Whenever you have a set of "
|
"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), "
|
"candidates to choose from (contacts, conversations, calendars, targets), "
|
||||||
"employ a `ctx.engine` SemIf sub-decision over them and return the "
|
"employ a `ctx.engine` SemIf sub-decision over them and return the "
|
||||||
"`(DecisionRequest, DecisionResult)` pairs on `ActionResult.decisions`; "
|
"`(DecisionRequest, DecisionResult)` pairs on `ActionResult.decisions`; "
|
||||||
"send only when the reusable goal calls for it.\n"
|
"send only when the reusable goal calls for it.\n"
|
||||||
"Keep the body small: it is ingested whole by the decision engine's "
|
"Keep the body small: it is ingested whole by the decision engine's "
|
||||||
"fidelity check, so delegate protocol details to a bridge instead of "
|
"fidelity check, so delegate complex protocol details to a bridge instead "
|
||||||
"hand-rolling them, and keep `act` to one purpose.\n"
|
"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 = (
|
guidance = (
|
||||||
"The previous attempt was too long to fit the decision engine's "
|
"The previous attempt was too long to fit the decision engine's "
|
||||||
"context. Emit a SHORTER body: keep `act` minimal and delegate "
|
"context. Emit a SHORTER body: keep `act` minimal and delegate "
|
||||||
"protocol details to a bridge.\n"
|
"complex protocol details to a bridge.\n"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
guidance = "You are looping; emit the final Python now.\n"
|
guidance = "You are looping; emit the final Python now.\n"
|
||||||
|
|||||||
@@ -739,7 +739,7 @@ def test_describe_bridges_renders_service_auth_and_endpoints():
|
|||||||
assert "/inbox/next" in text
|
assert "/inbox/next" in text
|
||||||
assert "/unread" in text
|
assert "/unread" in text
|
||||||
assert "/history" in text
|
assert "/history" in text
|
||||||
assert "never speak" in text
|
assert "rather than reaching around it" in text
|
||||||
|
|
||||||
|
|
||||||
def test_read_marks_given_items_only():
|
def test_read_marks_given_items_only():
|
||||||
|
|||||||
@@ -1715,7 +1715,8 @@ def test_skill_contract_documents_bridge_pattern_only():
|
|||||||
text = read_skill_contract()
|
text = read_skill_contract()
|
||||||
# The generic pattern lives in CODEGEN.md; the bridge specifics do not.
|
# The generic pattern lives in CODEGEN.md; the bridge specifics do not.
|
||||||
assert "describe_bridges()" in text
|
assert "describe_bridges()" in text
|
||||||
assert "never speak a service's native protocol" in text
|
assert "plain HTTP API" in text
|
||||||
|
assert "reach around it to the service's native protocol" in text
|
||||||
assert "simplex_bridge_url" not in text
|
assert "simplex_bridge_url" not in text
|
||||||
assert "/inbox/next" not in text
|
assert "/inbox/next" not in text
|
||||||
assert "X-Semif-Token" not in text
|
assert "X-Semif-Token" not in text
|
||||||
@@ -1723,7 +1724,8 @@ def test_skill_contract_documents_bridge_pattern_only():
|
|||||||
|
|
||||||
def test_body_directives_expose_bridge_services():
|
def test_body_directives_expose_bridge_services():
|
||||||
assert "bridge services" in BODY_DIRECTIVES
|
assert "bridge services" in BODY_DIRECTIVES
|
||||||
assert "never speak the service's native protocol" in BODY_DIRECTIVES
|
assert "plain HTTP API" in BODY_DIRECTIVES
|
||||||
|
assert "rather than reaching around it" in BODY_DIRECTIVES
|
||||||
|
|
||||||
|
|
||||||
def test_body_prompts_require_real_action_and_integration():
|
def test_body_prompts_require_real_action_and_integration():
|
||||||
|
|||||||
Reference in new issue
Block a user