@worker-protocol/conformance
Point it at a Worker's base URL, get a report of what it complies with.
worker-protocol is an open specification for Workers that can be seen, operated and given work by
people who did not build them. HTTP and JSON Schema, no runtime. A Worker describes itself in a
Descriptor served at /.well-known/worker-protocol — the one address this protocol fixes — and
declares there which of its Capabilities it implements.
This is the tool that checks whether it does what it says. It is also how the name is earned: the
protocol is Apache-2.0, but a claim that something speaks worker-protocol is one this project
vouches for, and a report from here is what stands behind it.
Run it
npx @worker-protocol/conformance https://fleet.example.com
worker-protocol-conformance <base-url> [options]
--credential <token> Presented as `Authorization: Bearer <token>`.
Prefer WORKER_PROTOCOL_CREDENTIAL: argv is visible to
every process on the machine, and a CI log often keeps it.
--may-perform Allow POSTs to Actions. Off by default: an Action is an
operation somebody's operators chose to expose, and a tool
pointed at a Worker to inspect it does not perform work on
it uninvited. Rules needing one report notExercised.
--arrangement <file> A JSON file of what the Worker's operators arranged so that
more can be seen: safe Actions, more credentials, the Action
that publishes: verify()'s `arrangement`, except `sink`,
which is the two options below.
--sink-port <port> Serve a sink on 127.0.0.1:<port> for `subscriptions`. Needs
publishingAction in the arrangement. 0 takes a free port.
--sink-url <url> Where the Worker is to deliver, when that is not the socket:
a tunnel's public https URL forwarding to --sink-port. A
deployed Worker refuses a plaintext or loopback sink.
--json Write the report to stdout as JSON, and nothing else.
-h, --help This.
Exit: 0 nothing failed, 1 a rule failed, 2 the run could not be made.
Everything but actions is a read, and a read leaves the Worker as it found it. That is why
--may-perform is a decision you make rather than a default: the rules that need a POST report
notExercised with that as the reason until you do.
From TypeScript
import { tally, verify } from "@worker-protocol/conformance";
const report = await verify({
baseUrl: "https://fleet.example.com",
credential: process.env.WORKER_PROTOCOL_CREDENTIAL,
mayPerform: true,
arrangement: {
safeAction: { name: "record-check", input: { vehicle: "ABC-123", reachable: true } },
secondCredential: process.env.SECOND_CREDENTIAL,
},
});
const counts = tally(report.results);
for (const { rule, verdict, detail } of report.results) {
if (verdict === "fails") console.error(`${rule.id} (${rule.file}): ${detail}`);
}
verify() runs in any runtime with a fetch — Node, Bun, Deno, a Cloudflare Worker, a Vercel
edge function, a Convex action — so a Control Tower can verify the Workers it enrolls from inside
its own runtime. The library imports no Node built-in and reads no file: the rule universe is
compiled into the module, so a bundler that inlines the package leaves nothing behind. Only the
command line needs Node. This package's own suite runs verify() on workerd with no Node
compatibility enabled.
verify also takes a fetch of your own, for a test, for a caller that needs its own agent, or
for a Worker reached in-process through its app.fetch rather than over the network.
The verdicts, and why there are five
A report covers every rule the edition defines, not only the ones a run exercised. A rule that
nothing claimed is not silence — it says under its own name why nothing claimed it.
| Verdict |
What it means |
passes |
The check ran and the Worker satisfied it. |
fails |
The check ran and the Worker did not. Exit 1. |
notExercised |
The Worker declares no such Capability, or the check needs a Worker arranged to be observed and this one is not. A gap somebody can close. |
unverified |
The rule's subject is the Worker, and no party outside it can observe a violation. |
otherSubject |
The rule binds a verifier, a Control Tower, a consumer or an issuer — not a Worker. This tool never contacted whoever it obliges. |
notExercised never fails the run, and it is deliberately not the same word as unverified: they
read alike on a page and are opposite facts. A report that counted either as compliance would be
vouching for something nobody checked.
Each result carries the rule's id, the specification file that defines it, whether the rule is
required or recommended, and one line saying why for every verdict but passes. The ids are
fixed from edition 0.1 on: a rewrite that could change a verdict takes a new id and withdraws the
old, so a report stays true however long after it was produced somebody reads it.
Arranging a Worker so more can be seen
Some rules have no ordinary witness: nothing a tool can do to an unarranged Worker will ever see a
violation. An Action that succeeds, an input refused on the Worker's own rules, a second credential
issued to the same holder, a Worker that started moments ago. The arrangement cannot come from the
protocol — putting test scaffolding into a Descriptor would make every Worker in the network carry
it — so it arrives the way the base URL and the credential do: out of band, from whoever set it up.
arrangement takes safeAction, secondSafeAction, refusedInput, asyncAction,
secondCredential, otherCallerCredential, consumerCredential, unprivilegedCredential,
uncoveredAction, uncoveredQuery, applyGrants, justStarted, replaceableSettings,
recordsEveryRequest, publishedEvent, sink, publishingAction, answeringAction, before,
after and abandonment. Anything not arranged reports notExercised naming what was missing.
recordsEveryRequest: true says the Worker writes a record for every request it serves, which is
what lets the verifier make a record exist without knowing the Worker's domain: reading the feed is
itself a write. LOG-3 and ENDP-33 need it to see a newer record reach the top and a cursor never
carry one back, and LOG-11 needs it to send a read under a trace of its own and find the record it
caused by asking for that trace.
uncoveredAction is a credential and a declared Action it does not cover. ACT-22 posts that Action
with it, carrying no key and a body that is not JSON, and expects 403 before anything else. A
conformant Worker performs nothing with that call; one that checks no coverage and ignores the body
of an Action without input would, so it is made only with mayPerform, like every other POST.
TASK-44 reads the Tasks with it and expects every one that Action answers to carry available
without it.
uncoveredQuery is the same for a declared Query: a credential, and a Query it does not cover.
QRY-10 reads that Query with it, beside a parameter no Query declares, and expects 403 and not
the 400 that parameter would earn. It is a GET, so it needs no mayPerform.
applyGrants: true, with mayPerform, lets the verifier apply a grant with its own credential as
the applicant: one grant under an id of its own, covering no Task type and no event type, which it
narrows, rotates and revokes before the run ends. Applying issues a real credential on the Worker,
which is why it is never done uninvited (GRANT-2 to GRANT-9).
before and after are Actions the verifier performs around every check, in order and with
mayPerform: what puts the Worker in a state where its rules can be exercised now — a source
paused so an Alert is open, a Task raised — and what puts it back however the checks went. A
before step the Worker refuses stops the run, since the verdicts would describe a state it was
never put in.
subscriptions is judged at a sink: sink is a URL the Worker can reach and a function answering
what arrived there, and publishingAction an Action safe to perform that publishes a named event
type. verify() starts no server, so the sink is yours to run. A sink that also takes
respond({ status, retryAfter }) lets the verifier make it fail: it answers the first attempt 503
with Retry-After: 1, watches the failure on record (SUB-16) and the same event arrive again
(SUB-12). With abandonment: true it keeps failing for the Worker's abandonAfterSeconds and waits
for the subscription to end and say so (SUB-14, SUB-15) — off by default, because that wait is the
Worker's declared window. The CLI's sink can be told to fail.
From the command line, the arrangement is a file, and the sink is the CLI's own:
npx @worker-protocol/conformance https://fleet.example.com --may-perform \
--arrangement arrangement.json --sink-port 8788 --sink-url https://sink.example.trycloudflare.com
{
"safeAction": { "name": "record-check", "input": { "vehicle": "ABC-123", "reachable": true } },
"otherCallerCredential": "another-callers-token",
"publishingAction": {
"name": "record-check",
"input": { "vehicle": "DEF-456", "reachable": true },
"publishes": "tech.rowing.worker-protocol.task-ended"
}
}
publishingAction has to publish while it is being performed, or soon after: the verifier waits
thirty seconds for the delivery by default, which verify({ patienceMs }) and --patience change.
The specification fixes no delivery deadline, so this is the tool's patience and not a rule. It
costs nothing on a run that passes, because the wait ends when the delivery arrives; only the checks
that wait for something not to arrive, SUB-13 and EVT-21, wait longer.
answeringAction is an Action safe to perform, an input, and the id of an open Task it answers with
that input: { "name": "record-check", "input": { … }, "task": "task-7" }. The verifier subscribes
to task-answered at the sink, performs it naming the Task in Worker-Protocol-Task, and repeats
it under the same key — one event for the performance and none for the repeat (EVT-20, EVT-21). It
may close the Task, so name one nothing else in the arrangement needs open. TASK-39 to TASK-43 need
no Task named: they use the safe Actions above against whatever Tasks the Worker holds open, and
the Tasks they name are refused or answered from the record, so nothing more is performed.
The file is checked strictly: a key it does not know stops the run with exit 2 rather than being
ignored, because an ignored key reports its rules notExercised to somebody who believes they
arranged them. It is also the place for the extra credentials, which argv would show to every
process on the machine. A deployed Worker refuses a sink in plaintext or on a loopback address
(SUB-5, SUB-6), so --sink-url is a tunnel's public https address forwarding to --sink-port;
only a Worker in development that exempts the socket's origin is reached without one.
A safe Action may carry an otherInput: a second input its schema accepts, which ENDP-17, ENDP-34
and ENDP-35 send under the same key. The two scope rules play two callers, so they also need
otherCallerCredential — a credential the Worker attributes to somebody other than the recorded
caller, which secondCredential, issued to the same holder, is not — and an Action safe to perform
for each origin a key can come from: secondSafeAction is the one whose key comes from the origin
safeAction's does not.
Editions
The verifier declares which edition it holds, and the report carries both that and what the Worker
declared. A verifier that does not hold the Worker's MAJOR verifies nothing and reports that it
is the one that is behind — rather than failing a Worker for a surface added after this tool was
built. Against a Worker that declares an earlier MINOR it judges only the rules that edition
contains (DESC-31): each rule added since is notExercised, naming the edition that introduced
it, and every rule records that edition as introducedIn in the universe below.
The rule universe travels inside this package, generated from the specification, and universe()
hands it back: the rules, the error codes, and the map from a place inside a document to the rule
that governs it — which is how a report names the obligation that was broken rather than
announcing that a document is invalid. It ships twice from one generation: compiled into the
library, and as rules.json for a reader outside JavaScript.
What standing it has
Nothing here carries behavior of its own. Every check reports against a rule id, and a check
that observed something the specification does not require would be this package making the
standard. When this tool and the specification disagree, the specification is right and this is the
bug.
Fixing what it reports, with a coding agent
npx skills add rowing-tech/worker-protocol --skill worker-protocol
An Agent Skill carrying the protocol in any language: what each rule id
means, where its file is, the surface an implementer without an SDK writes by hand, and the gotchas
behind the failures this tool reports most. --all adds a second one for TypeScript on Hono.
Related packages
@worker-protocol/schemas — the Zod objects that generate the normative JSON Schemas.
@worker-protocol/hono — mount(): implement an interface and get every address, header and
refusal this protocol fixes.
@worker-protocol/client — consume(): read a Worker, and take work from it.
License and name
Apache-2.0, patent grant included — implement the protocol in any product, commercial or not,
without asking anyone. The name is not part of that grant (Apache-2.0 §6).