@nanocollective/roster 0.1.0-beta.16 → 0.1.0-beta.19
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/dist/{agents-NMGVORU3.js → agents-Q2DSTLOQ.js} +1 -1
- package/dist/{chunk-E3EVPK4I.js → chunk-JH3LQ34C.js} +16 -1
- package/dist/{chunk-QCKEGMXD.js → chunk-UEZPQ5PV.js} +2 -2
- package/dist/cli.js +210 -16
- package/dist/{compose-56JIIIHA.js → compose-H43W3QI5.js} +3 -1
- package/dist/{connectors-ZVEPXSAR.js → connectors-U5VT5W2I.js} +1 -1
- package/dist/worker/assets/assets/css/base.css +4 -0
- package/dist/worker/assets/assets/css/brain.css +20 -0
- package/dist/worker/assets/assets/css/home.css +102 -34
- package/dist/worker/assets/assets/css/inbox.css +11 -0
- package/dist/worker/assets/assets/js/app.js +1 -0
- package/dist/worker/assets/assets/js/homesort.js +24 -0
- package/dist/worker/assets/assets/js/md.js +7 -2
- package/dist/worker/assets/assets/js/refresh.js +4 -2
- package/dist/worker/assets/assets/js/report.js +51 -0
- package/dist/worker/assets/assets/js/state.js +2 -0
- package/dist/worker/assets/assets/js/views/home.js +274 -119
- package/dist/worker/assets/assets/js/views/inbox.js +52 -11
- package/dist/worker/assets/assets/js/views/org.js +2 -0
- package/dist/worker/assets/assets/js/views/people.js +103 -0
- package/dist/worker/index.js +201 -15
- package/docs/doctor-codes.md +2 -0
- package/docs/export.md +2 -1
- package/docs/org-yaml.md +25 -4
- package/package.json +1 -1
- package/templates/brain/.github/workflows/%%STAFF%%-mention.yaml +4 -4
- package/templates/ops/compose.mjs +20 -0
- package/templates/ops/org/operating.md +10 -0
- package/templates/ops/org/voice.md +19 -1
- package/templates/ops/prompts/daily.md +27 -6
- package/templates/ops/prompts/mention.md +3 -2
- package/templates/portal/css/base.css +4 -0
- package/templates/portal/css/brain.css +20 -0
- package/templates/portal/css/home.css +102 -34
- package/templates/portal/css/inbox.css +11 -0
- package/templates/portal/js/app.js +1 -0
- package/templates/portal/js/homesort.js +24 -0
- package/templates/portal/js/md.js +7 -2
- package/templates/portal/js/refresh.js +4 -2
- package/templates/portal/js/report.js +51 -0
- package/templates/portal/js/state.js +2 -0
- package/templates/portal/js/views/home.js +274 -119
- package/templates/portal/js/views/inbox.js +52 -11
- package/templates/portal/js/views/org.js +2 -0
- package/templates/portal/js/views/people.js +103 -0
|
@@ -93,8 +93,11 @@ export function belongsTo(item, s) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/* Threads read so far, by repo#number, kept for the session. Each is reused while its
|
|
96
|
-
updatedAt matches the list's, so a thread is fetched again only when it has changed
|
|
96
|
+
updatedAt matches the list's, so a thread is fetched again only when it has changed, or once
|
|
97
|
+
the signed links to its images (good for five minutes) are about to run out. */
|
|
97
98
|
const THREADS = new Map();
|
|
99
|
+
const THREAD_AT = new Map();
|
|
100
|
+
const THREAD_FRESH = 4 * 60_000;
|
|
98
101
|
|
|
99
102
|
export const viewInbox = (m) => inboxScreen(m, {});
|
|
100
103
|
|
|
@@ -423,7 +426,7 @@ function inboxScreen(m, opts) {
|
|
|
423
426
|
const key = item.repo + "#" + item.number;
|
|
424
427
|
const kept = THREADS.get(key);
|
|
425
428
|
const keep = { role: item.role, unread: item.unread };
|
|
426
|
-
if (kept && kept.updatedAt === item.updatedAt) {
|
|
429
|
+
if (kept && kept.updatedAt === item.updatedAt && Date.now() - (THREAD_AT.get(key) ?? 0) < THREAD_FRESH) {
|
|
427
430
|
Object.assign(item, kept, keep, { partial: false });
|
|
428
431
|
} else {
|
|
429
432
|
viewer.dataset.want = key;
|
|
@@ -432,6 +435,7 @@ function inboxScreen(m, opts) {
|
|
|
432
435
|
.then((fresh) => {
|
|
433
436
|
if (!fresh || fresh.error) throw new Error(fresh?.error ?? "could not read it");
|
|
434
437
|
THREADS.set(key, fresh);
|
|
438
|
+
THREAD_AT.set(key, Date.now());
|
|
435
439
|
Object.assign(item, fresh, keep, { partial: false });
|
|
436
440
|
})
|
|
437
441
|
.catch((e) => {
|
|
@@ -490,7 +494,22 @@ function inboxScreen(m, opts) {
|
|
|
490
494
|
just happened. The title and the actions are in the header, so nothing you need is
|
|
491
495
|
further down than the first screenful. */
|
|
492
496
|
const from = pane.children.length;
|
|
493
|
-
|
|
497
|
+
const nodes = timeline(item, openThread);
|
|
498
|
+
/* The newest message is what you came for, so it is marked and everything between it and
|
|
499
|
+
the opening post folds behind one button. What happened after it (closed, relabelled)
|
|
500
|
+
stays in view above it, and the opening post stays at the bottom, since it says what
|
|
501
|
+
was asked in the first place. */
|
|
502
|
+
const latest = nodes.findIndex((n) => n.classList?.contains("cmt"));
|
|
503
|
+
if (latest >= 0) {
|
|
504
|
+
nodes[latest].classList.add("latest");
|
|
505
|
+
nodes[latest].querySelector?.(".cwhen")?.before?.(el("span", { className: "pill clatest", textContent: "Latest" }));
|
|
506
|
+
const older = nodes.slice(latest + 1);
|
|
507
|
+
const said = older.filter((n) => n.classList?.contains("cmt")).length;
|
|
508
|
+
if (said) {
|
|
509
|
+
nodes.splice(latest + 1, older.length, earlier(older, said));
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
for (const node of nodes) pane.append(node);
|
|
494
513
|
pane.append(
|
|
495
514
|
comment({
|
|
496
515
|
author: item.author, when: item.createdAt, body: item.body, first: true,
|
|
@@ -733,9 +752,11 @@ function inboxScreen(m, opts) {
|
|
|
733
752
|
};
|
|
734
753
|
buttons.push(reply);
|
|
735
754
|
|
|
755
|
+
/* Closing, in words a person uses: "close" read as shutting the panel. Light red and over
|
|
756
|
+
by Open in GitHub, away from Reply, so it is not pressed on the way to answering. */
|
|
736
757
|
const closeBtn = el("button", {
|
|
737
|
-
className: "ghbtn",
|
|
738
|
-
textContent: item.state === "OPEN" ? "
|
|
758
|
+
className: "ghbtn" + (item.state === "OPEN" ? " danger" : ""),
|
|
759
|
+
textContent: item.state === "OPEN" ? "Mark as completed" : "Reopen",
|
|
739
760
|
});
|
|
740
761
|
closeBtn.onclick = async () => {
|
|
741
762
|
const closing = item.state === "OPEN";
|
|
@@ -744,9 +765,9 @@ function inboxScreen(m, opts) {
|
|
|
744
765
|
// Closing is the one thing here that is awkward to undo from a phone later, so it asks
|
|
745
766
|
// — and since it is asking anyway, it takes a parting comment.
|
|
746
767
|
body = await compose({
|
|
747
|
-
title: "
|
|
748
|
-
hint: "Anything you write here is posted as a comment first.
|
|
749
|
-
confirm: "
|
|
768
|
+
title: "Are you sure you want to mark #" + item.number + " as completed?",
|
|
769
|
+
hint: "This closes it. Anything you write here is posted as a comment first.",
|
|
770
|
+
confirm: "Mark as completed",
|
|
750
771
|
allowEmpty: true,
|
|
751
772
|
});
|
|
752
773
|
if (body === null) return;
|
|
@@ -776,9 +797,8 @@ function inboxScreen(m, opts) {
|
|
|
776
797
|
openThread({ repo: item.repo, number: item.number, kind: item.kind });
|
|
777
798
|
} catch (e) { failed(e); }
|
|
778
799
|
};
|
|
779
|
-
buttons.push(closeBtn);
|
|
780
|
-
|
|
781
800
|
const row = el("div", { className: "row tacts" }, buttons);
|
|
801
|
+
buttons.push(closeBtn);
|
|
782
802
|
|
|
783
803
|
/* Merging cannot be undone with another click, so it asks first and names what it is about
|
|
784
804
|
to merge. It does not ask *how*: squash, merge commit or rebase is a question about git
|
|
@@ -833,9 +853,11 @@ function inboxScreen(m, opts) {
|
|
|
833
853
|
row.append(status);
|
|
834
854
|
// Last, and pushed to the far end: it is the way out of this screen rather than one of the
|
|
835
855
|
// things you do on it. Same shape as the rest, so the row reads as one set of controls.
|
|
856
|
+
closeBtn.classList.add("out");
|
|
836
857
|
row.append(
|
|
858
|
+
closeBtn,
|
|
837
859
|
el("a", {
|
|
838
|
-
className: "ghbtn
|
|
860
|
+
className: "ghbtn",
|
|
839
861
|
href: item.url,
|
|
840
862
|
target: "_blank",
|
|
841
863
|
rel: "noopener",
|
|
@@ -856,6 +878,7 @@ function inboxScreen(m, opts) {
|
|
|
856
878
|
if (at >= 0) {
|
|
857
879
|
const old = S.inbox.items[at];
|
|
858
880
|
THREADS.set(item.repo + "#" + item.number, fresh);
|
|
881
|
+
THREAD_AT.set(item.repo + "#" + item.number, Date.now());
|
|
859
882
|
// A single thread does not know which part of the org it is in, or whether it is unread.
|
|
860
883
|
S.inbox.items[at] = { ...old, ...fresh, role: old.role, unread: old.unread, partial: false };
|
|
861
884
|
} else if (opts.stray && find(item) === opts.stray) {
|
|
@@ -1069,6 +1092,24 @@ function timeline(item, openThread) {
|
|
|
1069
1092
|
return out;
|
|
1070
1093
|
}
|
|
1071
1094
|
|
|
1095
|
+
/** Older messages in a thread, behind one button that shows them all. */
|
|
1096
|
+
function earlier(nodes, said) {
|
|
1097
|
+
const box = el("div", { className: "tearlier" });
|
|
1098
|
+
const btn = el("button", {
|
|
1099
|
+
className: "tearlierbtn",
|
|
1100
|
+
textContent: "Show " + said + " earlier message" + (said === 1 ? "" : "s"),
|
|
1101
|
+
});
|
|
1102
|
+
btn.setAttribute("aria-expanded", "false");
|
|
1103
|
+
const body = el("div", {}, nodes);
|
|
1104
|
+
body.hidden = true;
|
|
1105
|
+
btn.onclick = () => {
|
|
1106
|
+
body.hidden = false;
|
|
1107
|
+
btn.remove();
|
|
1108
|
+
};
|
|
1109
|
+
box.append(btn, body);
|
|
1110
|
+
return box;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1072
1113
|
function folded(events, item, openThread) {
|
|
1073
1114
|
const box = el("div");
|
|
1074
1115
|
const btn = el("button", { className: "tevmore" });
|
|
@@ -20,6 +20,7 @@ import { mdlite } from "../md.js";
|
|
|
20
20
|
import { humansOf, S, writeHash } from "../state.js";
|
|
21
21
|
import { yamlPre } from "../yaml.js";
|
|
22
22
|
import { businessForm, fileModes, prioritiesForm } from "./orgedit.js";
|
|
23
|
+
import { peopleCard } from "./people.js";
|
|
23
24
|
import { repoPicker } from "./repos.js";
|
|
24
25
|
|
|
25
26
|
/* What the files roster itself ships are for, in one line each. A filename says nothing about
|
|
@@ -72,6 +73,7 @@ export function viewOrg(m) {
|
|
|
72
73
|
kv("Staff", String(org.staff.length), org.staff.map((s) => s.handle).join(", ")),
|
|
73
74
|
);
|
|
74
75
|
m.append(facts);
|
|
76
|
+
m.append(peopleCard());
|
|
75
77
|
|
|
76
78
|
/* Marking a product repo after setup. The picker only lived on the setup screen, so a repo
|
|
77
79
|
created later meant typing `role: product` into org.yaml by hand. Folded, because it asks
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* People: who the staff answer to, and what each of them looks after. On the Org screen.
|
|
2
|
+
*
|
|
3
|
+
* Saving writes the humans list in org.yaml, and the server then puts each person's label on
|
|
4
|
+
* every tracker and tells the mention callers who may wake a staff member, so somebody added
|
|
5
|
+
* here can send work straight away. */
|
|
6
|
+
|
|
7
|
+
import { post } from "../api.js";
|
|
8
|
+
import { el } from "../dom.js";
|
|
9
|
+
import { refreshAll } from "../refresh.js";
|
|
10
|
+
import { S } from "../state.js";
|
|
11
|
+
|
|
12
|
+
export function peopleCard() {
|
|
13
|
+
const start = (S.data?.people?.length ? S.data.people : (S.data?.humans ?? [])).map((h) => ({
|
|
14
|
+
name: h.name ?? "",
|
|
15
|
+
github: h.github ?? "",
|
|
16
|
+
marker: h.marker ?? "",
|
|
17
|
+
role: h.role ?? "",
|
|
18
|
+
handles: (h.handles ?? []).join(", "),
|
|
19
|
+
view_only: Boolean(h.viewOnly),
|
|
20
|
+
}));
|
|
21
|
+
const rows = start.map((p) => ({ ...p }));
|
|
22
|
+
|
|
23
|
+
const list = el("div", { className: "peoplelist" });
|
|
24
|
+
const note = el("span", { className: "meta" });
|
|
25
|
+
const save = el("button", { className: "ghbtn primary", textContent: "Save" });
|
|
26
|
+
const add = el("button", { className: "ghbtn", textContent: "Add a person" });
|
|
27
|
+
|
|
28
|
+
const changed = () => JSON.stringify(rows) !== JSON.stringify(start);
|
|
29
|
+
const stamp = () => {
|
|
30
|
+
save.disabled = !changed();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function paint() {
|
|
34
|
+
list.replaceChildren(
|
|
35
|
+
el("div", { className: "peoplerow peoplehead", ariaHidden: "true" }, [
|
|
36
|
+
el("span", { textContent: "Name" }),
|
|
37
|
+
el("span", { textContent: "GitHub login" }),
|
|
38
|
+
el("span", { textContent: "Looks after" }),
|
|
39
|
+
el("span", { textContent: "Read only" }),
|
|
40
|
+
el("span"),
|
|
41
|
+
]),
|
|
42
|
+
...rows.map((p, i) => row(p, i)),
|
|
43
|
+
);
|
|
44
|
+
stamp();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function row(p, i) {
|
|
48
|
+
const input = (key, placeholder, label) => {
|
|
49
|
+
const box = el("input", { type: "text", value: p[key], placeholder, ariaLabel: label });
|
|
50
|
+
box.oninput = () => {
|
|
51
|
+
p[key] = box.value;
|
|
52
|
+
stamp();
|
|
53
|
+
};
|
|
54
|
+
return box;
|
|
55
|
+
};
|
|
56
|
+
const only = el("input", { type: "checkbox", checked: p.view_only, ariaLabel: "Read only" });
|
|
57
|
+
only.onchange = () => {
|
|
58
|
+
p.view_only = only.checked;
|
|
59
|
+
stamp();
|
|
60
|
+
};
|
|
61
|
+
const remove = el("button", { className: "ghbtn danger", textContent: "Remove" });
|
|
62
|
+
remove.onclick = () => {
|
|
63
|
+
rows.splice(i, 1);
|
|
64
|
+
paint();
|
|
65
|
+
};
|
|
66
|
+
return el("div", { className: "peoplerow" }, [
|
|
67
|
+
input("name", "Name", "Name"),
|
|
68
|
+
input("github", "login", "GitHub login"),
|
|
69
|
+
input("handles", "e.g. marketing, content", "Looks after"),
|
|
70
|
+
el("label", { className: "peopleonly" }, [only]),
|
|
71
|
+
remove,
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
add.onclick = () => {
|
|
76
|
+
rows.push({ name: "", github: "", marker: "", role: "", handles: "", view_only: false });
|
|
77
|
+
paint();
|
|
78
|
+
list.querySelector(".peoplerow:last-child input")?.focus();
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
save.onclick = async () => {
|
|
82
|
+
save.disabled = true;
|
|
83
|
+
note.className = "meta";
|
|
84
|
+
note.textContent = "Saving…";
|
|
85
|
+
try {
|
|
86
|
+
const r = await post({ people: rows.filter((p) => p.github.trim() || p.name.trim()) }, "/api/people");
|
|
87
|
+
note.textContent = r.warnings?.length ? "Saved, but: " + r.warnings.join("; ") : "Saved.";
|
|
88
|
+
if (r.warnings?.length) note.className = "meta warn";
|
|
89
|
+
await refreshAll(false);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
note.textContent = String(e.message || e);
|
|
92
|
+
note.className = "meta err";
|
|
93
|
+
stamp();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
paint();
|
|
98
|
+
return el("div", { className: "card peoplecard" }, [
|
|
99
|
+
el("h2", { textContent: "People" }),
|
|
100
|
+
list,
|
|
101
|
+
el("div", { className: "row" }, [add, save, note]),
|
|
102
|
+
]);
|
|
103
|
+
}
|