Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rooms

Every group on a site is a room in its chat, and portal says in that room what the group needs to act on: a new case on its desk, a deadline about to run out, a round that opened. People talk where they already are, and the desk stays where the work is.

The chat, kino, is a program beside the site, signing people in through the same provider, that dials the site over dhd/1 with a key of its own, like gdo and kron. It watches the site’s groups, takes what the site says in each room, asks who may read or post, and tells the site when a case has a thread. The design is issue #102; this page is what was built.

What a site gets

With nothing set but what a site already has, portal:

  • keeps every group the content names as a room, for the chat to Watch, and drops a group the content no longer names at the next load;
  • answers the chat’s question whether a person may read or post in a room (May, see Access);
  • says in a group’s room what lands on its desk, what a clock is about to do and did, what someone else moved, and what a schedule opened;
  • keeps what the chat says about a case’s thread, and shows it on the case on the desk, “Conversation in Counter (3)”, linking to the thread.

With CHAT_URL set, a case with no thread yet shows “Start a conversation”, linking to ${CHAT_URL}/room/<group>/case/<bucket>/<id>, where the chat opens the room with the thread beside it. Without CHAT_URL, and with no thread, the case shows nothing. With CHAT_URL, anyone signed in also gets “Open the chat” after the “Asked by” line. (Each in bokmål on a Norwegian site: “Samtale i …”, “Start en samtale”, “Åpne chatten”.)

A site with no chat beside it loses nothing: what it would say waits in its outbox for no one, and costs next to nothing.

The chat beside the site

The site names the chat’s key <key>=rooms,watch,may in DHD_KEYS. Every room and message carries the site’s name (SITE_NAME), so two sites’ board are two rooms.

whathowwho sayswho hears
the groupsWatch of groups: one document per room, then every changeportalthe chat
what the site saysrows of the rooms outbox, down the chat’s Serveportalthe chat, which keeps each in its room
who may read or postMaythe chat asksportal answers
a thread existsNote with subject: threadthe chatportal, which keeps the newest per case (portal_threads)

The thread’s messages never leave the chat. Portal keeps how many there are and where the thread is, nothing else.

The groups

A group is named wherever the content names one: a page’s qualifies, a resource’s requires_group, an invite:’s group, a state’s grants:, a schedule’s handled_by and for_each.group, a notice’s senders and group audiences, a board’s plan: group, a responsible:’s group. The key is the group’s name as the content writes it (without any KANIDM_GROUP_PREFIX). A name that cannot be a room’s name (anything but letters, digits, -, _ and =, or the name thread, which the chat keeps for itself) is left out, and the log says so.

The counter of the machine-hire example is one room:

{
  "group": "counter",
  "label": "Counter",
  "site": "northfield",
  "site_label": "Northfield Hire",
  "site_url": "https://hire.example",
  "lang": "en",
  "room": "northfield.chat.room.counter",
  "duties": [
    "Has 1 question only they see.",
    "Their desk: “What is happening at the counter?”.",
    "Sees hires.",
    "Moves cases in hires."
  ],
  "desks": [{ "label": "What is happening at the counter?", "url": "https://hire.example/counter" }],
  "updated": "2026-10-30T12:00:00Z"
}
  • label: the content’s own word for the group, where it has one: the name of a responsible: that names the group, else the label of a notice audience of it; otherwise the name made readable.
  • site: the namespace (portal without SITE_NAME); site_label the site’s title; site_url its PUBLIC_URL.
  • lang: the language’s code where portal speaks it (nb for no, nn, sv, da, de, en), else its lang as given.
  • duties: the sentences iris manual writes for the role under “Who does what” (“Hvem gjør hva”), as plain text, in the site’s language. The site has no needs.yaml, so a state is said by its text:, else its id made readable. May be empty.
  • desks: the pages that hold a desk of the group’s (a list of a bucket with buttons and the group’s requires_group), with absolute URLs; a dynamic page has no one address and is left out.

A key whose value is unchanged but for updated is not written again, so a reload that changes nothing about a group does not wake the chat.

What the site says

Each message is a row of the rooms outbox, handed to the chat down its Serve. A hire booked on the machine-hire site tells the counter:

{
  "id": "northfield:hires:7f3a…:landed:1",
  "group": "counter",
  "kind": "landed",
  "text": "New case: “Book a machine” (Wednesday 2 December 2026, Friday 4 December 2026).",
  "case": { "bucket": "hires", "id": "7f3a…", "url": "https://hire.example/counter#7f3a…" },
  "at": "2026-11-20T09:12:00Z"
}

