# Remote service backend

Status: SDK0.5.54 software and its private package delivery are qualified. Source0.4.38, AST27 and wire1 remain unchanged. Independent before-code expectations, one standalone abstract control and all four first source/installed Node24/22 profiles are accepted. Three same-original terminal reopens and one separate complete restored copy added no callbacks. The separate hosted C04 service has accepted bounded recovery evidence; read its [hosting guide](cloud-service-host.md) for the exact public transport limits. This software profile does not establish unlimited or whole-platform readiness.

This profile gives a trusted native Node server a fixed registry of independent workspaces. Each workspace has its own original service engine, queue and effect journal. It does not load programs, imports, filesystem paths or SQL supplied by an HTTP client. The existing local `createServiceServer` contract remains unchanged.

## Access

The bindings are `REMOTE_SERVICE_LIMITS`, `openServiceAuthority` and `createRemoteServiceServer` in the existing `soloncode/service` entry. They do not change the portable root entry or add a CLI flag.

A native administrator issues an opaque random bearer credential for one subject, workspace and role. The authority stores a domain-separated digest and credential metadata; it returns the raw bearer once to that native caller. Store the client credential privately. It must never enter a program, model prompt, public fixture, URL, diagnostic or server log. Issuance and revocation are native administrative operations, without a public registration endpoint or default password.

| Role | Permitted operations in its workspace |
| --- | --- |
| Reader | Read the session, program descriptors, job summaries, one job and synchronization snapshot |
| Operator | Reader operations, submit a draft and cancel with the current job version |
| Owner | Operator operations and a separate explicit decision with the current job version |

The authenticated credential selects the workspace. Request data cannot select another workspace, increase the role or turn guest `Truth yes` into native approval. A source input named `approval` keeps the original service restriction. Only the separate owner operation calls the original engine's decision method.

The server authenticates before reading a body and rechecks expiry, revocation and current authority after the awaited read, immediately before a synchronous operation. Revocation during a request prevents that operation. Revocation does not silently undo work already accepted durably.

## Requests and synchronization

The route set is finite:

- `GET /v1/session`
- `GET /v1/programs`
- `GET /v1/jobs`
- `GET /v1/jobs/:id`
- `GET /v1/sync?after=REVISION`
- `POST /v1/jobs`
- `POST /v1/jobs/:id/cancel`
- `POST /v1/jobs/:id/approve`

Every route requires a current bearer. POST bodies use the bounded canonical UTF8 JSON profile; duplicate keys, noncanonical encoding, unknown fields and unsafe revisions refuse. GET permits only absent Content-Length or literal `0`, with no Transfer-Encoding; malformed framing may be rejected by the Node HTTP parser before authentication. There is no route for native files, source modules, credential administration, arbitrary tools or backup downloads. Errors exclude private paths, bearer digests, native claim tokens and private execution messages.

Writes retain existing permanent request IDs and expected-version checks. Two clients using the same job version cannot both change it. After a lost response, inspect that same job. A different ID or a new credential does not grant permission to repeat an external effect.

Synchronization captures one synchronous queue view and returns bounded job summaries with its revision. An equal cursor returns unchanged; a stale cursor returns the current full summary; a future or unsafe cursor refuses. Fetch an individual job for its bounded result. This is not an offline edit merge, an unlimited event feed or an atomic snapshot of every queue and effect journal together.

## Unknown outcomes and recovery

The original journal remains authoritative when a tool's outcome is unknown. Reconnects, new clients, aliases, token rotation and reopening the same original stores do not clear that fence or call the tool again. A separate workspace cannot read, approve or recover another workspace's intent.

The remote server closes its transport and waits for outstanding body readers. Its close method does not own the caller's engines or authority. The native application explicitly pauses, drains and closes those handles before backup.

A backup requires known closed original stores, the complete fixed registry and all private files, including owner companions. Preserve the originals and verify a complete manifest before claiming success. Restore only into a separately authorized new private target. That target is a restored copy, not the original physical store. Recovery must retain unknown outcomes and must not issue an adapter call on startup. There is no automatic reset, reclaim, failover or distributed ownership lease.

## Transport and deployment

The first Node profile listens on loopback. Production use requires a separately configured exact HTTPS origin and a trusted TLS proxy to that running origin. Development loopback use is identified separately. A configured URL, an active proxy connector or a passing local test does not prove TLS, origin availability or continuous hosting.

Every client supplies the exact configured Origin, including native clients. Host and Origin checks are exact; forwarded headers do not select the authority. Public implementation files and readable SDK archives remain private. Public documentation may describe the API and contain synthetic examples. Deployment must independently verify the allowlisted resources, private-path refusals and required security headers.

## Qualification

Before product code, an independent finite contract fixes successful and refused role, token, version, synchronization, uncertainty and recovery cases. A standalone control supplies an independent comparison. The four first source/installed Node24/22 profiles retained205 client response pairs and24 individual one-time credential originals privately. One designated complete original tree, three terminal reopens and a separately labelled restore are accepted. Original negative Source reviews remain retained. See the [machine-readable finite verification](../examples/remote-service-backend/public-verification.json). No real model or provider request is part of this profile. Limits are finite capacity checks; they do not establish unlimited scale, process-memory bounds or full model cost advantages.
