docs: stop presenting the in-memory client as the way to connect (#3443)
This commit is contained in:
parent
0c9136841f
commit
7bb486a10f
7 changed files with 803 additions and 598 deletions
|
|
@ -78,7 +78,7 @@ kill "$SERVER_PID"
|
|||
- `RESOURCE_URL` is hard-coded to port 8000 (the harness's in-process origin).
|
||||
If you change `--port`, edit `RESOURCE_URL` to match or the PRM document's
|
||||
`resource` field will be wrong.
|
||||
- Auth is HTTP-only; over stdio or the in-memory transport `get_access_token()`
|
||||
- Auth is HTTP-only; over stdio (or the in-memory test transport) `get_access_token()`
|
||||
returns `None` and there is no gate.
|
||||
- The 401/403 status codes and `WWW-Authenticate` header are HTTP-level and
|
||||
`Client` cannot observe them; they are pinned by
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ kill "$SERVER_PID"
|
|||
`exp` has passed and expires tokens out of its own store.
|
||||
- `transport_security=NO_DNS_REBIND` is harness-only; drop it for a real
|
||||
deployment.
|
||||
- Auth is HTTP-only; over stdio or the in-memory transport there is no gate.
|
||||
- Auth is HTTP-only; over stdio (or the in-memory test transport) there is no gate.
|
||||
|
||||
## Spec
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ Drop `--server server_lowlevel` (on either transport) to run against the
|
|||
|
||||
- `client.py` `main` — `async with Client(target, mode=mode) as client:` is the
|
||||
whole connection. The story owns the construction; `target` is whatever
|
||||
`Client()` accepts (an in-process server, a transport, or an HTTP URL) and
|
||||
the entry point picks it.
|
||||
`Client()` accepts (an HTTP URL, `StdioServerParameters`, a transport, or,
|
||||
in tests, an in-process server) and the entry point picks it.
|
||||
- `client.py` — `if page.next_cursor is None: break`. Termination is
|
||||
key-absent, not falsy; `while cursor:` would be a spec bug.
|
||||
- `server_lowlevel.py` — the handler owns the cursor encoding (here: an
|
||||
|
|
|
|||
|
|
@ -21,8 +21,9 @@ uv run python -m stories.prompts.client --http --server server_lowlevel
|
|||
## What to look at
|
||||
|
||||
- `client.py` `main` — the body opens with `async with Client(target,
|
||||
mode=mode) as client:`; `target` is anything `Client(...)` accepts (an
|
||||
in-process server, a `Transport`, or an HTTP URL).
|
||||
mode=mode) as client:`; `target` is anything `Client(...)` accepts (an HTTP
|
||||
URL, `StdioServerParameters`, a `Transport`, or, in tests, an in-process
|
||||
server).
|
||||
- `server.py` `greet` vs `code_review` — return a bare `str` (wrapped as one
|
||||
user message) or a `list[Message]` for a multi-turn seed conversation.
|
||||
- `server.py` `complete()` — one global handler dispatches on `ref` +
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ traffic and has `server_info` / `server_capabilities` available immediately.
|
|||
## Run it
|
||||
|
||||
```bash
|
||||
# over HTTP — Streamable HTTP only; in-memory has no "round-trip" to skip.
|
||||
# HTTP only: the point of this story is skipping a network round trip.
|
||||
# The client self-hosts the server on a free port, runs, then tears it down.
|
||||
uv run python -m stories.reconnect.client --http
|
||||
# same, against the lowlevel-API server variant
|
||||
|
|
|
|||
|
|
@ -21,8 +21,9 @@ uv run python -m stories.resources.client --http --server server_lowlevel
|
|||
|
||||
- `client.py` `async with Client(target, mode=mode) as client:` — the one line
|
||||
every client example exists to teach. `target` is anything `Client()`
|
||||
accepts (an in-process server, a transport, or an HTTP URL) and `mode=` is
|
||||
always explicit; the rest of the story is the body of that `async with`.
|
||||
accepts (an HTTP URL, `StdioServerParameters`, a transport, or, in tests, an
|
||||
in-process server) and `mode=` is always explicit; the rest of the story is
|
||||
the body of that `async with`.
|
||||
- `server.py` `app_config` vs `greeting` — a URI with no `{}` registers a
|
||||
static resource (appears in `resources/list`); a URI with `{name}` registers
|
||||
a template (appears only in `resources/templates/list`) and the placeholder
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ uv run python -m stories.schema_validators.client --http --server server_lowleve
|
|||
## What to look at
|
||||
|
||||
- `client.py` `main` — the body opens with `async with Client(target, mode=mode)
|
||||
as client:`. `target` is anything `Client` accepts (an in-process server, a
|
||||
transport, or an HTTP URL); the entry point picks it, the story constructs it.
|
||||
as client:`. `target` is anything `Client` accepts (an HTTP URL,
|
||||
`StdioServerParameters`, a transport, or, in tests, an in-process server);
|
||||
the entry point picks it, the story constructs it.
|
||||
- `server.py` — `who.name` vs `who["name"]`: pydantic and dataclass parameters
|
||||
arrive as **instances** (attribute access); TypedDict and `dict[str, Any]`
|
||||
arrive as plain dicts.
|
||||
|
|
|
|||
Loading…
Reference in a new issue