Remote: the service-compris client

The thin fetch wrapper virta talks to a service-compris host through, and the sync log built on it. service-compris the package is the platform's decision kernel only — no HTTP, no client — so this is the whole client, and it is small on purpose: the universal endpoint is four routes.

GET    /doc?p=<collection>/<id>          → the document (404 → null)
PUT    /doc   { p, data }                → "updated …" | "unchanged …"   (update only)
POST   /doc   { p, data }                → "created …"                    (create only)
DELETE /doc?p=…
GET    /docs?p=<collection>&c=&o=&f=     → [ { …fields, _path } ]
GET    /docs?p=<collection>&since=<seq>  → { rows, cursor, more }        (a sequenced collection)
POST   /docs  { writes: [{ p, data, method? }] } → { status: 'committed', written, results: [{ p, seq? }] }
GET    /install?name=<ns> · POST /install { manifest, approving? } · DELETE /install?name=

Every request carries `Authorization: Bearer tsp_…`, a scoped capability
token from the [authorize](/authorize/) loop. The token is the writer's
identity: it never appears in a URL, a log line, or an error message.

## `RemoteLog`

`RemoteLog` implements `SyncLog` over one installed collection, `virta:event`
by default (see the [manifest](/manifest/)), which the manifest declares
with `envelope: { seq: true }`. A **push** is one atomic commit —
`POST /docs` with every event as an upsert keyed by its own id, so a
retried push is a no-op and a torn commit cannot happen — and the host's
`_seq` for each event comes back in the result. A **pull** is the delta
query, `GET /docs?since=<cursor>`, which answers `{ rows, cursor, more }`;
`more` is the host's word, never inferred from a short page. A host that
has not sequenced the collection answers `not-sequenced`, which surfaces as
a clear error rather than an empty log.

This is service-compris 0.2.0-beta.2's surface (tosijs-platform#14 and
#15, both filed from here and both closed within a day). The cost the
platform is explicit about: a sequenced collection serialises its writes,
roughly one commit a second. An event log with a few writers is inside
that; a bulk import is one commit of up to a hundred events at a time.

Verified end to end against virta's own host (`virta-7e070`, 2026-09-21):
push, delta pull, a second store replaying to the same state.