Does: the one typed daemon contract — operations, schemas, roles, errors, pushes, protocol range.
Shapes:
- Public types are
z.inferred from these schemas, never written a second time. - The daemon parses every handler result through the output schema; a core field the schema does not declare is stripped, never sent.
config.getcarries a driver's own keys underiosandandroid, and a module's undercapabilities, as sent: a new one is no shape change.lease.requestholdsexcept(a slim iOS simulator lease keeping slim categories running, ADR 0066) to one object-level refinement with no path (exceptRefusal,operations-lease-request.ts), so every transport answersBAD_REQUESTwith the message as written: 1 to 16 names matchingEXCEPT_NAME_PATTERN, none twice, never withphysical, a platform but iOS ormode: full. The worker's default mode and a baseline's mode are checked in leasing.lease.request'smetadata(ADR 0074 §3) is held to one object-level refinement too (refuseBadMetadata): the same words on every transport. A gateway hands it to its admission command alone; nothing else may read it.- Wire input is a claim: every field a gateway parses from a worker is bounded here (
fit*,CONSOLE_URL_MAX_LENGTH,relay.ts). - One OS grammar (
os-range.ts), one duration parser (duration.ts), one usage window (usageWindow,usage-window.ts), one events page query (eventsPageQuery,events-page.ts). Nobody else parses. inbox.tsandversion-order.tsimport nothing at run time: the console imports each by its own path, not the index (the index carries zod).
Operations:
- A call runs in a dispatcher, not here: parse input → role check →
authorize→ park on readiness → handler → parse output. - An
authorizehook lets an id nothing knows pass, so the handler's own not-found answers. effect(read|write) sets the daemon log level only. Never on the wire.operations.test.tsholds the role and effect matrices; an operation missing from either fails.
Three identities:
- principal — fixed at
hellofor the connection. HTTP: the signed-in identity's. - requester — per request (
requesterId, default the principal). The one-lease-per-requester key. - owner —
ownerIdon the lease, set from the principal at grant.
Protocol version:
PROTOCOL_VERSION_RANGEinprotocol.tsholds it, and nothing else writes the number.DAEMON_PROTOCOL_VERSION(src/daemon-protocol/) is itsmax.- Every change to a contract shape bumps it by one in the same PR. Move
mintoo, unless a compatibility path stays side by side. .agents/scripts/protocol-bump-check.mjschecks it on push and in CI; it counts every file here as a shape but tests,index.tsand the helpers itsNOT_SHAPESlists. A new helper that carries no wire shape goes in that list.daemon.stopanddaemon.updateare accepted at any version, so the upgrade path exists. Their input and answer never change shape;operations.test.tspinsdaemon.update's JSON schemas.
Errors and views:
UNKNOWN_DAEMON_ERRORandCANCELLEDare built client side only.workerViewFieldsis the one builder of a worker view: a gateway'sWorkerLinkand a worker answering about itself both call it.- In a worker view,
update,lastUpdateFailureandlatestVersionarenullwhen there is nothing to show, and absent until the first status read. A status without an update clearsupdate.
- Its family's
operations-*.ts:defineOperation, withauthorizewhen it acts on one lease. Add it toOPERATIONS(operations.ts). operations.test.ts: a row in the role matrix and the effect matrix.protocol.ts:PROTOCOL_VERSION_RANGE+ 1.- Handlers in a
src/daemon/dispatcher-*.tspart andsrc/gateway/dispatcher.ts. A gateway-only operation answersUNSUPPORTED_IN_WORKER_MODEon a worker; the reverse,UNSUPPORTED_IN_GATEWAY_MODE. - Client: a method on
SimlockClientorSimlockAdminClient(src/simlock-client/client-api.ts), types insrc/simlock-client/types.ts, re-exported fromsrc/client/index.tsorsrc/admin/index.ts. - Frontends as needed: CLI, HTTP, MCP only for an agent session's need.
- A new error code:
ErrorDetailsMapandERROR_TABLE(errors.ts). - Docs: the website pages that describe it, at least errors.mdx (documentation rule 9).