@nanocollective/roster 0.1.0-alpha.9 → 0.1.0-beta.10
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 +6 -0
- package/dist/cli.js +4189 -1971
- package/dist/worker/assets/assets/css/base.css +327 -0
- package/dist/worker/assets/assets/css/brain.css +116 -0
- package/dist/worker/assets/assets/css/diff.css +33 -0
- package/dist/worker/assets/assets/css/graph.css +39 -0
- package/dist/worker/assets/assets/css/health.css +75 -0
- package/dist/worker/assets/assets/css/home.css +114 -0
- package/dist/worker/assets/assets/css/inbox.css +199 -0
- package/dist/worker/assets/assets/css/layout.css +181 -0
- package/dist/worker/assets/assets/css/markdown.css +96 -0
- package/dist/worker/assets/assets/css/runs.css +13 -0
- package/dist/worker/assets/assets/css/search.css +48 -0
- package/dist/worker/assets/assets/css/setup.css +194 -0
- package/dist/worker/assets/assets/js/api.js +191 -0
- package/dist/worker/assets/assets/js/app.js +500 -0
- package/dist/worker/assets/assets/js/dialog.js +196 -0
- package/dist/worker/assets/assets/js/dom.js +131 -0
- package/dist/worker/assets/assets/js/homesort.js +174 -0
- package/dist/worker/assets/assets/js/icons.js +142 -0
- package/dist/worker/assets/assets/js/inflight.js +18 -0
- package/dist/worker/assets/assets/js/lightbox.js +273 -0
- package/dist/worker/assets/assets/js/md.js +406 -0
- package/dist/worker/assets/assets/js/mdedit.js +84 -0
- package/dist/worker/assets/assets/js/mention.js +264 -0
- package/dist/worker/assets/assets/js/readiness.js +70 -0
- package/dist/worker/assets/assets/js/refresh.js +197 -0
- package/dist/worker/assets/assets/js/router.js +20 -0
- package/dist/worker/assets/assets/js/search.js +366 -0
- package/dist/worker/assets/assets/js/state.js +213 -0
- package/dist/worker/assets/assets/js/textdiff.js +96 -0
- package/dist/worker/assets/assets/js/views/app.js +145 -0
- package/dist/worker/assets/assets/js/views/brain.js +260 -0
- package/dist/worker/assets/assets/js/views/changed.js +157 -0
- package/dist/worker/assets/assets/js/views/checklist.js +115 -0
- package/dist/worker/assets/assets/js/views/credential.js +84 -0
- package/dist/worker/assets/assets/js/views/docs.js +174 -0
- package/dist/worker/assets/assets/js/views/files.js +139 -0
- package/dist/worker/assets/assets/js/views/graph.js +436 -0
- package/dist/worker/assets/assets/js/views/health.js +304 -0
- package/dist/worker/assets/assets/js/views/hire.js +593 -0
- package/dist/worker/assets/assets/js/views/home.js +621 -0
- package/dist/worker/assets/assets/js/views/inbox.js +1558 -0
- package/dist/worker/assets/assets/js/views/memory.js +150 -0
- package/dist/worker/assets/assets/js/views/org.js +195 -0
- package/dist/worker/assets/assets/js/views/orgedit.js +240 -0
- package/dist/worker/assets/assets/js/views/paste.js +216 -0
- package/dist/worker/assets/assets/js/views/prompt.js +457 -0
- package/dist/worker/assets/assets/js/views/repos.js +97 -0
- package/dist/worker/assets/assets/js/views/runonce.js +94 -0
- package/dist/worker/assets/assets/js/views/runs.js +182 -0
- package/dist/worker/assets/assets/js/views/setup.js +557 -0
- package/dist/worker/assets/assets/js/views/staff.js +291 -0
- package/dist/worker/assets/assets/js/views/todo.js +62 -0
- package/dist/worker/assets/assets/js/yaml.js +134 -0
- package/dist/worker/assets/docs-images/brain.jpg +0 -0
- package/dist/worker/assets/docs-images/home.jpg +0 -0
- package/dist/worker/assets/docs-images/org.jpg +0 -0
- package/dist/worker/assets/docs-images/prompt.jpg +0 -0
- package/dist/worker/assets/docs-images/setup-org.jpg +0 -0
- package/dist/worker/assets/docs-images/setup-plan.jpg +0 -0
- package/dist/worker/assets/docs-images/staff.jpg +0 -0
- package/dist/worker/assets/index.html +82 -0
- package/dist/worker/index.js +5143 -0
- package/docs/README.md +2 -2
- package/docs/architecture.md +23 -4
- package/docs/charters/analyst.md +65 -0
- package/docs/charters/community.md +63 -0
- package/docs/charters/designer.md +65 -0
- package/docs/charters/devops.md +65 -0
- package/docs/charters/pm.md +70 -0
- package/docs/charters/qa.md +65 -0
- package/docs/charters/writer.md +63 -0
- package/docs/commands.md +36 -9
- package/docs/concepts.md +34 -21
- package/docs/cost.md +3 -3
- package/docs/developing.md +28 -10
- package/docs/doctor-codes.md +3 -1
- package/docs/export.md +2 -0
- package/docs/getting-started.md +49 -29
- package/docs/hosting.md +114 -43
- package/docs/images/brain.jpg +0 -0
- package/docs/images/home.jpg +0 -0
- package/docs/images/org.jpg +0 -0
- package/docs/images/prompt.jpg +0 -0
- package/docs/images/staff.jpg +0 -0
- package/docs/manual-steps.md +3 -2
- package/docs/memory.md +2 -1
- package/docs/org-yaml.md +3 -0
- package/docs/portal.md +144 -45
- package/docs/prompts.md +6 -0
- package/docs/security.md +70 -11
- package/docs/session-workflow.md +24 -6
- package/docs/staff-yaml.md +21 -2
- package/docs/upgrading.md +3 -3
- package/docs/writing-a-charter.md +19 -6
- package/package.json +4 -3
- package/templates/brain/.github/workflows/%%STAFF%%-daily.yaml +20 -1
- package/templates/brain/.github/workflows/%%STAFF%%-mention.yaml +53 -13
- package/templates/brain/CHARTER.md +2 -2
- package/templates/brain/STATE.md +16 -0
- package/templates/brain/memory/INDEX.md +1 -1
- package/templates/brain/staff.yaml +4 -1
- package/templates/briefs/amend.md +4 -3
- package/templates/briefs/priorities.md +46 -0
- package/templates/ops/.github/workflows/session.yaml +150 -3
- package/templates/ops/compose.mjs +35 -8
- package/templates/ops/org/operating.md +29 -10
- package/templates/ops/org/voice.md +2 -1
- package/templates/ops/prompts/daily.md +51 -14
- package/templates/ops/prompts/mention.md +24 -2
- package/templates/ops/run-record.mjs +5 -3
- package/templates/ops/status-week.mjs +169 -0
- package/templates/portal/css/base.css +49 -0
- package/templates/portal/css/health.css +14 -1
- package/templates/portal/css/home.css +114 -0
- package/templates/portal/css/inbox.css +21 -4
- package/templates/portal/css/layout.css +35 -3
- package/templates/portal/css/markdown.css +19 -0
- package/templates/portal/css/search.css +48 -0
- package/templates/portal/css/setup.css +79 -4
- package/templates/portal/index.html +15 -9
- package/templates/portal/js/api.js +60 -4
- package/templates/portal/js/app.js +125 -7
- package/templates/portal/js/dialog.js +36 -0
- package/templates/portal/js/homesort.js +174 -0
- package/templates/portal/js/icons.js +41 -0
- package/templates/portal/js/inflight.js +18 -0
- package/templates/portal/js/md.js +5 -2
- package/templates/portal/js/mdedit.js +84 -0
- package/templates/portal/js/readiness.js +70 -0
- package/templates/portal/js/refresh.js +10 -2
- package/templates/portal/js/search.js +366 -0
- package/templates/portal/js/state.js +11 -5
- package/templates/portal/js/views/app.js +1 -2
- package/templates/portal/js/views/brain.js +1 -1
- package/templates/portal/js/views/checklist.js +19 -4
- package/templates/portal/js/views/credential.js +42 -51
- package/templates/portal/js/views/health.js +11 -6
- package/templates/portal/js/views/hire.js +593 -0
- package/templates/portal/js/views/home.js +621 -0
- package/templates/portal/js/views/inbox.js +237 -68
- package/templates/portal/js/views/org.js +31 -111
- package/templates/portal/js/views/orgedit.js +240 -0
- package/templates/portal/js/views/paste.js +111 -66
- package/templates/portal/js/views/prompt.js +94 -40
- package/templates/portal/js/views/repos.js +10 -10
- package/templates/portal/js/views/runs.js +21 -4
- package/templates/portal/js/views/setup.js +130 -163
- package/templates/portal/js/views/staff.js +181 -301
- package/templates/portal/js/views/todo.js +62 -0
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
* changing a byte of the composed text, and nothing said so before.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import { highlighted } from "../mdedit.js";
|
|
12
13
|
import { getFile, post } from "../api.js";
|
|
13
|
-
import {
|
|
14
|
+
import { askYes, sheet } from "../dialog.js";
|
|
14
15
|
import { el, esc, grow, kb, toClipboard } from "../dom.js";
|
|
15
16
|
import { icon } from "../icons.js";
|
|
16
17
|
import { mdlite } from "../md.js";
|
|
@@ -18,6 +19,7 @@ import { render } from "../router.js";
|
|
|
18
19
|
import { S, staff, writeHash } from "../state.js";
|
|
19
20
|
import { diffStat, unifiedDiff } from "../textdiff.js";
|
|
20
21
|
import { renderDiff } from "./changed.js";
|
|
22
|
+
import { showPasteResult } from "./paste.js";
|
|
21
23
|
|
|
22
24
|
const KINDS = [
|
|
23
25
|
["daily", "Daily", "the scheduled run"],
|
|
@@ -25,48 +27,98 @@ const KINDS = [
|
|
|
25
27
|
];
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
30
|
+
* Fix a prompt with your own AI, in a side sheet: what is wrong, what you want changed, the
|
|
31
|
+
* prompt as it is today, a brief to copy, and a box for the reply. The reply is parsed into
|
|
32
|
+
* whole files and shown as diffs; nothing is saved until you press Save on one.
|
|
29
33
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* the same brief whichever screen you asked from.
|
|
34
|
+
* @param {{handle: string, name?: string, kind: string, want?: string, title?: string,
|
|
35
|
+
* detail?: string}} o
|
|
36
|
+
* @returns {{box: object | null, body: HTMLElement, want: HTMLTextAreaElement}} what it built,
|
|
37
|
+
* so a caller (or a test, where there is no <dialog>) can see it.
|
|
35
38
|
*/
|
|
36
|
-
export
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
export function amendSheet(o) {
|
|
40
|
+
const body = el("div", { className: "amend" });
|
|
41
|
+
const x = el("button", { className: "iconbtn", title: "Close (Esc)", ariaLabel: "Close" });
|
|
42
|
+
x.append(icon("close"));
|
|
43
|
+
body.append(el("div", { className: "sidebar-x" }, [x]));
|
|
44
|
+
|
|
45
|
+
body.append(el("h3", { className: "sheettitle", textContent: o.title ?? "Change what they are told" }));
|
|
46
|
+
if (o.detail) body.append(el("p", { className: "sub", textContent: o.detail }));
|
|
47
|
+
|
|
48
|
+
const want = el("textarea", {
|
|
49
|
+
className: "pastebox",
|
|
50
|
+
rows: 3,
|
|
51
|
+
value: o.want ?? "",
|
|
44
52
|
placeholder: "stop opening decision issues for anything reversible",
|
|
45
|
-
confirm: "Copy the brief",
|
|
46
53
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
btn
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
body.append(el("label", { className: "amendlabel", textContent: "1. What you want changed" }), want);
|
|
55
|
+
|
|
56
|
+
const copy = el("button", { className: "btn primary", textContent: "Copy the prompt" });
|
|
57
|
+
const copied = el("span", { className: "meta" });
|
|
58
|
+
copy.onclick = async () => {
|
|
59
|
+
copy.disabled = true;
|
|
60
|
+
try {
|
|
61
|
+
const url =
|
|
62
|
+
"/api/amend?staff=" + encodeURIComponent(o.handle) +
|
|
63
|
+
"&kind=" + encodeURIComponent(o.kind) +
|
|
64
|
+
"&want=" + encodeURIComponent(want.value);
|
|
65
|
+
const text = await (await fetch(url, { cache: "no-store" })).text();
|
|
66
|
+
await toClipboard(text, copy, "Copy the prompt");
|
|
67
|
+
copied.textContent = "Paste it into Claude, ChatGPT or any other AI.";
|
|
68
|
+
copied.className = "meta";
|
|
69
|
+
} catch (e) {
|
|
70
|
+
copied.textContent = String(e.message || e);
|
|
71
|
+
copied.className = "meta err";
|
|
72
|
+
} finally {
|
|
73
|
+
copy.disabled = false;
|
|
61
74
|
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
};
|
|
76
|
+
body.append(
|
|
77
|
+
el("label", { className: "amendlabel", textContent: "2. Copy the prompt into your AI" }),
|
|
78
|
+
el("div", { className: "row" }, [copy, copied]),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// The prompt this is about, to read before deciding what to ask for.
|
|
82
|
+
const today = el("details", { className: "amendtoday" });
|
|
83
|
+
const summary = el("summary", { textContent: "The " + o.kind + " prompt as it is today" });
|
|
84
|
+
const text = el("pre", { className: "briefpreview", textContent: "Composing…" });
|
|
85
|
+
today.append(summary, text);
|
|
86
|
+
body.append(today);
|
|
87
|
+
fetch("/api/prompt?staff=" + encodeURIComponent(o.handle) + "&kind=" + encodeURIComponent(o.kind), { cache: "no-store" })
|
|
88
|
+
.then((r) => r.json())
|
|
89
|
+
.then((v) => {
|
|
90
|
+
if (v.error) throw new Error(v.error);
|
|
91
|
+
const words = String(v.composed ?? "").split(/\s+/).filter(Boolean).length;
|
|
92
|
+
summary.textContent = "The " + o.kind + " prompt as it is today · " + words.toLocaleString() + " words";
|
|
93
|
+
text.textContent = v.composed ?? "";
|
|
94
|
+
})
|
|
95
|
+
.catch((e) => {
|
|
96
|
+
text.textContent = String(e.message || e);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const answer = el("textarea", { className: "pastebox", rows: 8, placeholder: "Paste its whole reply here." });
|
|
100
|
+
const check = el("button", { className: "btn", textContent: "Check the answer" });
|
|
101
|
+
const result = el("div", { className: "pasteresult" });
|
|
102
|
+
check.onclick = async () => {
|
|
103
|
+
if (!answer.value.trim()) return;
|
|
104
|
+
result.replaceChildren(el("p", { className: "sub", textContent: "Reading…" }));
|
|
105
|
+
try {
|
|
106
|
+
const data = await post({ staff: o.handle, kind: o.kind, answer: answer.value }, "/api/amend/check");
|
|
107
|
+
showPasteResult(result, data, answer.value, () => {});
|
|
108
|
+
} catch (e) {
|
|
109
|
+
result.replaceChildren(el("p", { className: "err", textContent: String(e.message || e) }));
|
|
68
110
|
}
|
|
69
|
-
}
|
|
111
|
+
};
|
|
112
|
+
body.append(
|
|
113
|
+
el("label", { className: "amendlabel", textContent: "3. Paste its reply" }),
|
|
114
|
+
answer,
|
|
115
|
+
el("div", { className: "row" }, [check]),
|
|
116
|
+
result,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const box = sheet({ node: body, side: true });
|
|
120
|
+
if (box) x.onclick = () => box.close();
|
|
121
|
+
return { box, body, want };
|
|
70
122
|
}
|
|
71
123
|
|
|
72
124
|
export function viewPrompt(m) {
|
|
@@ -90,7 +142,7 @@ export function viewPrompt(m) {
|
|
|
90
142
|
};
|
|
91
143
|
/* The point of the screen: you can see the prompt, and you can get help changing it
|
|
92
144
|
without first working out which of eight files to open. */
|
|
93
|
-
const help = el("button", { className: "ghbtn primary", textContent: "
|
|
145
|
+
const help = el("button", { className: "ghbtn primary", textContent: "Change this with your AI" });
|
|
94
146
|
help.onclick = () => copyAmend("");
|
|
95
147
|
const copy = el("button", { className: "ghbtn", textContent: "Copy the prompt" });
|
|
96
148
|
copy.onclick = () => {
|
|
@@ -99,7 +151,7 @@ export function viewPrompt(m) {
|
|
|
99
151
|
const note = el("span", { className: "meta" });
|
|
100
152
|
m.append(el("div", { className: "row", style: "margin-bottom:16px" }, [kind, help, copy, note]));
|
|
101
153
|
|
|
102
|
-
const copyAmend = (want
|
|
154
|
+
const copyAmend = (want) => amendSheet({ handle: s.handle, name: s.name, kind: S.promptKind, want });
|
|
103
155
|
|
|
104
156
|
const split = el("div", { className: "split" });
|
|
105
157
|
const tree = el("div", { className: "tree" });
|
|
@@ -351,8 +403,10 @@ export function viewPrompt(m) {
|
|
|
351
403
|
);
|
|
352
404
|
|
|
353
405
|
const ta = el("textarea", { value: text, className: "editor" });
|
|
354
|
-
|
|
406
|
+
const hl = highlighted(ta, "md");
|
|
407
|
+
viewer.append(hl);
|
|
355
408
|
grow(ta);
|
|
409
|
+
hl.repaint();
|
|
356
410
|
ta.addEventListener("input", () => grow(ta));
|
|
357
411
|
|
|
358
412
|
const status = el("span", { className: "meta" });
|
|
@@ -13,16 +13,16 @@ import { el } from "../dom.js";
|
|
|
13
13
|
* org.yaml already lists is read off disk, which is how the Org screen uses it long after setup.
|
|
14
14
|
*/
|
|
15
15
|
export function repoPicker(opts) {
|
|
16
|
-
const box = el("div", { className: "manual" });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
const box = el("div", { className: opts.bare ? "" : "manual" });
|
|
17
|
+
if (!opts.bare) {
|
|
18
|
+
box.append(
|
|
19
|
+
el("b", { textContent: "Which repos the staff work in" }),
|
|
20
|
+
el("p", {
|
|
21
|
+
textContent:
|
|
22
|
+
"Add the repos your staff should work on. New hires get access to them automatically.",
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
const out = el("div", { style: "margin-top:9px" });
|
|
28
28
|
box.append(out);
|
|
@@ -18,7 +18,7 @@ export function viewRuns(m) {
|
|
|
18
18
|
className: "sub",
|
|
19
19
|
textContent:
|
|
20
20
|
"What each staff member ran in the last 30 days, how it ended, and what it cost where " +
|
|
21
|
-
"the agent said.
|
|
21
|
+
"the agent said.",
|
|
22
22
|
}),
|
|
23
23
|
);
|
|
24
24
|
|
|
@@ -29,6 +29,11 @@ export function viewRuns(m) {
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
paint(m, S.runs);
|
|
32
|
+
/* Kept for the session, it could be days old: a tab opened during a rate limit went on
|
|
33
|
+
showing a two-week-old list. Anything older than a few minutes is asked for again. */
|
|
34
|
+
// Only a read with a time on it can be old, and only one re-read is asked for at a time.
|
|
35
|
+
const at = S.runs.fetchedAt ? new Date(S.runs.fetchedAt).getTime() : 0;
|
|
36
|
+
if (at && Date.now() - at > 5 * 60_000 && !asking) load(true);
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
let asking = false;
|
|
@@ -57,9 +62,7 @@ function paint(m, data) {
|
|
|
57
62
|
if (!data.online) {
|
|
58
63
|
const box = el("div", { className: "notice" });
|
|
59
64
|
box.innerHTML =
|
|
60
|
-
"<b>
|
|
61
|
-
esc(data.error ?? "gh is unavailable") +
|
|
62
|
-
"<br>Everything else in the portal reads from disk and still works.";
|
|
65
|
+
"<b>GitHub could not be reached.</b><br>" + esc(data.error ?? "No answer from GitHub.");
|
|
63
66
|
m.append(box, el("div", { className: "row hacts" }, [again]));
|
|
64
67
|
return;
|
|
65
68
|
}
|
|
@@ -72,6 +75,20 @@ function paint(m, data) {
|
|
|
72
75
|
g.append(tile("Runs", String(data.spend?.runs ?? 0), "skipped mentions are not counted"));
|
|
73
76
|
m.append(g);
|
|
74
77
|
|
|
78
|
+
/* The table shows at once with the costs already known; the rest are read from GitHub in the
|
|
79
|
+
background, and the screen asks again until they are all in. */
|
|
80
|
+
if (data.pending) {
|
|
81
|
+
m.append(
|
|
82
|
+
el("p", {
|
|
83
|
+
className: "hnote",
|
|
84
|
+
textContent: "Reading the cost of " + data.pending + " run" + (data.pending === 1 ? "" : "s") + " from GitHub…",
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
if (S.view === "runs") load(true);
|
|
89
|
+
}, 3000);
|
|
90
|
+
}
|
|
91
|
+
|
|
75
92
|
for (const s of data.staff ?? []) m.append(...staffSection(s));
|
|
76
93
|
|
|
77
94
|
m.append(
|