@sigrix-io/gatehouse 0.1.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/LICENSE +201 -0
- package/NOTICE +8 -0
- package/README.md +96 -0
- package/package.json +44 -0
- package/src/gatehouse.css +213 -0
- package/src/postern_client.js +248 -0
- package/src/refusal_copy.js +143 -0
- package/src/run_renderer.js +731 -0
- package/src/run_view_model.js +623 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Sigrix
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Gatehouse
|
|
2
|
+
Copyright 2026 Sigrix
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
Trademarks. "Sigrix" and the Sigrix logo are trademarks of Sigrix. The Apache
|
|
7
|
+
License does not grant permission to use them. A fork or a derived work must
|
|
8
|
+
not present itself as Sigrix or as published by Sigrix.
|
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Gatehouse
|
|
2
|
+
|
|
3
|
+
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
|
+
|
|
5
|
+
Four scripts and a stylesheet. No build step, no runtime dependency, no second origin.
|
|
6
|
+
|
|
7
|
+
> **0.x.** Nothing is stable before 1.0; pin the minor. See `VERSIONING.md`.
|
|
8
|
+
|
|
9
|
+
## Use it
|
|
10
|
+
|
|
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:
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<link rel="stylesheet" href="gatehouse.css">
|
|
15
|
+
<div id="run"></div>
|
|
16
|
+
|
|
17
|
+
<script src="postern_client.js"></script>
|
|
18
|
+
<script src="run_view_model.js"></script>
|
|
19
|
+
<script src="refusal_copy.js"></script>
|
|
20
|
+
<script src="run_renderer.js"></script>
|
|
21
|
+
<script>
|
|
22
|
+
const client = new Gatehouse.PosternClient('http://127.0.0.1:8765');
|
|
23
|
+
const renderer = new Gatehouse.RunRenderer(document.getElementById('run'), client, {
|
|
24
|
+
composition: uiJson, // optional: the seller's ui.json, read from the bundle by the host
|
|
25
|
+
});
|
|
26
|
+
renderer.load();
|
|
27
|
+
</script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Each script is an IIFE that adds to one global, `window.Gatehouse`. `window.SigrixRun` names the same object and goes at 1.0.
|
|
31
|
+
|
|
32
|
+
**Where the page is served from matters.** A Postern runner answers a browser only from the origins its operator configured, and never allows every origin by default (SPEC §2.3), because any web page can reach a loopback port. Either start the runner with the page's origin allowed, or put a proxy on the page's own origin in front of it; `PosternClient`'s `headers` option carries what that proxy needs, a CSRF token say.
|
|
33
|
+
|
|
34
|
+
| Constructor | Arguments |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `PosternClient(baseUrl, options)` | `baseUrl`: where the runner (or the proxy) answers; every request goes to it under `/postern/v0`. `options.headers`: extra headers for every request. `options.fetchImpl`: a `fetch` to use instead of the page's. |
|
|
37
|
+
| `RunRenderer(container, client, options)` | `container`: the element to draw into. `client`: anything with the four verbs. `options.composition`, `options.choice`, `options.hosted`: below. |
|
|
38
|
+
|
|
39
|
+
`renderer.load()` reads `describe` and `status` and draws the page. Running, stopping and retrying are the page's own buttons.
|
|
40
|
+
|
|
41
|
+
## The rules that are easy to erode
|
|
42
|
+
|
|
43
|
+
Each is held by a test rather than by memory (`tests/contract.test.js` and the suites beside it).
|
|
44
|
+
|
|
45
|
+
- **The base URL is a constructor argument.** Every request goes to it and to the protocol's own path prefix. A font, an icon CDN or a "check for updates" call would each be a second origin, so a test intercepts `fetch` and asserts the origin of everything.
|
|
46
|
+
- **No markup from the agent.** `innerHTML` appears nowhere. Agent output and every streamed `delta.text` reach the page through `textContent`.
|
|
47
|
+
- **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
|
+
- **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.
|
|
50
|
+
|
|
51
|
+
## The composition
|
|
52
|
+
|
|
53
|
+
`options.composition` is a seller's `ui.json`: how a runner's inputs and result are *presented*. A seller writes it, so the client re-checks everything in it rather than trusting the file it was handed.
|
|
54
|
+
|
|
55
|
+
| Member | Does | Refuses to |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| `inputs[].widget`: `line`, `box`, `number`, `choice` | pick among the controls a field's declared type can wear | change what a field means; a hint outside its type's row is named on the page and not applied |
|
|
58
|
+
| `inputs[].help`, `inputs[].placeholder` | seller prose beside the control | be anything but text |
|
|
59
|
+
| `run_label` | name the action | |
|
|
60
|
+
| `output.mode`: `text`, `markdown`, `file` | choose how a text result is shown | touch `bytes` or an unrecognised type |
|
|
61
|
+
| `template`: `form-to-result` | | anything else; a template this client cannot draw falls back to the standard one, with a notice naming what was asked for |
|
|
62
|
+
| `version` | be carried as data a caller may show | be compared: a version family names a distributor, and gating on one would refuse another vendor's document |
|
|
63
|
+
|
|
64
|
+
Two properties are structural. **It cannot hide a field**: the form is walked from `describe.inputs`, and the composition is a lookup by key. **Markdown is block structure only**: headings, paragraphs, lists and fenced code, built with `createElement` and `textContent`. Inline markers are left as the agent typed them, because inline markdown's useful half is the link, and an anchor whose `href` comes from agent output is exactly the escape hatch `innerHTML` is banned to prevent.
|
|
65
|
+
|
|
66
|
+
## The choice
|
|
67
|
+
|
|
68
|
+
`options.choice` says that one `select` input chooses which of the others apply, as an MCP server's `tool` does when each tool takes arguments of its own. `describe` has no member that says so, so the host hands the fact in as data:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{"key": "tool", "groups": {"watch_models": {"inputs": ["watch_models.provider"],
|
|
72
|
+
"required": ["watch_models.provider"], "about": "Lists the models a provider released."}}}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The form shows only the chosen option's inputs; a chosen option's `required` adds to `describe`'s own and never removes one, and its `about` goes under the picker. A run sends every input no option governs, plus the chosen option's. A group that is not one of the select's options is ignored, so no choice can put an input out of reach.
|
|
76
|
+
|
|
77
|
+
## Hosted runs
|
|
78
|
+
|
|
79
|
+
`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
|
+
|
|
81
|
+
## Styling
|
|
82
|
+
|
|
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.
|
|
84
|
+
|
|
85
|
+
## Tests
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
npm ci
|
|
89
|
+
npm test
|
|
90
|
+
```
|
|
91
|
+
|
|
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.
|
|
93
|
+
|
|
94
|
+
## Licence
|
|
95
|
+
|
|
96
|
+
Apache-2.0. The Sigrix name and logo are not covered by the licence; see `NOTICE`.
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sigrix-io/gatehouse",
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "Sigrix",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/sigrix-io/gatehouse.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/sigrix-io/gatehouse",
|
|
12
|
+
"bugs": "https://github.com/sigrix-io/gatehouse/issues",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"postern",
|
|
15
|
+
"agent",
|
|
16
|
+
"mcp",
|
|
17
|
+
"sse",
|
|
18
|
+
"browser",
|
|
19
|
+
"no-build"
|
|
20
|
+
],
|
|
21
|
+
"type": "commonjs",
|
|
22
|
+
"files": [
|
|
23
|
+
"src/",
|
|
24
|
+
"NOTICE"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
"./postern_client.js": "./src/postern_client.js",
|
|
28
|
+
"./run_view_model.js": "./src/run_view_model.js",
|
|
29
|
+
"./refusal_copy.js": "./src/refusal_copy.js",
|
|
30
|
+
"./run_renderer.js": "./src/run_renderer.js",
|
|
31
|
+
"./gatehouse.css": "./src/gatehouse.css",
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"test": "vitest run"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"jsdom": "30.1.0",
|
|
42
|
+
"vitest": "5.0.1"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/* Styles for Gatehouse, the Postern run renderer.
|
|
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.
|
|
6
|
+
*
|
|
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.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
.run-shell {
|
|
14
|
+
--run-line: var(--sx-line, #E6E8EE);
|
|
15
|
+
--run-surface: var(--sx-surface, #FFFFFF);
|
|
16
|
+
--run-surface-2: var(--sx-surface-2, #F7F8FB);
|
|
17
|
+
--run-text: var(--sx-text, #0E1320);
|
|
18
|
+
--run-text-2: var(--sx-text-2, #4B5263);
|
|
19
|
+
--run-text-3: var(--sx-text-3, #616879);
|
|
20
|
+
--run-brand: var(--sx-brand, #2A33C4);
|
|
21
|
+
--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;
|
|
26
|
+
--run-warn: var(--sx-warn, #C77800);
|
|
27
|
+
--run-danger: var(--sx-danger, #DC2C50);
|
|
28
|
+
--run-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
29
|
+
display: grid;
|
|
30
|
+
grid-template-columns: minmax(0, 1fr) 300px;
|
|
31
|
+
grid-template-areas: "head rail" "form rail" "controls rail" "output rail";
|
|
32
|
+
gap: 0 24px;
|
|
33
|
+
align-items: start;
|
|
34
|
+
color: var(--run-text);
|
|
35
|
+
}
|
|
36
|
+
@media (max-width: 960px) {
|
|
37
|
+
.run-shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "rail" "form" "controls" "output"; }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ---------- header ---------- */
|
|
41
|
+
.run-header { grid-area: head; margin-bottom: 18px; }
|
|
42
|
+
/* `.run-title` is the class the renderer actually emits; the element selectors
|
|
43
|
+
* beside it are what styled it before, and they stay because they also catch a
|
|
44
|
+
* heading a future screen puts in this band. Naming the class is what lets the
|
|
45
|
+
* stylesheet contract test see that this heading is covered — it was styled by
|
|
46
|
+
* element only, so the guard reported it unstyled the moment its scan learned
|
|
47
|
+
* to read `el('h1', …)`. */
|
|
48
|
+
.run-header h1, .run-header h2, .run-title { font-size: 22px; font-weight: 660; margin: 0 0 6px; letter-spacing: -0.02em; }
|
|
49
|
+
.run-summary { color: var(--run-text-2); margin: 0; max-width: 64ch; }
|
|
50
|
+
.run-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
|
|
51
|
+
/* Shown verbatim: the identifier is what an operator types into `.env` and
|
|
52
|
+
* what the runner prints at boot. One spelling, as given. */
|
|
53
|
+
.run-agent-id, .run-version {
|
|
54
|
+
font-family: var(--run-mono); font-size: 11.5px; color: var(--run-text-2);
|
|
55
|
+
background: var(--run-surface-2); border: 1px solid var(--run-line);
|
|
56
|
+
padding: 4px 9px; border-radius: 7px;
|
|
57
|
+
}
|
|
58
|
+
/* An empty chip is a real state rather than a preview artifact: a bundle's
|
|
59
|
+
* `postern.json` deliberately carries no `agent.id` — the runner fills it from
|
|
60
|
+
* the environment, so a stale document can never drive a check for the wrong
|
|
61
|
+
* listing — and a client reading that document straight off disk has nothing
|
|
62
|
+
* to print. Same `:empty` idiom the timeline, result and usage rows use. */
|
|
63
|
+
.run-agent-id:empty, .run-version:empty { display: none; }
|
|
64
|
+
|
|
65
|
+
/* ---------- readiness rail ---------- */
|
|
66
|
+
.run-readiness {
|
|
67
|
+
grid-area: rail;
|
|
68
|
+
background: var(--run-surface); border: 1px solid var(--run-line);
|
|
69
|
+
border-radius: 14px; padding: 16px;
|
|
70
|
+
}
|
|
71
|
+
.run-state { font-size: 12px; color: var(--run-text-2); margin: 0 0 4px; font-weight: 600; }
|
|
72
|
+
.run-level, .run-limit, .run-update { font-size: 11.5px; color: var(--run-text-3); margin: 0 0 8px; }
|
|
73
|
+
.run-entitlement { padding: 11px 13px; border-radius: 10px; font-size: 12.5px; line-height: 1.5; margin: 12px 0; border: 1px solid var(--run-line); background: var(--run-surface-2); color: var(--run-text-2); }
|
|
74
|
+
.run-entitlement--quiet { color: var(--run-text-3); }
|
|
75
|
+
.run-entitlement--caution { border-color: var(--run-warn); }
|
|
76
|
+
.run-entitlement--blocked { border-color: var(--run-danger); color: var(--run-text); }
|
|
77
|
+
|
|
78
|
+
/* One credential is a flat run of inline siblings - `<code>` for the name,
|
|
79
|
+
* then a span carrying the *words* "set" / "not set", then the purpose, then
|
|
80
|
+
* an optional link. Laying the item out as a grid puts each sibling in its own
|
|
81
|
+
* cell and wraps the purpose one word per line; it has to stay an inline flow.
|
|
82
|
+
* `run-credential-where` is a sibling of the list, not of these. */
|
|
83
|
+
.run-credentials { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
|
|
84
|
+
.run-credential { font-size: 12.5px; line-height: 1.5; }
|
|
85
|
+
.run-credential-env { font-family: var(--run-mono); font-size: 11.5px; color: var(--run-text); }
|
|
86
|
+
/* Both states stated, neither inherited. A satisfied key that is only green
|
|
87
|
+
* because the default happens to be green converges with a missing one the
|
|
88
|
+
* moment the default moves, and the two are the whole point of the list. */
|
|
89
|
+
.run-credential-tick { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--run-text-3); }
|
|
90
|
+
.run-credential.is-satisfied .run-credential-tick { color: var(--run-ok); }
|
|
91
|
+
.run-credential.is-missing .run-credential-tick { color: var(--run-danger); }
|
|
92
|
+
.run-credential-purpose { font-size: 11.5px; color: var(--run-text-3); }
|
|
93
|
+
.run-credential-where { font-size: 11.5px; color: var(--run-text-2); margin: 0 0 10px; }
|
|
94
|
+
.run-credential-link { font-size: 11.5px; margin-left: 6px; }
|
|
95
|
+
|
|
96
|
+
.run-tools { margin: 0 0 8px; }
|
|
97
|
+
.run-tool-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
|
|
98
|
+
.run-tool { font-family: var(--run-mono); font-size: 11px; color: var(--run-text-3); }
|
|
99
|
+
.run-tool::after { content: ","; }
|
|
100
|
+
.run-tool:last-child::after { content: ""; }
|
|
101
|
+
|
|
102
|
+
/* ---------- templates ---------- */
|
|
103
|
+
.run-templates { grid-area: head; align-self: end; }
|
|
104
|
+
/* Genuinely unstyled until now, and it is an `<h2>`, so it rendered at the
|
|
105
|
+
* browser's default 1.5em directly above a row of 12.5px chips. Found by the
|
|
106
|
+
* same widened scan as `.run-title` — the guard could not see either, because
|
|
107
|
+
* its regex required a tag name of letters only and both are `h`-plus-digit. */
|
|
108
|
+
.run-templates-title { font-size: 12px; font-weight: 600; color: var(--run-text-3); margin: 0 0 8px; text-transform: none; }
|
|
109
|
+
.run-template-row { display: flex; flex-wrap: wrap; gap: 8px; }
|
|
110
|
+
.run-template-chip {
|
|
111
|
+
font: inherit; font-size: 12.5px; cursor: pointer; min-height: 0;
|
|
112
|
+
background: var(--run-surface); border: 1px solid var(--run-line);
|
|
113
|
+
color: var(--run-text-2); border-radius: 999px; padding: 6px 13px;
|
|
114
|
+
}
|
|
115
|
+
.run-template-chip:hover { color: var(--run-text); border-color: var(--run-brand); }
|
|
116
|
+
.run-template-output { margin-top: 10px; font-size: 12px; color: var(--run-text-3); }
|
|
117
|
+
.run-template-output-body { white-space: pre-wrap; font-size: 12.5px; color: var(--run-text-2); margin-top: 4px; }
|
|
118
|
+
|
|
119
|
+
/* ---------- form ---------- */
|
|
120
|
+
.run-form { grid-area: form; background: var(--run-surface); border: 1px solid var(--run-line); border-radius: 14px; overflow: hidden; }
|
|
121
|
+
.run-field { padding: 14px 16px; }
|
|
122
|
+
.run-field + .run-field { border-top: 1px solid var(--run-line); }
|
|
123
|
+
.run-field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
|
|
124
|
+
.run-field-control {
|
|
125
|
+
width: 100%; font: inherit; font-size: 14px; color: var(--run-text);
|
|
126
|
+
background: var(--run-surface-2); border: 1px solid var(--run-line);
|
|
127
|
+
border-radius: 10px; padding: 9px 11px; min-height: 0;
|
|
128
|
+
}
|
|
129
|
+
.run-field-control--large { min-height: 88px; resize: vertical; line-height: 1.5; }
|
|
130
|
+
.run-field-control:focus { outline: 2px solid var(--run-brand); outline-offset: -1px; }
|
|
131
|
+
.run-field-control.is-invalid { border-color: var(--run-danger); }
|
|
132
|
+
.run-field-note { font-size: 11.5px; color: var(--run-text-3); margin: 6px 0 0; }
|
|
133
|
+
/* The seller's own help text, not the client's. Sits a step darker
|
|
134
|
+
* than `.run-field-note` because a note is this page apologising for something
|
|
135
|
+
* it could not honour, and this is the listing telling the buyer what to
|
|
136
|
+
* write — they should not read as the same voice. */
|
|
137
|
+
.run-field-help { font-size: 12.5px; color: var(--run-text-2); margin: 6px 0 0; max-width: 64ch; }
|
|
138
|
+
|
|
139
|
+
/* ---------- controls ---------- */
|
|
140
|
+
.run-controls { grid-area: controls; margin-top: 18px; }
|
|
141
|
+
.run-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
|
|
142
|
+
.run-go, .run-stop, .run-retry, .run-download {
|
|
143
|
+
font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
|
|
144
|
+
border-radius: 10px; padding: 0 16px; height: 38px; min-height: 0;
|
|
145
|
+
display: inline-flex; align-items: center; gap: 8px;
|
|
146
|
+
border: 1px solid transparent; text-decoration: none;
|
|
147
|
+
}
|
|
148
|
+
.run-go { background: var(--run-brand); color: #FFFFFF; }
|
|
149
|
+
.run-stop, .run-retry, .run-download { background: var(--run-surface); color: var(--run-text); border-color: var(--run-line); }
|
|
150
|
+
.run-go:disabled, .run-stop:disabled, .run-retry:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
151
|
+
.run-go[hidden], .run-stop[hidden], .run-retry[hidden], .run-download[hidden] { display: none; }
|
|
152
|
+
|
|
153
|
+
.run-write-gate { display: flex; gap: 9px; align-items: flex-start; margin-top: 12px; max-width: 64ch; }
|
|
154
|
+
.run-write-label { font-size: 12.5px; color: var(--run-text-2); cursor: pointer; }
|
|
155
|
+
/* A host's stylesheet may floor every input at `min-height: 44px`, site-wide and
|
|
156
|
+
* outside any media query, and `min-height` beats `height` — so without this
|
|
157
|
+
* the box renders 44px tall and sits half a line below its own sentence. */
|
|
158
|
+
.run-write-check { margin: 2px 0 0; flex: none; width: 15px; height: 15px; min-height: 0; }
|
|
159
|
+
/* Given back where the floor exists for a reason. Declared *after* the opt-out:
|
|
160
|
+
* a media query contributes no specificity, so these two tie on identical
|
|
161
|
+
* selectors and document order alone decides. Fold this block upward and the
|
|
162
|
+
* opt-out silently wins under a thumb too. */
|
|
163
|
+
@media (pointer: coarse) {
|
|
164
|
+
.run-write-check { width: 22px; height: 22px; min-height: 22px; }
|
|
165
|
+
}
|
|
166
|
+
.run-retry-note, .run-notice { font-size: 12px; color: var(--run-text-3); margin: 10px 0 0; max-width: 64ch; }
|
|
167
|
+
|
|
168
|
+
/* ---------- output ---------- */
|
|
169
|
+
.run-output { grid-area: output; margin-top: 22px; border: 1px solid var(--run-line); border-radius: 14px; background: var(--run-surface); padding: 16px; }
|
|
170
|
+
.run-timeline { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 1px; background: var(--run-line); border: 1px solid var(--run-line); border-radius: 10px; overflow: hidden; }
|
|
171
|
+
.run-timeline:empty { display: none; }
|
|
172
|
+
.run-timeline-entry { background: var(--run-surface); padding: 9px 12px; font-family: var(--run-mono); font-size: 12px; color: var(--run-text-2); }
|
|
173
|
+
.run-result { white-space: pre-wrap; font-size: 14px; line-height: 1.62; max-height: 380px; overflow: auto; }
|
|
174
|
+
.run-result:empty { display: none; }
|
|
175
|
+
|
|
176
|
+
/* The composed result, in the `markdown` output mode. A second node
|
|
177
|
+
* beside `.run-result` rather than a mode switch on it: the `<pre>` is what a
|
|
178
|
+
* stream fills token by token, and `<pre>` takes phrasing content only, so
|
|
179
|
+
* headings and lists cannot be built inside it. Both are capped at the same
|
|
180
|
+
* height, or one mode scrolls its panel and the other grows it. */
|
|
181
|
+
.run-result-rendered { font-size: 14px; line-height: 1.62; max-height: 380px; overflow: auto; }
|
|
182
|
+
.run-result-rendered:empty { display: none; }
|
|
183
|
+
.run-md-heading { font-size: 15px; font-weight: 650; color: var(--run-text); margin: 16px 0 6px; }
|
|
184
|
+
.run-md-heading:first-child { margin-top: 0; }
|
|
185
|
+
.run-md-paragraph { margin: 0 0 10px; max-width: 72ch; }
|
|
186
|
+
.run-md-list { margin: 0 0 10px; padding-left: 20px; max-width: 72ch; }
|
|
187
|
+
.run-md-item { margin: 0 0 3px; }
|
|
188
|
+
/* Never highlighted, and never `white-space: pre-wrap`. This is a fenced block
|
|
189
|
+
* an agent emitted, so it is shown exactly as it arrived — wrapping it would
|
|
190
|
+
* change what a buyer copies. */
|
|
191
|
+
.run-md-code {
|
|
192
|
+
white-space: pre; overflow-x: auto; margin: 0 0 12px;
|
|
193
|
+
font-family: var(--run-mono); font-size: 12.5px; line-height: 1.55;
|
|
194
|
+
background: var(--run-surface-2); border: 1px solid var(--run-line);
|
|
195
|
+
border-radius: 10px; padding: 10px 12px;
|
|
196
|
+
}
|
|
197
|
+
.run-usage { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--run-text-3); margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--run-line); }
|
|
198
|
+
.run-usage:empty { display: none; }
|
|
199
|
+
.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; }
|
|
200
|
+
|
|
201
|
+
[data-theme="dark"] .run-shell {
|
|
202
|
+
--run-line: var(--sx-line, #232936);
|
|
203
|
+
--run-surface: var(--sx-surface, #14181F);
|
|
204
|
+
--run-surface-2: var(--sx-surface-2, #1A1F28);
|
|
205
|
+
--run-text: var(--sx-text, #E7EAF0);
|
|
206
|
+
--run-text-2: var(--sx-text-2, #AAB2C0);
|
|
207
|
+
--run-text-3: var(--sx-text-3, #858DA0);
|
|
208
|
+
--run-brand: var(--sx-brand, #3D4DFF);
|
|
209
|
+
--run-brand-text: var(--sx-brand-text, #A9B4FF);
|
|
210
|
+
--run-ok: var(--sx-ok, #6EE7A1);
|
|
211
|
+
--run-warn: var(--sx-warn, #F5B454);
|
|
212
|
+
--run-danger: var(--sx-danger, #F47B7B);
|
|
213
|
+
}
|