@oakgreencc/canopy 0.0.7 → 0.0.8
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/package.json +1 -1
- package/src/page.mjs +34 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oakgreencc/canopy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "A local read-only page over cambium's heartbeat and the GitHub queues: mode, ticks, workers, events, and the q:* columns with agent PRs.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
package/src/page.mjs
CHANGED
|
@@ -2,31 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
const CSS = `
|
|
4
4
|
:root{color-scheme:light dark;--bg:#f7f7f5;--panel:#fff;--line:#e4e4e0;--text:#1d1d1b;--muted:#6b6b66;--faint:#9a9a94;
|
|
5
|
-
--ok:#2f7d4f;--warn:#a5670a;--err:#b42f2f;--accent:#2f5f9e;--chip:#efefeb;--bar:#dcdcd6
|
|
5
|
+
--ok:#2f7d4f;--warn:#a5670a;--err:#b42f2f;--accent:#2f5f9e;--chip:#efefeb;--bar:#dcdcd6;
|
|
6
|
+
--s1:4px;--s2:8px;--s3:12px;--s4:16px;--s5:24px}
|
|
6
7
|
@media (prefers-color-scheme:dark){:root{--bg:#141413;--panel:#1c1c1a;--line:#2e2e2b;--text:#e6e6e1;--muted:#a0a09a;--faint:#6f6f69;
|
|
7
8
|
--ok:#6cc08b;--warn:#e0a44a;--err:#ec7b7b;--accent:#86aee6;--chip:#262624;--bar:#353532}}
|
|
8
9
|
*{box-sizing:border-box}
|
|
9
10
|
body{margin:0;background:var(--bg);color:var(--text);font:13px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif;font-variant-numeric:tabular-nums}
|
|
10
11
|
a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}
|
|
12
|
+
a:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:2px}
|
|
11
13
|
code,.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}
|
|
12
|
-
header{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px
|
|
14
|
+
header{position:sticky;top:0;z-index:1;display:flex;flex-wrap:wrap;align-items:baseline;gap:6px var(--s4);padding:10px var(--s4);border-bottom:1px solid var(--line);background:var(--panel)}
|
|
13
15
|
header h1{font-size:14px;margin:0;font-weight:600}
|
|
14
|
-
main{padding:
|
|
15
|
-
section{background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:
|
|
16
|
-
|
|
16
|
+
main{padding:var(--s4) var(--s4) var(--s5);display:grid;gap:var(--s4);max-width:1600px}
|
|
17
|
+
section{background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:var(--s3) var(--s4);min-width:0}
|
|
18
|
+
section.attn{border-color:color-mix(in srgb,var(--warn) 45%,var(--line))}section.attn>h2 .n{color:var(--warn)}
|
|
19
|
+
h2{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin:0 0 var(--s2);font-weight:600}
|
|
17
20
|
h2 .n{color:var(--faint);margin-left:4px}
|
|
18
21
|
.muted{color:var(--muted)}.faint{color:var(--faint)}.ok{color:var(--ok)}.warn{color:var(--warn)}.err{color:var(--err)}
|
|
19
22
|
.pill{display:inline-block;padding:0 7px;border-radius:9px;background:var(--chip);font-size:12px}
|
|
20
23
|
.pill.ok{background:color-mix(in srgb,var(--ok) 16%,transparent)}.pill.warn{background:color-mix(in srgb,var(--warn) 18%,transparent)}
|
|
21
24
|
.pill.err{background:color-mix(in srgb,var(--err) 16%,transparent)}
|
|
22
|
-
.banner{padding:
|
|
25
|
+
.banner{padding:var(--s2) var(--s3);border-radius:6px;border:1px solid var(--line);background:var(--panel)}
|
|
23
26
|
.banner.err{border-color:color-mix(in srgb,var(--err) 45%,var(--line))}.banner.warn{border-color:color-mix(in srgb,var(--warn) 45%,var(--line))}
|
|
24
|
-
.
|
|
25
|
-
.
|
|
26
|
-
.
|
|
27
|
-
.
|
|
27
|
+
.top{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,360px),1fr));gap:var(--s4)}
|
|
28
|
+
.detail{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:var(--s4);align-items:start}
|
|
29
|
+
.stats{display:flex;flex-wrap:wrap;gap:var(--s1) var(--s4);margin-top:var(--s3);padding-top:var(--s3);border-top:1px solid var(--line)}.stat b{font-size:16px;font-weight:600;margin-right:var(--s1)}
|
|
30
|
+
.steps{display:flex;flex-wrap:wrap;gap:var(--s1)}.steps+.err{margin-top:var(--s1)}
|
|
31
|
+
.cols{display:grid;grid-template-columns:repeat(4,minmax(0,1fr)) minmax(0,1.35fr);gap:var(--s4)}
|
|
32
|
+
.col.prs{border-left:1px solid var(--line);padding-left:var(--s4)}
|
|
28
33
|
.col{min-width:0}.col ul{list-style:none;margin:0;padding:0}
|
|
29
|
-
.col li{padding:
|
|
34
|
+
.col li{padding:6px 0;border-top:1px solid var(--line)}.col li:first-child{border-top:0}
|
|
30
35
|
.t{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
31
36
|
.meta{font-size:12px;color:var(--muted);display:flex;flex-wrap:wrap;gap:2px 8px}
|
|
32
37
|
.empty{color:var(--faint);font-size:12px}
|
|
@@ -37,8 +42,10 @@ td,th{padding:4px 10px 4px 0;border-top:1px solid var(--line);vertical-align:top
|
|
|
37
42
|
.events{max-height:320px;overflow:auto}.events div{display:grid;grid-template-columns:62px 40px minmax(0,1fr);gap:8px;padding:2px 0}
|
|
38
43
|
.dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--faint);margin-right:5px}
|
|
39
44
|
.dot.ok{background:var(--ok)}.dot.warn{background:var(--warn)}.dot.err{background:var(--err)}
|
|
40
|
-
@media (max-width:1100px){.cols{grid-template-columns:repeat(
|
|
41
|
-
|
|
45
|
+
@media (max-width:1100px){.cols{grid-template-columns:repeat(4,minmax(0,1fr))}.detail{grid-template-columns:1fr}
|
|
46
|
+
.col.prs{grid-column:1/-1;border-left:0;padding-left:0;border-top:1px solid var(--line);padding-top:var(--s3)}}
|
|
47
|
+
@media (max-width:760px){.cols{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
|
48
|
+
@media (max-width:480px){main{padding:var(--s3) var(--s3) var(--s5);gap:var(--s3)}section{padding:var(--s3)}.cols{grid-template-columns:1fr}}
|
|
42
49
|
`
|
|
43
50
|
|
|
44
51
|
const JS = `
|
|
@@ -103,7 +110,7 @@ function summary(d) {
|
|
|
103
110
|
const steps = h('div', { class: 'steps' }, d.steps.length ? d.steps.map((st) =>
|
|
104
111
|
h('span', { class: 'pill ' + (st.ok ? 'ok' : 'err'), title: st.error || '' }, st.name, ' ', h('span', { class: 'faint' }, st.ms != null ? st.ms + 'ms' : ''))) : h('span', { class: 'empty' }, 'no steps recorded'))
|
|
105
112
|
const errs = d.steps.filter((st) => !st.ok && st.error).map((st) => h('div', { class: 'err mono' }, st.name + ': ' + st.error))
|
|
106
|
-
return
|
|
113
|
+
return section('Last tick', null, steps, errs, stats)
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
function item(i, multi, now) {
|
|
@@ -129,13 +136,20 @@ function pr(p, multi, now) {
|
|
|
129
136
|
h('span', { class: 'faint mono' }, p.branch)))
|
|
130
137
|
}
|
|
131
138
|
|
|
139
|
+
const isMulti = (gh) => new Set(gh.repos.map((r) => r.slug)).size > 1
|
|
140
|
+
const list = (xs, render, multi, now) => xs.length ? h('ul', {}, xs.map((x) => render(x, multi, now))) : h('div', { class: 'empty' }, 'empty')
|
|
141
|
+
|
|
142
|
+
function human(s, now) {
|
|
143
|
+
const xs = s.github.columns.human
|
|
144
|
+
return h('section', { class: 'col' + (xs.length ? ' attn' : '') }, h('h2', {}, 'Human', h('span', { class: 'n' }, xs.length)), list(xs, item, isMulti(s.github), now))
|
|
145
|
+
}
|
|
146
|
+
|
|
132
147
|
function queues(s, now) {
|
|
133
|
-
const gh = s.github, multi =
|
|
134
|
-
const col = (title,
|
|
135
|
-
list.length ? h('ul', {}, list.map((x) => render(x, multi, now))) : h('div', { class: 'empty' }, 'empty'))
|
|
148
|
+
const gh = s.github, multi = isMulti(gh)
|
|
149
|
+
const col = (title, xs, render, cls) => h('div', { class: 'col' + (cls ? ' ' + cls : '') }, h('h2', {}, title, h('span', { class: 'n' }, xs.length)), list(xs, render, multi, now))
|
|
136
150
|
return h('section', {}, h('div', { class: 'cols' },
|
|
137
151
|
col('Intake', gh.columns.intake, item), col('Task', gh.columns.task, item), col('Running', gh.columns.running, item),
|
|
138
|
-
col('
|
|
152
|
+
col('Promote', gh.columns.promote, item), col('Agent PRs', gh.prs, pr, 'prs')))
|
|
139
153
|
}
|
|
140
154
|
|
|
141
155
|
function workers(d, ageMs) {
|
|
@@ -173,9 +187,9 @@ function render(s) {
|
|
|
173
187
|
const now = Date.parse(s.now) || Date.now()
|
|
174
188
|
const d = s.heartbeat.data
|
|
175
189
|
const body = [...banners(s)]
|
|
176
|
-
|
|
190
|
+
body.push(h('div', { class: 'top' }, human(s, now), d ? summary(d) : null))
|
|
177
191
|
body.push(queues(s, now))
|
|
178
|
-
if (d) body.push(h('div', { class: '
|
|
192
|
+
if (d) body.push(h('div', { class: 'detail' }, workers(d, s.heartbeat.ageMs), events(d)))
|
|
179
193
|
$('top').replaceChildren(header(s, now))
|
|
180
194
|
$('main').replaceChildren(...body)
|
|
181
195
|
document.title = 'canopy' + (d ? ' · ' + d.mode : '') + (s.heartbeat.stale ? ' · stale' : '')
|