Skip to main content
A UI on piloop reads a view at a cursor, follows the event feed from that cursor, and reads the view again when an event touches it. This loop prints the inbox again each time a comment arrives:
piloop watch is a complete UI built this way. Its code is in piloop/watch/. It imports only the API’s clients and models, and a test keeps it so. The hosted piloop console is another client of the same routes, written in TypeScript on the OpenAPI document.

Connect

On the machine of the daemon, call its Unix socket. The socket knows you as the owner of the home, so it needs no token. From another machine, call the server’s URL with a token that piloop token create made (see Run piloop on a server).
The x-piloop-actor header asks to act as an actor, such as orchestrator. Writes sign as that actor. Without it, a call acts as the caller itself. Python clients use piloop.api.client.Client and its models. A client in another language reads the OpenAPI document, which the server also serves at GET /v1/openapi.json, and generates its types from it.

Read a view at a cursor

Every view answers with a cursor: the id of the newest event that it includes. The overview and the lineage carry their own vocabulary, so a UI draws them without knowing the campaign’s type. A block of the overview is one of four kinds. A lineage declares the kinds, statuses and tracks of its nodes.

Follow the feed

Read GET /v1/events?after=<cursor>&wait=20 in a loop, from the cursor of the first view, then from each next. The server holds a read until an event comes, or for wait seconds. Then it answers with no events and a later next. Event feed describes the batch. Each event names its subject: the kind and the id of the row that it is about, and the row’s campaign. Read again only the views that the subject touches. piloop watch reads the inbox again for a comment, the ideas for an idea, and the lineage for a candidate or a measurement.

Act

A write answers with the row that it changed, at a cursor. Its effects arrive on the feed, like any other client’s. A refused write answers 404 or 409 with a ProblemDetail: its error names the problem, and its detail says what to do. Show the detail.