id is <site>:<bucket>:<record>:<kind>:<n>, where n is how far into its event log the record is after the move (the time of the move for a record with no log, or just sent in). The same occurrence always has the same id, so the chat relays it once however often it hears it. case.url is the desk that shows the case, with the record’s id as the fragment; the row on the desk carries that id.

A group’s desks over a bucket decide what it hears. A desk holds a state when it lists records there and has a button from it: something for the group to do.

kindwhentosays (bokmål / English)
landeda record is sent in, or moved by anyone but the group itself (a member of another group, the sender, portal), into a state the group’s desk holdseach such group“Ny sak: …” / “New case: …”; “Ola flyttet en sak til «…», og nå venter den på dere: …” / “Ola moved a case to “…”, and it is waiting for you: …”; “En sak kom til «…» og venter på dere: …” / “A case came to “…” and is waiting for you: …”
moveda member of another group, or the sender, moved a case the group’s desk listed somewhere it has nothing to dothat group“Den som sendte den inn flyttet … til «Trukket».” / “The person who sent it moved … to “Trukket”.”
clock_soona state’s after: clock runs out within a dayeach group whose desk holds the state“Fristen for … går ut innen et døgn, og da flyttes saken til «…».” / “The deadline for … runs out within a day, and it then moves to “…”.”
clock_rana clock ran out and moved the caseeach group whose desk holds the state it left or came to“Fristen gikk ut for …, og saken er flyttet til «…».” / “The deadline ran out for …, and it has moved to “…”.”
openeda schedule (recurs:) opened recordsits handled_by“En fast runde har åpnet seg for dere: …” / “A regular round has opened for you: …”; several in one pass: “3 faste runder har åpnet seg for dere: …” with no case

The case is said as the choice it was sent by, quoted, and the first two short answers the form asked for (text, a choice, a date, a number; never an address, a phone number, a long text or a file), a date as the site says dates: “Book a machine” (Wednesday 2 December 2026, Friday 4 December 2026). A state is its text:. A state with a clock adds the day it runs out, in the site’s time zone; a schedule’s record its due. The sentences around them are portal’s, in the site’s lang (Languages).

Where it is said from: the submission, a desk’s move, the sender’s own link, the clock sweeper, portal’s own moves (a place given a seat, a notice sent) and the schedule sweeper, each where the move is made, after its mail. clock_soon is said by the clock sweeper (every hour) for each clock that came within its last day since the sweeper last looked; the first look after a start says every one within its last day, which the chat keeps once by its id.

Each message is a row of the site’s rooms outbox, written in the same batch as the move it tells of, and handed down the chat’s Serve; it goes once the chat acknowledges it. A chat that is away for a while finds what was said meanwhile when it dials back, each message once by its id. The desk has every case regardless.

Threads

The chat tells the site of a thread on its first message and every tenth after it, as a Note with subject: thread whose text is the thread:

{ "group": "counter", "bucket": "hires", "id": "7f3a…", "count": 3,
  "url": "https://chat.example/room/counter/case/hires/7f3a…" }

Portal keeps the newest per case in portal_threads, key <bucket>.<id> (one with a lower count than the one kept is not kept), only on a bucket of this site’s and only from the key that serves rooms, and the case’s row on the desk links to url: “Conversation in Counter (3)”. The group is said by its label.

A thread has an access question of its own (May with a thread resource: its room, bucket and id; see Access). For most records the answer is the room’s. For a record that is its sender’s own (state machines) it is the record’s: the owner, who may be in no group, and the group the record is shared with while it is. The thread is kept in that group’s room, and a list of the owner’s own records links to it as a desk’s does, so the owner and the group meet in one place and nobody else in the room’s group reads it once the share has ended.

Rooms of a record’s groups

Each group of each open record (state machines) has a room of the same name, committees_traffic_member: the name in the sign-in provider, in the token’s groups claim and in the rooms the chat watches is one, so a chat may match a person’s claim against a room without asking the site; asking the site works as for any room. The label is the group’s label with {label} for the record’s name ("{label}, leads"), else <name> (<group>). A desk for such a group speaks in that group’s room of the record a case is about, and its case links go to the [key] page at that record’s address. A closed record’s rooms leave the groups the chat watches at the next load.