@sigrix-io/gatehouse 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,14 +1,26 @@
1
1
  # Gatehouse
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@sigrix-io/gatehouse)](https://www.npmjs.com/package/@sigrix-io/gatehouse)
4
+ [![CI](https://github.com/sigrix-io/gatehouse/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sigrix-io/gatehouse/actions/workflows/ci.yml)
5
+ [![Licence](https://img.shields.io/github/license/sigrix-io/gatehouse)](https://github.com/sigrix-io/gatehouse/blob/main/LICENSE)
6
+
3
7
  A browser client for [Postern](https://github.com/sigrix-io/postern). Given a runner's `describe` and `status` documents, Gatehouse draws a run page (a form, a run button, the steps as they happen, the result and its usage) and connects it to Postern's four verbs over `fetch`. It holds nothing else.
4
8
 
5
- Four scripts and a stylesheet. No build step, no runtime dependency, no second origin.
9
+ Beside the run page, four blocks a host draws from its own data, for a page that shows several apps at once: a card per app, a list of them, a run history and a usage summary. They are handed documents rather than clients, so drawing a page of apps wakes none of their runners.
10
+
11
+ And one block for a playbook, a process a business runs by hand and sells as files: handed its `playbook.json`, it draws what is inside, the files in the order a person works through them and the placeholders a buyer fills in, and never a file's text.
12
+
13
+ Six scripts and a stylesheet. No build step, no runtime dependency, no second origin.
6
14
 
7
15
  > **0.x.** Nothing is stable before 1.0; pin the minor. See `VERSIONING.md`.
8
16
 
9
17
  ## Use it
10
18
 
11
- Serve the five files from `src/` (or install `@sigrix-io/gatehouse` and serve them from `node_modules`), and load the scripts in this order:
19
+ ```sh
20
+ npm install @sigrix-io/gatehouse
21
+ ```
22
+
23
+ Serve the seven files it installs in `node_modules/@sigrix-io/gatehouse/src/` (or copy them from this repository's `src/`; there is nothing to build). A run page loads four of the scripts, in this order:
12
24
 
13
25
  ```html
14
26
  <link rel="stylesheet" href="gatehouse.css">
@@ -38,6 +50,8 @@ Each script is an IIFE that adds to one global, `window.Gatehouse`. `window.Sigr
38
50
 
39
51
  `renderer.load()` reads `describe` and `status` and draws the page. Running, stopping and retrying are the page's own buttons.
40
52
 
53
+ A page of apps loads `host_blocks.js`, alone or after the four; see [Host blocks](#host-blocks). A page showing a playbook loads `playbook_contents.js`, alone or beside the others; see [A playbook's contents](#a-playbooks-contents).
54
+
41
55
  ## The rules that are easy to erode
42
56
 
43
57
  Each is held by a test rather than by memory (`tests/contract.test.js` and the suites beside it).
@@ -46,7 +60,8 @@ Each is held by a test rather than by memory (`tests/contract.test.js` and the s
46
60
  - **No markup from the agent.** `innerHTML` appears nowhere. Agent output and every streamed `delta.text` reach the page through `textContent`.
47
61
  - **No `EventSource`, and no retry loop around the stream.** It cannot POST and it reconnects on its own, and a reopened stream is a new run: the way a client spends someone's money twice. A disconnect is a cancel, so Stop is an `AbortController`.
48
62
  - **Zero imports, and no distributor.** Nothing here names a marketplace or a listing.
49
- - **Documents are handed in.** The composition and the choice arrive as data from whoever mounted the page. Fetching them here would be reaching for a fifth verb, and Postern has four.
63
+ - **Documents are handed in.** The composition and the choice arrive as data from whoever mounted the page, and so does everything the host blocks and the playbook block draw. Fetching them here would be reaching for a fifth verb, and Postern has four.
64
+ - **A link goes only to a web address.** An address a runner's author wrote becomes a link only when it is an absolute `http` or `https` one, so a `javascript:` address in `describe` is never something a click runs.
50
65
 
51
66
  ## The composition
52
67
 
@@ -78,9 +93,153 @@ The form shows only the chosen option's inputs; a chosen option's `required` add
78
93
 
79
94
  `options.hosted: true` says the page's operator runs the runner, not the person reading it. It changes only what a failure may quote back: an `agent_error` is the one refusal whose message carries what a model provider said about the *operator's* credentials, so on a hosted page it is withheld and the reader sees the next move alone.
80
95
 
96
+ ## Several apps on one page
97
+
98
+ A `RunRenderer` writes its ids under a scope of its own (`run-1-field-prompt` for the first renderer a page makes, `run-2-field-prompt` for the second), so two on one page never share one and each `<label>` stays bound to its own field. To find a field, look for its `name`, which is its input's key, inside the container you handed in: `container.querySelector('[name="prompt"]')`. The id is the renderer's own business.
99
+
100
+ ## Host blocks
101
+
102
+ A page listing several apps should not ask each runner how it is: a runner that is asleep would be woken to draw one card. These blocks are drawn from documents the host builds from what it already holds, and they fetch nothing.
103
+
104
+ ```html
105
+ <link rel="stylesheet" href="gatehouse.css">
106
+ <div id="apps"></div>
107
+ <div id="usage"></div>
108
+ <div id="runs"></div>
109
+
110
+ <script src="host_blocks.js"></script>
111
+ <script>
112
+ new Gatehouse.AppList(document.getElementById('apps'), data.apps).render();
113
+ new Gatehouse.UsageSummary(document.getElementById('usage'), data.usage).render();
114
+ new Gatehouse.RunHistory(document.getElementById('runs'), data.runs).render();
115
+ </script>
116
+ ```
117
+
118
+ | Constructor | Draws | Options |
119
+ | --- | --- | --- |
120
+ | `AppCard(container, summary, options)` | one app summary | `headingLevel` (2 to 6, default 3), `openLabel` (default `Open`), `locale`, `timeZone` |
121
+ | `AppList(container, summaries, options)` | a card per summary, in the order given | `emptyText`, and `AppCard`'s |
122
+ | `RunHistory(container, rows, options)` | a table of run rows, in the order given | `showApp` (default `true`), `emptyText`, `locale`, `timeZone` |
123
+ | `UsageSummary(container, usage, options)` | a period's figures, its caps, its runs per day and a table by app | `headingLevel`, `locale`, `timeZone` |
124
+
125
+ Each has `render()`, and `update(data)`, which replaces its document and draws again. `locale` and `timeZone` default to the reader's own. `Gatehouse.hostData` carries the readers the blocks use (`readAppSummary`, `readRunRow`, `readUsageSummary`, each answering `{ value }` or `{ refusal }`), so a host can test what it builds against them.
126
+
127
+ ### The documents
128
+
129
+ Each carries `"v": 1`. A block refuses a document in a version it does not read, or one missing what its shape requires, whole, in a sentence saying why; a list draws the rest and says how many it left out. A member a shape does not name is ignored.
130
+
131
+ **App summary.** `app_id`, `name` and `state` are required. `state` is `ready`, `needs_key`, `starting`, `unavailable` or `ended`; one this client does not know is shown as spelled, in no tone. `access_ends_at` and `last_run_at` may be null, and `run_url` may be a path on the host's own page.
132
+
133
+ ```json
134
+ {
135
+ "v": 1,
136
+ "app_id": "the host's id, opaque here",
137
+ "name": "Property copy",
138
+ "summary": "Writes a property's description from the agent's notes.",
139
+ "by": "fernhill",
140
+ "state": "needs_key",
141
+ "missing_keys": [{"env": "CRM_API_KEY", "purpose": "Reads your contacts", "signup_url": "https://crm.example.com/keys"}],
142
+ "access_ends_at": "2027-10-01T00:00:00Z",
143
+ "last_run_at": "2026-09-30T15:47:12Z",
144
+ "run_url": "/apps/a-property-copy/run"
145
+ }
146
+ ```
147
+
148
+ **Run row.** `app_id`, `app_name`, `started_at`, `input_tokens`, `output_tokens` and `outcome` are required. `outcome` is `done`, `timed_out`, `failed` or `cancelled`; `duration_seconds`, `model`, `cost_estimate` and `detail` may be null; `currency`, an ISO 4217 code, goes beside a cost. `detail` is the host's own sentence about how the run ended, drawn as given, so it is written for the person reading. A runner's error message is not one: on a hosted run it can carry what a provider said about the operator's key (see [Hosted runs](#hosted-runs)).
149
+
150
+ ```json
151
+ {
152
+ "v": 1,
153
+ "run_id": "r-77ae",
154
+ "app_id": "a-lead-digest",
155
+ "app_name": "Lead digest",
156
+ "started_at": "2026-09-30T11:02:40Z",
157
+ "duration_seconds": 240,
158
+ "model": "claude-sonnet-4-6",
159
+ "input_tokens": 52210,
160
+ "output_tokens": 0,
161
+ "cost_estimate": 0.15663,
162
+ "currency": "USD",
163
+ "outcome": "timed_out",
164
+ "detail": "Stopped at the 240-second limit."
165
+ }
166
+ ```
167
+
168
+ **Usage summary.** A `caps` member that is null or absent draws no meter. `runs_used` is what the host's own limit counts, over the last 24 hours, and the sentence above its meter says so. A bare date (`period.start`, `by_day[].date`) names a day and is written as that day in any time zone.
169
+
170
+ ```json
171
+ {
172
+ "v": 1,
173
+ "period": {"label": "September 2026", "start": "2026-09-01", "end": "2026-09-30"},
174
+ "runs": 128,
175
+ "runs_done": 124,
176
+ "input_tokens": 1391600,
177
+ "output_tokens": 396700,
178
+ "cost_estimate": 8.46,
179
+ "currency": "USD",
180
+ "caps": {"runs_per_day": 10, "runs_used": 3, "spend_per_period": 25.0},
181
+ "by_app": [{"app_id": "a-property-copy", "app_name": "Property copy", "runs": 71, "input_tokens": 852000, "output_tokens": 248500, "cost_estimate": 4.62}],
182
+ "by_day": [{"date": "2026-09-01", "runs": 5}]
183
+ }
184
+ ```
185
+
186
+ ### What every block keeps
187
+
188
+ - **Text only.** Every string reaches the page through `textContent`: an app's name and summary are its author's prose, and a model's name is whatever a runner reported.
189
+ - **A cost is an estimate, and says so.** It is the host's sum from token counts and a price list, not a bill, and the specification calls a runner's own `cost_usd` advisory too.
190
+ - **A link is a web address.** `signup_url` must be an absolute `http` or `https` address, and `run_url` may also be a path on the host's page; anything else draws no link.
191
+ - **Nothing is fetched.** A test spies on `fetch` while every block draws.
192
+
193
+ ## A playbook's contents
194
+
195
+ A playbook is a process a business runs by hand, sold as the files a person works through: the steps, the copy to send, the checklists, an offline tool or two. Its `playbook.json`, in the Muster format, says what each file is for and which placeholders a buyer fills in. This block draws that document, so a page can show what is inside a playbook to someone deciding whether to buy it, without handing over a file.
196
+
197
+ ```html
198
+ <link rel="stylesheet" href="gatehouse.css">
199
+ <div id="inside"></div>
200
+
201
+ <script src="playbook_contents.js"></script>
202
+ <script>
203
+ new Gatehouse.PlaybookContents(document.getElementById('inside'), playbookJson, {
204
+ fileNotes: { 'tools/reconcile.html': 'Its scripts run under a policy that blocks every network request.' },
205
+ }).render();
206
+ </script>
207
+ ```
208
+
209
+ | Constructor | Draws | Options |
210
+ | --- | --- | --- |
211
+ | `PlaybookContents(container, playbook, options)` | the files in `order`, each with its role, then the placeholders by when a buyer fills them in | `headingLevel` (2 to 6, default 3; the placeholders' kinds take the level below), `fileNotes` |
212
+
213
+ It has `render()` and `update(playbook)`, as the host blocks do. `Gatehouse.playbookData.readPlaybook` answers `{ value }` or `{ refusal }` as the block reads a document, so a host can test what it hands in.
214
+
215
+ ### The document
216
+
217
+ A playbook's own `playbook.json`, parsed, in format 0.x. The block reads `format_version`, `files` (each one's `path`, `role`, `same_as` and `self_contained`), `order` and the two lists of `slots`, `setup` and `message`, and ignores every other member, as a reader of the format may: a minor version only adds members an earlier reader can ignore, so any 0.x is drawn, and a major it does not know is refused whole, saying so.
218
+
219
+ - **The files, in `order`.** Each with its role in words (`guide`, `steps`, `checklist`, `copy`, `reference`, `tool`, `license`, `changelog`; a role it does not know is shown as spelled). A file that is another form of one (`same_as`) says which, and an `.html` file says it opens in a browser, and that it works offline only when the document calls it `self_contained`.
220
+ - **The placeholders, by when they are filled in.** `setup` once, for the buyer's business, and `message` each time the playbook is used, each token as the files write it beside its label. Two tokens one case apart, `[NAME]` and `[name]`, are two placeholders, and the block says so.
221
+ - **What it refuses.** A document in another major, or one whose `files`, `order` or `slots` are missing or not what the format says they are, or whose `order` and `same_as` name a file `files` does not list (paths match exactly, as in the format). It checks what drawing needs and no more: whether the files really say what the document claims is a checker's question, asked of the files, which the block never has.
222
+ - **`fileNotes`.** A sentence of the host's own about a file, keyed by its path and drawn beside it: something the host knows that the document does not say, such as what it found when it read the file. A note for a path the playbook does not hold is not drawn.
223
+
224
+ ### What it keeps
225
+
226
+ The host blocks' rules: every string reaches the page through `textContent`, no attribute is written from the document, and nothing is fetched. And one of its own: it never reads or draws a file's text, only what the document says the files are.
227
+
81
228
  ## Styling
82
229
 
83
- `gatehouse.css` styles every class the renderer draws, and `tests/stylesheet.test.js` fails when one has no rule. Colours are custom properties on `.run-shell`: each `--run-*` reads a host's `--sx-*` token when the page defines one and falls back to its own value, so the file works alone and a host can theme it. Dark values apply under `[data-theme="dark"]` on any ancestor.
230
+ `gatehouse.css` styles every class the scripts draw, the run page's `run-*` and the blocks' `gh-*`, and `tests/stylesheet.test.js` fails when one has no rule. Colours are custom properties on `.run-shell` and on `.gh-block`, the root of every block: each `--run-*` reads a host's `--sx-*` token when the page defines one and falls back to its own value, so the file works alone and a host can theme it. A status colour comes as a fill (`--run-ok`, `--run-warn`, `--run-danger`) for borders and bars, and as an ink (`--run-ok-text` and the rest, from a host's `--sx-*-text`) for words. Dark values apply under `[data-theme="dark"]` on any ancestor.
231
+
232
+ ## Where it fits
233
+
234
+ Gatehouse is one of the open-source projects [Sigrix](https://sigrix.io) publishes, and the page between a person and a runner. On Sigrix it draws the buyer's run page and the seller's preview; elsewhere it meets:
235
+
236
+ - **[Postern](https://github.com/sigrix-io/postern)**, the protocol whose four verbs it calls. Its [§2.3](https://github.com/sigrix-io/postern/blob/main/SPEC.md#23-browser-clients) says what a runner owes a browser client, and why the default is to refuse.
237
+ - **[sigrix-runtime](https://github.com/sigrix-io/sigrix-runtime)** (`pip install sigrix-runtime`), a runner to point it at: the one inside every bundle Sigrix delivers, which can also serve an MCP server's tools as one agent. Start it with `--allow-origin` set to the page's origin.
238
+ - **[postern-conformance](https://pypi.org/project/postern-conformance/)** (`pip install postern-conformance`), which reports the level a runner really meets before you draw a page for it.
239
+ - **[Bailey](https://github.com/sigrix-io/bailey)**, the open-source assistant: the app planned for its 0.1 draws a solution's apps with Gatehouse.
240
+ - **Muster**, the format a playbook's `playbook.json` is written in, which the playbook block reads. Its schema is at [sigrix.io/schemas/muster/0.1/playbook.schema.json](https://sigrix.io/schemas/muster/0.1/playbook.schema.json).
241
+
242
+ Every project Sigrix publishes, and a map of how they connect: [sigrix.io/open-source](https://sigrix.io/open-source).
84
243
 
85
244
  ## Tests
86
245
 
@@ -89,7 +248,7 @@ npm ci
89
248
  npm test
90
249
  ```
91
250
 
92
- The scripts are loaded the way a browser loads them, read and evaluated in order, rather than imported. The fixtures in `tests/fixtures/postern_describe/` are real documents: the Postern conformance fake's, a pipeline crew's, and an MCP server's as a runner builds it from a real `tools/list` answer.
251
+ The scripts are loaded the way a browser loads them, read and evaluated in order, rather than imported. The fixtures in `tests/fixtures/postern_describe/` are real documents: the Postern conformance fake's, a pipeline crew's, and an MCP server's as a runner builds it from a real `tools/list` answer. Those in `tests/fixtures/host_blocks/` are the three documents a host hands the blocks, one of each state and outcome among them, and `tests/fixtures/playbooks/` holds a `playbook.json` as an author writes one.
93
252
 
94
253
  ## Licence
95
254
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigrix-io/gatehouse",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "A browser client for Postern: draws a run page from a describe document and connects it to the four verbs. No build step and no dependencies.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Sigrix",
@@ -15,6 +15,7 @@
15
15
  "agent",
16
16
  "mcp",
17
17
  "sse",
18
+ "playbook",
18
19
  "browser",
19
20
  "no-build"
20
21
  ],
@@ -28,6 +29,8 @@
28
29
  "./run_view_model.js": "./src/run_view_model.js",
29
30
  "./refusal_copy.js": "./src/refusal_copy.js",
30
31
  "./run_renderer.js": "./src/run_renderer.js",
32
+ "./host_blocks.js": "./src/host_blocks.js",
33
+ "./playbook_contents.js": "./src/playbook_contents.js",
31
34
  "./gatehouse.css": "./src/gatehouse.css",
32
35
  "./package.json": "./package.json"
33
36
  },
@@ -38,7 +41,7 @@
38
41
  "test": "vitest run"
39
42
  },
40
43
  "devDependencies": {
41
- "jsdom": "30.1.0",
42
- "vitest": "5.0.1"
44
+ "jsdom": "30.1.3",
45
+ "vitest": "5.0.5"
43
46
  }
44
47
  }
package/src/gatehouse.css CHANGED
@@ -1,16 +1,18 @@
1
- /* Styles for Gatehouse, the Postern run renderer.
1
+ /* Styles for Gatehouse: the Postern run renderer and the host blocks.
2
2
  *
3
- * The scripts draw `run-*` classes and carry no CSS of their own, so a page
4
- * that mounts the renderer links this file. Every class the renderer emits has
5
- * a rule here, which `tests/stylesheet.test.js` checks.
3
+ * The scripts draw `run-*` classes (the run page) and `gh-*` classes (the
4
+ * blocks a host draws from its own data) and carry no CSS of their own, so a
5
+ * page that mounts either links this file. Every class they emit has a rule
6
+ * here, which `tests/stylesheet.test.js` checks.
6
7
  *
7
- * Colours are custom properties on `.run-shell`: each `--run-*` reads a host's
8
- * `--sx-*` token when the page defines one and falls back to the value beside
9
- * it, so the stylesheet works alone and a host can theme it. Light values are
10
- * unprefixed; dark ones sit under `[data-theme="dark"]` on any ancestor.
8
+ * Colours are custom properties on `.run-shell` and `.gh-block`, the root of
9
+ * every block: each `--run-*` reads a host's `--sx-*` token when the page
10
+ * defines one and falls back to the value beside it, so the stylesheet works
11
+ * alone and a host can theme it. Light values are unprefixed; dark ones sit
12
+ * under `[data-theme="dark"]` on any ancestor.
11
13
  */
12
14
 
13
- .run-shell {
15
+ .run-shell, .gh-block {
14
16
  --run-line: var(--sx-line, #E6E8EE);
15
17
  --run-surface: var(--sx-surface, #FFFFFF);
16
18
  --run-surface-2: var(--sx-surface-2, #F7F8FB);
@@ -19,19 +21,26 @@
19
21
  --run-text-3: var(--sx-text-3, #616879);
20
22
  --run-brand: var(--sx-brand, #2A33C4);
21
23
  --run-brand-text: var(--sx-brand-text, #1A1F6B);
22
- /* A literal, not var(--sx-ok): --sx-ok is a fill and #1F9D55 measured
23
- 3.49:1 as this tick's ink on white. #146B3A is 6.57:1. The dark value
24
- below is left on --sx-ok, which is a light green there and fine. */
25
- --run-ok: #146B3A;
24
+ /* Fills, for borders and bars. A status fill is too light to be read as
25
+ words on a light surface: --sx-ok's #1F9D55 measured 3.49:1 as a tick's
26
+ ink on white, and --sx-danger's #DC2C50 4.38:1 on --sx-surface-2. */
27
+ --run-ok: var(--sx-ok, #1F9D55);
26
28
  --run-warn: var(--sx-warn, #C77800);
27
29
  --run-danger: var(--sx-danger, #DC2C50);
30
+ /* Inks, for words: a host's -text token where it has one, and fallbacks
31
+ that read 6.57:1, 6.09:1 and 6.48:1 on white. */
32
+ --run-ok-text: var(--sx-ok-text, #146B3A);
33
+ --run-warn-text: var(--sx-warn-text, #8C5600);
34
+ --run-danger-text: var(--sx-danger-text, #B3243F);
28
35
  --run-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
36
+ color: var(--run-text);
37
+ }
38
+ .run-shell {
29
39
  display: grid;
30
40
  grid-template-columns: minmax(0, 1fr) 300px;
31
41
  grid-template-areas: "head rail" "form rail" "controls rail" "output rail";
32
42
  gap: 0 24px;
33
43
  align-items: start;
34
- color: var(--run-text);
35
44
  }
36
45
  @media (max-width: 960px) {
37
46
  .run-shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "rail" "form" "controls" "output"; }
@@ -40,7 +49,8 @@
40
49
  * this file does not have. A browser draws `select` border-box and `input` and
41
50
  * `textarea` content-box, so without it a full-width field spills past its card
42
51
  * by its own padding and border while the select beside it fits. */
43
- .run-shell, .run-shell *, .run-shell *::before, .run-shell *::after { box-sizing: border-box; }
52
+ .run-shell, .run-shell *, .run-shell *::before, .run-shell *::after,
53
+ .gh-block, .gh-block *, .gh-block *::before, .gh-block *::after { box-sizing: border-box; }
44
54
 
45
55
  /* ---------- header ---------- */
46
56
  .run-header { grid-area: head; margin-bottom: 18px; }
@@ -92,8 +102,8 @@
92
102
  * because the default happens to be green converges with a missing one the
93
103
  * moment the default moves, and the two are the whole point of the list. */
94
104
  .run-credential-tick { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--run-text-3); }
95
- .run-credential.is-satisfied .run-credential-tick { color: var(--run-ok); }
96
- .run-credential.is-missing .run-credential-tick { color: var(--run-danger); }
105
+ .run-credential.is-satisfied .run-credential-tick { color: var(--run-ok-text); }
106
+ .run-credential.is-missing .run-credential-tick { color: var(--run-danger-text); }
97
107
  .run-credential-purpose { font-size: 11.5px; color: var(--run-text-3); }
98
108
  .run-credential-where { font-size: 11.5px; color: var(--run-text-2); margin: 0 0 10px; }
99
109
  /* The words around it, underlined. Left to the browser, a link is its own
@@ -205,7 +215,178 @@
205
215
  .run-usage:empty { display: none; }
206
216
  .run-refuse { border-left: 3px solid var(--run-danger); padding: 14px 16px; background: var(--run-surface-2); border-radius: 0 10px 10px 0; margin: 0; font-size: 13.5px; }
207
217
 
208
- [data-theme="dark"] .run-shell {
218
+ /* ---------- host blocks ----------
219
+ *
220
+ * Drawn from a host's own data rather than from a runner, and themed through
221
+ * the same tokens. Each block's root carries `.gh-block`, which declares them,
222
+ * so a block works alone on a page that has no `.run-shell`. */
223
+
224
+ .gh-refuse { border-left: 3px solid var(--run-danger); padding: 12px 14px; background: var(--run-surface-2); border-radius: 0 10px 10px 0; margin: 0; font-size: 13px; color: var(--run-text); }
225
+ .gh-note, .gh-empty { font-size: 12.5px; color: var(--run-text-3); margin: 10px 0 0; max-width: 72ch; }
226
+ .gh-empty { margin: 0; }
227
+
228
+ /* A state or an outcome: the words carry it, in the status ink, and a dot of
229
+ * the status fill sits before them. Neither the colour nor the dot is the
230
+ * only way to tell one from another. */
231
+ .gh-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--run-text-3); white-space: nowrap; }
232
+ .gh-status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--run-text-3); }
233
+ .gh-status--ok { color: var(--run-ok-text); }
234
+ .gh-status--ok::before { background: var(--run-ok); }
235
+ .gh-status--caution { color: var(--run-warn-text); }
236
+ .gh-status--caution::before { background: var(--run-warn); }
237
+ .gh-status--blocked { color: var(--run-danger-text); }
238
+ .gh-status--blocked::before { background: var(--run-danger); }
239
+ .gh-status--quiet { color: var(--run-text-3); }
240
+
241
+ /* ---------- an app ---------- */
242
+ .gh-app {
243
+ display: flex; flex-direction: column; gap: 8px; min-width: 0;
244
+ background: var(--run-surface); border: 1px solid var(--run-line);
245
+ border-radius: 14px; padding: 16px;
246
+ }
247
+ .gh-app-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
248
+ /* An app's name is its author's, and may be one long word. */
249
+ .gh-app-name { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; margin: 0; min-width: 0; overflow-wrap: anywhere; }
250
+ .gh-app-summary { font-size: 13px; line-height: 1.5; color: var(--run-text-2); margin: 0; overflow-wrap: anywhere; }
251
+ .gh-app-by { font-size: 12px; color: var(--run-text-3); margin: 0; }
252
+ /* The run page's credential row, in the card: an inline flow, for the same
253
+ * reason as `.run-credential`. */
254
+ .gh-app-keys { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
255
+ .gh-app-key { font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
256
+ .gh-app-key-env { font-family: var(--run-mono); font-size: 11.5px; color: var(--run-text); }
257
+ .gh-app-key-tick { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--run-danger-text); }
258
+ .gh-app-key-purpose { font-size: 11.5px; color: var(--run-text-3); }
259
+ .gh-app-key-link { font-size: 11.5px; margin-left: 6px; color: inherit; }
260
+ .gh-app-meta { font-size: 12px; color: var(--run-text-3); margin: 0; }
261
+ .gh-app-open {
262
+ align-self: flex-start; margin-top: 4px;
263
+ display: inline-flex; align-items: center; height: 34px; padding: 0 14px;
264
+ font-size: 13px; font-weight: 600; text-decoration: none;
265
+ color: var(--run-text); background: var(--run-surface);
266
+ border: 1px solid var(--run-line); border-radius: 10px;
267
+ }
268
+ .gh-app-open:hover { border-color: var(--run-brand); }
269
+ .gh-app-open:focus-visible { outline: 2px solid var(--run-brand); outline-offset: 2px; }
270
+
271
+ .gh-app-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
272
+ .gh-app-item { display: flex; min-width: 0; }
273
+ .gh-app-item > .gh-app { flex: 1 1 auto; }
274
+ .gh-apps { min-width: 0; }
275
+
276
+ /* ---------- tables ---------- */
277
+ /* A table is as wide as its columns, so it scrolls inside its own box rather
278
+ * than pushing a phone's page sideways. `contain: inline-size` is what makes
279
+ * that hold inside a host's grid or flex row too: without it the box still
280
+ * reports the table's width as its own smallest, and a host column sized to
281
+ * its content grows to fit the table, page and all. */
282
+ .gh-table-scroll { overflow-x: auto; max-width: 100%; contain: inline-size; border: 1px solid var(--run-line); border-radius: 12px; background: var(--run-surface); }
283
+ .gh-table-scroll:focus-visible { outline: 2px solid var(--run-brand); outline-offset: 2px; }
284
+ .gh-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
285
+ /* Inside its scroll box a table keeps a readable width and scrolls, rather
286
+ * than squeezing an app's name and a run's sentence a word to a line. */
287
+ .gh-table-scroll > .gh-table { min-width: 34rem; }
288
+ .gh-table-scroll > .gh-table--wide { min-width: 46rem; }
289
+ .gh-table-head { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--run-text-2); padding: 9px 12px; border-bottom: 1px solid var(--run-line); white-space: nowrap; background: var(--run-surface-2); }
290
+ .gh-table-cell { padding: 9px 12px; color: var(--run-text); vertical-align: top; border-top: 1px solid var(--run-line); }
291
+ tbody tr:first-child > .gh-table-cell { border-top: 0; }
292
+ .gh-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
293
+ .gh-table-total > .gh-table-cell { font-weight: 600; border-top: 1px solid var(--run-line); }
294
+ .gh-runs { min-width: 0; }
295
+ /* One line a cell, so a phone scrolls the table rather than stacking an app's
296
+ * name a word to a line; only the host's sentence about a run wraps. */
297
+ .gh-run > .gh-table-cell { white-space: nowrap; }
298
+ .gh-run > .gh-table-cell:first-child { color: var(--run-text-2); }
299
+ .gh-run-detail { display: block; margin-top: 3px; font-size: 11.5px; color: var(--run-text-3); white-space: normal; min-width: 24ch; max-width: 40ch; }
300
+
301
+ /* ---------- usage ---------- */
302
+ .gh-usage { display: grid; gap: 16px; min-width: 0; }
303
+ .gh-usage-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
304
+ .gh-usage-title { font-size: 16px; font-weight: 650; margin: 0; }
305
+ .gh-usage-dates { font-size: 12px; color: var(--run-text-3); margin: 0; }
306
+ /* Four figures in a row, and two by two on a phone. A tile's figure keeps the
307
+ * font's own proportional digits: it stands alone, and even-width digits make
308
+ * a large number look loose. */
309
+ .gh-usage-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 10px; margin: 0; }
310
+ .gh-usage-stat { background: var(--run-surface); border: 1px solid var(--run-line); border-radius: 12px; padding: 12px 14px; margin: 0; min-width: 0; }
311
+ .gh-usage-label { font-size: 12px; color: var(--run-text-2); margin: 0; }
312
+ .gh-usage-value { font-size: 22px; font-weight: 640; letter-spacing: -0.02em; color: var(--run-text); margin: 4px 0 0; }
313
+ .gh-usage-note { font-size: 11.5px; color: var(--run-text-3); margin: 2px 0 0; }
314
+
315
+ .gh-caps { display: grid; gap: 12px; }
316
+ .gh-cap { display: grid; gap: 6px; }
317
+ .gh-cap-label { font-size: 12.5px; color: var(--run-text-2); margin: 0; }
318
+ /* The track is a lighter step of the fill's own colour, so the share reads
319
+ * across the whole bar; the fill turns to the warning and then the danger
320
+ * colour as the cap nears, and the sentence above says so in words. */
321
+ .gh-meter { --gh-meter-fill: var(--run-brand); height: 8px; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--gh-meter-fill) 18%, var(--run-surface)); }
322
+ .gh-meter--clear { --gh-meter-fill: var(--run-brand); }
323
+ .gh-meter--near { --gh-meter-fill: var(--run-warn); }
324
+ .gh-meter--full { --gh-meter-fill: var(--run-danger); }
325
+ .gh-meter-fill { display: block; height: 100%; border-radius: 999px; background: var(--gh-meter-fill); }
326
+
327
+ /* Runs per day: one series, so one colour and no legend; columns no wider than
328
+ * 24px with 2px of surface between them, rounded at the data end and square
329
+ * on the baseline. */
330
+ .gh-days { margin: 0; min-width: 0; }
331
+ .gh-days-title { font-size: 12.5px; font-weight: 600; color: var(--run-text-2); margin: 0 0 8px; }
332
+ .gh-days-plot { position: relative; padding-top: 20px; }
333
+ .gh-days-max { position: absolute; top: 0; left: 0; font-size: 11px; color: var(--run-text-3); }
334
+ /* Spread across the plot, so the first and last days sit over the axis's
335
+ * first and last labels whatever the number of days. */
336
+ .gh-days-bars { list-style: none; margin: 0; padding: 0; height: 96px; display: flex; align-items: flex-end; justify-content: space-between; gap: 2px; border-bottom: 1px solid var(--run-line); }
337
+ .gh-day { position: relative; flex: 0 1 24px; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
338
+ .gh-day-bar { display: block; width: 100%; background: var(--run-brand); border-radius: 4px 4px 0 0; }
339
+ .gh-day:hover .gh-day-bar { opacity: 0.72; }
340
+ .gh-day-tip {
341
+ display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 1;
342
+ white-space: nowrap; font-size: 11.5px; color: var(--run-text);
343
+ background: var(--run-surface); border: 1px solid var(--run-line); border-radius: 8px; padding: 4px 8px;
344
+ }
345
+ .gh-day:hover .gh-day-tip { display: block; }
346
+ .gh-days-axis { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
347
+ .gh-days-axis-label { font-size: 11px; color: var(--run-text-3); }
348
+ .gh-days-table { margin-top: 8px; font-size: 12px; }
349
+ .gh-days-table > .gh-table { margin-top: 8px; border: 1px solid var(--run-line); }
350
+ .gh-days-table-toggle { cursor: pointer; color: var(--run-text-2); }
351
+
352
+ /* ---------- a playbook ----------
353
+ *
354
+ * Its files in order, then its placeholders. A path, a token and a label are
355
+ * someone's typing and may be one long word, so each wraps anywhere rather
356
+ * than pushing the block past a phone's edge. */
357
+ .gh-playbook { display: grid; gap: 22px; min-width: 0; }
358
+ .gh-playbook-part { display: grid; gap: 8px; min-width: 0; }
359
+ .gh-playbook-heading { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
360
+ .gh-playbook-subheading { font-size: 12.5px; font-weight: 600; color: var(--run-text-2); margin: 8px 0 0; }
361
+ .gh-playbook-lead { font-size: 12.5px; line-height: 1.5; color: var(--run-text-2); margin: 0; max-width: 72ch; }
362
+ /* The browser's own numbers, so each file keeps its place in the order
363
+ * however its row wraps. A list item laid out as a flex row is drawn with no
364
+ * number, so the row's parts sit in a box of their own. */
365
+ .gh-playbook-files { margin: 0; padding: 0 0 0 1.8em; }
366
+ .gh-playbook-file { padding: 9px 0; border-top: 1px solid var(--run-line); min-width: 0; }
367
+ .gh-playbook-file:first-child { border-top: 0; }
368
+ .gh-playbook-file::marker { font-size: 12px; color: var(--run-text-3); font-variant-numeric: tabular-nums; }
369
+ .gh-playbook-file-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
370
+ .gh-playbook-path { font-family: var(--run-mono); font-size: 12.5px; color: var(--run-text); min-width: 0; overflow-wrap: anywhere; }
371
+ .gh-playbook-role {
372
+ font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: var(--run-text-2); white-space: nowrap;
373
+ background: var(--run-surface-2); border: 1px solid var(--run-line); border-radius: 999px; padding: 1px 8px;
374
+ }
375
+ /* A sentence of its own under the path, on a line the flex row gives it. */
376
+ .gh-playbook-about, .gh-playbook-note { flex: 1 1 100%; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
377
+ .gh-playbook-about { color: var(--run-text-3); }
378
+ .gh-playbook-note { color: var(--run-text-2); }
379
+ .gh-playbook-slot-group { display: grid; gap: 6px; min-width: 0; }
380
+ .gh-playbook-slots { margin: 0; display: grid; gap: 6px; }
381
+ .gh-playbook-slot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
382
+ .gh-playbook-slot-name { margin: 0; min-width: 0; }
383
+ .gh-playbook-token {
384
+ font-family: var(--run-mono); font-size: 12px; color: var(--run-text); overflow-wrap: anywhere;
385
+ background: var(--run-surface-2); border: 1px solid var(--run-line); border-radius: 6px; padding: 1px 6px;
386
+ }
387
+ .gh-playbook-slot-label { margin: 0; flex: 1 1 16ch; min-width: 0; font-size: 12.5px; line-height: 1.5; color: var(--run-text-2); overflow-wrap: anywhere; }
388
+
389
+ [data-theme="dark"] .run-shell, [data-theme="dark"] .gh-block {
209
390
  --run-line: var(--sx-line, #232936);
210
391
  --run-surface: var(--sx-surface, #14181F);
211
392
  --run-surface-2: var(--sx-surface-2, #1A1F28);
@@ -217,4 +398,7 @@
217
398
  --run-ok: var(--sx-ok, #6EE7A1);
218
399
  --run-warn: var(--sx-warn, #F5B454);
219
400
  --run-danger: var(--sx-danger, #F47B7B);
401
+ --run-ok-text: var(--sx-ok-text, #6EE7A1);
402
+ --run-warn-text: var(--sx-warn-text, #F5B454);
403
+ --run-danger-text: var(--sx-danger-text, #F47B7B);
220
404
  }