@nanocollective/roster 0.1.0-beta.3 → 0.1.0-beta.31

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.
Files changed (147) hide show
  1. package/README.md +8 -0
  2. package/dist/agents-POITEZRI.js +232 -0
  3. package/dist/chunk-FF2WBNNW.js +370 -0
  4. package/dist/chunk-GDAJPOHK.js +562 -0
  5. package/dist/cli.js +3391 -1239
  6. package/dist/compose-5DBEHSEV.js +17 -0
  7. package/dist/connectors-5E5ZMGZV.js +23 -0
  8. package/dist/worker/assets/assets/css/astryx.css +948 -0
  9. package/dist/worker/assets/assets/css/base.css +51 -110
  10. package/dist/worker/assets/assets/css/brain.css +28 -2
  11. package/dist/worker/assets/assets/css/connectors.css +58 -0
  12. package/dist/worker/assets/assets/css/graph.css +9 -12
  13. package/dist/worker/assets/assets/css/health.css +4 -7
  14. package/dist/worker/assets/assets/css/home.css +155 -60
  15. package/dist/worker/assets/assets/css/inbox.css +11 -0
  16. package/dist/worker/assets/assets/css/layout.css +18 -22
  17. package/dist/worker/assets/assets/css/markdown.css +22 -1
  18. package/dist/worker/assets/assets/css/routines.css +43 -0
  19. package/dist/worker/assets/assets/css/runs.css +5 -3
  20. package/dist/worker/assets/assets/css/search.css +3 -6
  21. package/dist/worker/assets/assets/css/setup.css +8 -15
  22. package/dist/worker/assets/assets/js/api.js +3 -0
  23. package/dist/worker/assets/assets/js/app.js +28 -1
  24. package/dist/worker/assets/assets/js/astryx-ui.js +34 -0
  25. package/dist/worker/assets/assets/js/dom.js +1 -1
  26. package/dist/worker/assets/assets/js/homesort.js +66 -20
  27. package/dist/worker/assets/assets/js/icons.js +6 -0
  28. package/dist/worker/assets/assets/js/md.js +7 -2
  29. package/dist/worker/assets/assets/js/mention.js +2 -1
  30. package/dist/worker/assets/assets/js/readiness.js +36 -0
  31. package/dist/worker/assets/assets/js/refcard.js +216 -0
  32. package/dist/worker/assets/assets/js/refresh.js +8 -2
  33. package/dist/worker/assets/assets/js/report.js +51 -0
  34. package/dist/worker/assets/assets/js/select.js +362 -0
  35. package/dist/worker/assets/assets/js/state.js +14 -1
  36. package/dist/worker/assets/assets/js/views/connectors.js +428 -0
  37. package/dist/worker/assets/assets/js/views/graph.js +67 -28
  38. package/dist/worker/assets/assets/js/views/health.js +11 -5
  39. package/dist/worker/assets/assets/js/views/home.js +453 -174
  40. package/dist/worker/assets/assets/js/views/inbox.js +82 -17
  41. package/dist/worker/assets/assets/js/views/notready.js +60 -0
  42. package/dist/worker/assets/assets/js/views/org.js +16 -1
  43. package/dist/worker/assets/assets/js/views/people.js +109 -0
  44. package/dist/worker/assets/assets/js/views/routines.js +395 -0
  45. package/dist/worker/assets/assets/js/views/runonce.js +5 -0
  46. package/dist/worker/assets/assets/js/views/runs.js +14 -2
  47. package/dist/worker/assets/assets/js/views/staff.js +18 -3
  48. package/dist/worker/assets/docs-images/brain.jpg +0 -0
  49. package/dist/worker/assets/docs-images/home.jpg +0 -0
  50. package/dist/worker/assets/docs-images/org.jpg +0 -0
  51. package/dist/worker/assets/docs-images/prompt.jpg +0 -0
  52. package/dist/worker/assets/docs-images/setup-org.jpg +0 -0
  53. package/dist/worker/assets/docs-images/setup-plan.jpg +0 -0
  54. package/dist/worker/assets/docs-images/staff.jpg +0 -0
  55. package/dist/worker/assets/index.html +19 -3
  56. package/dist/worker/index.js +4478 -1098
  57. package/docs/README.md +2 -0
  58. package/docs/architecture.md +23 -4
  59. package/docs/commands.md +111 -9
  60. package/docs/concepts.md +2 -1
  61. package/docs/connectors.md +169 -0
  62. package/docs/cost.md +1 -1
  63. package/docs/developing.md +3 -3
  64. package/docs/doctor-codes.md +8 -2
  65. package/docs/export.md +4 -3
  66. package/docs/extending.md +1 -1
  67. package/docs/getting-started.md +20 -3
  68. package/docs/hosting.md +67 -3
  69. package/docs/images/brain.jpg +0 -0
  70. package/docs/images/home.jpg +0 -0
  71. package/docs/images/org.jpg +0 -0
  72. package/docs/images/prompt.jpg +0 -0
  73. package/docs/images/setup-org.jpg +0 -0
  74. package/docs/images/setup-plan.jpg +0 -0
  75. package/docs/images/staff.jpg +0 -0
  76. package/docs/memory.md +3 -2
  77. package/docs/org-yaml.md +58 -5
  78. package/docs/portal.md +52 -11
  79. package/docs/prompts.md +3 -2
  80. package/docs/routines.md +65 -0
  81. package/docs/security.md +37 -4
  82. package/docs/session-workflow.md +31 -8
  83. package/docs/staff-yaml.md +7 -3
  84. package/docs/troubleshooting.md +1 -1
  85. package/docs/upgrading.md +1 -1
  86. package/docs/writing-a-charter.md +1 -1
  87. package/package.json +8 -1
  88. package/templates/brain/.gitattributes +3 -0
  89. package/templates/brain/.github/workflows/%%STAFF%%-daily.yaml +24 -15
  90. package/templates/brain/.github/workflows/%%STAFF%%-mention.yaml +12 -10
  91. package/templates/brain/CHARTER.md +2 -2
  92. package/templates/brain/STATE.md +16 -0
  93. package/templates/brain/memory/INDEX.md +1 -1
  94. package/templates/brain/staff.yaml +3 -0
  95. package/templates/ops/.gitattributes +3 -0
  96. package/templates/ops/.github/workflows/session.yaml +92 -13
  97. package/templates/ops/agents.mjs +38 -11
  98. package/templates/ops/compose.mjs +60 -2
  99. package/templates/ops/connectors.mjs +722 -0
  100. package/templates/ops/org/operating.md +10 -0
  101. package/templates/ops/org/voice.md +21 -3
  102. package/templates/ops/prompts/_identity.md +20 -0
  103. package/templates/ops/prompts/daily.md +70 -19
  104. package/templates/ops/prompts/mention.md +7 -2
  105. package/templates/ops/status-week.mjs +169 -0
  106. package/templates/portal/css/astryx.css +948 -0
  107. package/templates/portal/css/base.css +51 -110
  108. package/templates/portal/css/brain.css +28 -2
  109. package/templates/portal/css/connectors.css +58 -0
  110. package/templates/portal/css/graph.css +9 -12
  111. package/templates/portal/css/health.css +4 -7
  112. package/templates/portal/css/home.css +155 -60
  113. package/templates/portal/css/inbox.css +11 -0
  114. package/templates/portal/css/layout.css +18 -22
  115. package/templates/portal/css/markdown.css +22 -1
  116. package/templates/portal/css/routines.css +43 -0
  117. package/templates/portal/css/runs.css +5 -3
  118. package/templates/portal/css/search.css +3 -6
  119. package/templates/portal/css/setup.css +8 -15
  120. package/templates/portal/index.html +19 -3
  121. package/templates/portal/js/api.js +3 -0
  122. package/templates/portal/js/app.js +28 -1
  123. package/templates/portal/js/astryx-ui.js +34 -0
  124. package/templates/portal/js/dom.js +1 -1
  125. package/templates/portal/js/homesort.js +66 -20
  126. package/templates/portal/js/icons.js +6 -0
  127. package/templates/portal/js/md.js +7 -2
  128. package/templates/portal/js/mention.js +2 -1
  129. package/templates/portal/js/readiness.js +36 -0
  130. package/templates/portal/js/refcard.js +216 -0
  131. package/templates/portal/js/refresh.js +8 -2
  132. package/templates/portal/js/report.js +51 -0
  133. package/templates/portal/js/select.js +362 -0
  134. package/templates/portal/js/state.js +14 -1
  135. package/templates/portal/js/views/connectors.js +428 -0
  136. package/templates/portal/js/views/graph.js +67 -28
  137. package/templates/portal/js/views/health.js +11 -5
  138. package/templates/portal/js/views/home.js +453 -174
  139. package/templates/portal/js/views/inbox.js +82 -17
  140. package/templates/portal/js/views/notready.js +60 -0
  141. package/templates/portal/js/views/org.js +16 -1
  142. package/templates/portal/js/views/people.js +109 -0
  143. package/templates/portal/js/views/routines.js +395 -0
  144. package/templates/portal/js/views/runonce.js +5 -0
  145. package/templates/portal/js/views/runs.js +14 -2
  146. package/templates/portal/js/views/staff.js +18 -3
  147. package/templates/skill/SKILL.md +115 -0
@@ -0,0 +1,395 @@
1
+ /* The Routines screen: when each staff member wakes, and what they do then.
2
+ *
3
+ * Every staff member has a daily round. A routine is one more wake-up with its own job: a time,
4
+ * a name, and what to do in the person's own words. Saving writes the staff member's
5
+ * staff.yaml, routines/<id>.md and the daily caller in one commit, as you.
6
+ */
7
+
8
+ import { post } from "../api.js";
9
+ import { sheet } from "../dialog.js";
10
+ import { el, grow } from "../dom.js";
11
+ import { icon } from "../icons.js";
12
+ import { canRun, whatsLeft } from "../readiness.js";
13
+ import { render } from "../router.js";
14
+ import { S } from "../state.js";
15
+ import { commandLine, notReadyNote, whenKnown } from "./notready.js";
16
+
17
+ /* The last answer, so a repaint after Save does not flash an empty screen. */
18
+ let last = null;
19
+
20
+ export function viewRoutines(m) {
21
+ const add = el("button", { className: "ghbtn primary", textContent: "New routine" });
22
+ m.append(el("div", { className: "routhead" }, [el("h1", { textContent: "Routines" }), add]));
23
+ const body = el("div");
24
+ m.append(body);
25
+ if (last) draw(body, last, add);
26
+ else body.append(el("p", { className: "sub", textContent: "Loading…" }));
27
+ fetch("/api/routines")
28
+ .then((r) => r.json())
29
+ .then((d) => {
30
+ if (d.error) throw new Error(d.error);
31
+ last = d;
32
+ body.replaceChildren();
33
+ draw(body, d, add);
34
+ })
35
+ .catch((err) => body.replaceChildren(el("p", { className: "err", textContent: String(err.message || err) })));
36
+ }
37
+
38
+ function draw(body, d, add) {
39
+ add.onclick = () => edit(d, null, null);
40
+ add.disabled = !d.staff.length;
41
+ if (!d.staff.length) {
42
+ body.append(el("p", { className: "sub", textContent: S.hosted ? "Hire a staff member first, on your machine:" : "Hire a staff member first, under Staff." }));
43
+ if (S.hosted) body.append(commandLine("hire cto --apply"));
44
+ return;
45
+ }
46
+ for (const s of d.staff) {
47
+ const list = el("div", { className: "connlist routlist" });
48
+ list.append(dailyRow(s, d));
49
+ for (const r of s.routines) list.append(routineRow(s, r, d));
50
+ const more = el("button", { className: "routadd" }, [icon("plus"), el("span", { textContent: "Add a routine for " + s.name })]);
51
+ more.onclick = () => edit(d, s, null);
52
+ list.append(more);
53
+ // Routines run on the same App and credential as everything else, so they wait on setup too.
54
+ const who = whole(s);
55
+ body.append(el("h2", { className: "connhead", textContent: s.name }), whenKnown(who, () => notReadyNote(who)), list);
56
+ }
57
+ }
58
+
59
+ function dailyRow(s, d) {
60
+ const change = el("button", { className: "ghbtn", textContent: "Change time" });
61
+ change.onclick = () => editDaily(d, s);
62
+ return el("div", { className: "connrow routrow" }, [
63
+ el("span", { className: "connicon" }, [icon("refresh")]),
64
+ el("div", { className: "conntext" }, [
65
+ el("b", { textContent: "Daily round" }),
66
+ el("span", { className: "routwhen", textContent: s.dailyWhen }),
67
+ ]),
68
+ el("div", { className: "row connacts" }, [change]),
69
+ ]);
70
+ }
71
+
72
+ function routineRow(s, r, d) {
73
+ const run = el("button", { className: "ghbtn", textContent: "Run now" });
74
+ run.onclick = () => runNow(s, r, run);
75
+ const who = whole(s);
76
+ whatsLeft(who).then(() => {
77
+ if (canRun(s.handle)) return;
78
+ run.disabled = true;
79
+ run.title = `${s.name} is not set up yet`;
80
+ }, () => {});
81
+ const change = el("button", { className: "ghbtn", textContent: "Edit" });
82
+ change.onclick = () => edit(d, s, r);
83
+ const remove = el("button", { className: "ghbtn", textContent: "Remove" });
84
+ remove.onclick = () => confirmRemove(s, r, remove);
85
+ return el("div", { className: "connrow routrow" }, [
86
+ el("span", { className: "connicon" }, [icon("clock")]),
87
+ el("div", { className: "conntext" }, [
88
+ el("b", { textContent: r.title }),
89
+ el("span", { className: "routwhen", textContent: r.when }),
90
+ r.body ? el("span", { className: "routbody", textContent: r.body }) : null,
91
+ ].filter(Boolean)),
92
+ el("div", { className: "row connacts" }, [run, change, remove]),
93
+ ]);
94
+ }
95
+
96
+ /** The staff member as the org export has them, which is what readiness reads. */
97
+ function whole(s) {
98
+ return (S.data?.staff ?? []).find((x) => x.handle === s.handle) ?? s;
99
+ }
100
+
101
+ async function runNow(s, r, btn) {
102
+ btn.disabled = true;
103
+ btn.textContent = "Starting…";
104
+ try {
105
+ const res = await post({ staff: s.handle, routine: r.id }, "/api/run/start");
106
+ btn.replaceWith(el("a", { className: "ghbtn", href: res.url, target: "_blank", rel: "noopener", textContent: "Started" }));
107
+ } catch (err) {
108
+ btn.disabled = false;
109
+ btn.textContent = "Run now";
110
+ btn.title = String(err.message || err);
111
+ }
112
+ }
113
+
114
+ async function confirmRemove(s, r, btn) {
115
+ if (btn.dataset.sure !== "1") {
116
+ btn.dataset.sure = "1";
117
+ btn.textContent = "Remove " + r.title + "?";
118
+ btn.classList.add("danger");
119
+ return;
120
+ }
121
+ btn.disabled = true;
122
+ btn.textContent = "Removing…";
123
+ try {
124
+ await save(s, s.daily, s.routines.filter((x) => x.id !== r.id));
125
+ last = null;
126
+ render();
127
+ } catch (err) {
128
+ btn.textContent = String(err.message || err);
129
+ }
130
+ }
131
+
132
+ /** One staff member's whole schedule, as the server wants it. */
133
+ function save(s, daily, routines) {
134
+ return post(
135
+ {
136
+ staff: s.handle,
137
+ daily,
138
+ routines: routines.map((r) => ({ id: r.id, title: r.title, body: r.body, schedule: r.schedule })),
139
+ },
140
+ "/api/routines/save",
141
+ );
142
+ }
143
+
144
+ /* --------------------------------- editors --------------------------------- */
145
+
146
+ function edit(d, s, r) {
147
+ let box = null;
148
+ const node = routineForm(d, s, r, () => box?.close());
149
+ box = sheet({ node, onClose: () => {} });
150
+ if (!box) document.querySelector("#main")?.append(node);
151
+ }
152
+
153
+ function editDaily(d, s) {
154
+ let box = null;
155
+ const close = () => box?.close();
156
+ const out = el("div", { className: "routform" });
157
+ out.append(el("h2", { className: "sheettitle", textContent: s.name + "'s daily round" }));
158
+ const when = whenField(s.daily);
159
+ out.append(when.node);
160
+ const status = el("div");
161
+ const ok = el("button", { className: "ghbtn primary", textContent: "Save" });
162
+ const cancel = el("button", { className: "ghbtn", textContent: "Cancel" });
163
+ cancel.onclick = close;
164
+ ok.onclick = async () => {
165
+ ok.disabled = true;
166
+ ok.textContent = "Saving…";
167
+ try {
168
+ await save(s, when.value(), s.routines);
169
+ last = null;
170
+ close();
171
+ render();
172
+ } catch (err) {
173
+ ok.disabled = false;
174
+ ok.textContent = "Save";
175
+ status.replaceChildren(el("p", { className: "err", textContent: String(err.message || err) }));
176
+ }
177
+ };
178
+ out.append(status, el("div", { className: "row connfoot" }, [ok, cancel]));
179
+ box = sheet({ node: out, onClose: () => {} });
180
+ if (!box) document.querySelector("#main")?.append(out);
181
+ }
182
+
183
+ function routineForm(d, s, r, close) {
184
+ const out = el("div", { className: "routform" });
185
+ out.append(el("h2", { className: "sheettitle", textContent: r ? r.title : "New routine" }));
186
+
187
+ let who = s ?? d.staff[0];
188
+ const pick = el("div", { className: "routwho" });
189
+ if (!r) {
190
+ for (const p of d.staff) {
191
+ const chip = el("button", { className: "routchip" + (p === who ? " on" : ""), textContent: p.name, type: "button" });
192
+ chip.onclick = () => {
193
+ who = p;
194
+ for (const c of pick.children) c.classList.toggle("on", c === chip);
195
+ say();
196
+ };
197
+ pick.append(chip);
198
+ }
199
+ out.append(field("Who", pick));
200
+ }
201
+
202
+ const name = el("input", { type: "text", value: r?.title ?? "", placeholder: "Monday plan", spellcheck: true });
203
+ out.append(field("Name", name));
204
+
205
+ const when = whenField(r?.schedule ?? "0 9 * * 1");
206
+ out.append(when.node);
207
+
208
+ const todo = el("textarea", {
209
+ className: "routtodo",
210
+ value: r?.body ?? "",
211
+ rows: 8,
212
+ placeholder: "Plan the week. Read last week's status issue and this month's priorities, then open one issue per thing to ship this week, ranked.",
213
+ });
214
+ out.append(field("What to do", todo));
215
+
216
+ const preview = el("div", { className: "routpreview" });
217
+ out.append(preview);
218
+ const say = () => {
219
+ const text = todo.value.trim();
220
+ preview.replaceChildren(
221
+ el("span", { className: "connicon" }, [icon("clock")]),
222
+ el("div", {}, [
223
+ el("b", { textContent: describe(when.value()) + ", " + who.name + " wakes up and:" }),
224
+ el("p", { textContent: text || "…" }),
225
+ ]),
226
+ );
227
+ };
228
+ name.oninput = say;
229
+ todo.oninput = () => {
230
+ grow(todo);
231
+ say();
232
+ };
233
+ when.onchange(say);
234
+ say();
235
+
236
+ const status = el("div");
237
+ const ok = el("button", { className: "ghbtn primary", textContent: "Save" });
238
+ const cancel = el("button", { className: "ghbtn", textContent: "Cancel" });
239
+ cancel.onclick = close;
240
+ ok.onclick = async () => {
241
+ const next = { id: r?.id, title: name.value.trim(), body: todo.value, schedule: when.value() };
242
+ if (!next.title) return status.replaceChildren(el("p", { className: "err", textContent: "Give it a name." }));
243
+ if (!next.body.trim()) return status.replaceChildren(el("p", { className: "err", textContent: "Say what to do." }));
244
+ ok.disabled = true;
245
+ ok.textContent = "Saving…";
246
+ try {
247
+ const routines = r ? who.routines.map((x) => (x.id === r.id ? next : x)) : [...who.routines, next];
248
+ await save(who, who.daily, routines);
249
+ last = null;
250
+ close();
251
+ render();
252
+ } catch (err) {
253
+ ok.disabled = false;
254
+ ok.textContent = "Save";
255
+ status.replaceChildren(el("p", { className: "err", textContent: String(err.message || err) }));
256
+ }
257
+ };
258
+ out.append(status, el("div", { className: "row connfoot" }, [ok, cancel]));
259
+ return out;
260
+ }
261
+
262
+ function field(label, control) {
263
+ return el("div", { className: "field routfield" }, [el("span", { textContent: label }), control]);
264
+ }
265
+
266
+ /* --------------------------------- the time --------------------------------- */
267
+
268
+ const DAYS = [
269
+ ["1", "Mon"],
270
+ ["2", "Tue"],
271
+ ["3", "Wed"],
272
+ ["4", "Thu"],
273
+ ["5", "Fri"],
274
+ ["6", "Sat"],
275
+ ["0", "Sun"],
276
+ ];
277
+
278
+ /**
279
+ * When, as days and a time, or a day of the month, rather than as cron. The value is still a
280
+ * cron, because that is what goes in the workflow. A cron the picker cannot show is kept as
281
+ * typed, in a box of its own.
282
+ */
283
+ function whenField(cron) {
284
+ const parsed = parseCron(cron);
285
+ const listeners = [];
286
+ const changed = () => {
287
+ for (const f of listeners) f();
288
+ said.textContent = describe(value()) + local(time.value);
289
+ };
290
+
291
+ const repeat = el("select");
292
+ repeat.append(
293
+ el("option", { value: "week", textContent: "Days of the week" }),
294
+ el("option", { value: "month", textContent: "Day of the month" }),
295
+ el("option", { value: "cron", textContent: "Cron" }),
296
+ );
297
+ repeat.value = parsed.kind;
298
+
299
+ const days = new Set(parsed.days);
300
+ const dayRow = el("div", { className: "routdays" });
301
+ for (const [v, label] of DAYS) {
302
+ const chip = el("button", { className: "routchip" + (days.has(v) ? " on" : ""), textContent: label, type: "button" });
303
+ chip.onclick = () => {
304
+ days.has(v) ? days.delete(v) : days.add(v);
305
+ chip.classList.toggle("on", days.has(v));
306
+ changed();
307
+ };
308
+ dayRow.append(chip);
309
+ }
310
+ const dom = el("input", { type: "number", min: "1", max: "28", value: String(parsed.dom), style: "width:80px" });
311
+ const time = el("input", { type: "time", step: "60", value: parsed.time, style: "width:130px" });
312
+ const raw = el("input", { type: "text", value: cron, spellcheck: false, placeholder: "0 9 * * 1" });
313
+ const said = el("small", { className: "routsaid" });
314
+
315
+ const domRow = el("div", { className: "row" }, [el("span", { className: "meta", textContent: "Day" }), dom]);
316
+ const timeRow = el("div", { className: "row" }, [time, el("span", { className: "meta", textContent: "UTC" })]);
317
+ const show = () => {
318
+ dayRow.hidden = repeat.value !== "week";
319
+ domRow.hidden = repeat.value !== "month";
320
+ timeRow.hidden = repeat.value === "cron";
321
+ raw.hidden = repeat.value !== "cron";
322
+ };
323
+ repeat.onchange = () => {
324
+ show();
325
+ changed();
326
+ };
327
+ for (const input of [dom, time, raw]) input.oninput = changed;
328
+
329
+ function value() {
330
+ if (repeat.value === "cron") return raw.value.trim();
331
+ const [h, m] = (time.value || "09:00").split(":").map(Number);
332
+ if (repeat.value === "month") return `${m} ${h} ${Math.min(28, Math.max(1, Number(dom.value) || 1))} * *`;
333
+ const picked = DAYS.map(([v]) => v).filter((v) => days.has(v));
334
+ return `${m} ${h} * * ${dayList(picked)}`;
335
+ }
336
+
337
+ show();
338
+ said.textContent = describe(value()) + local(time.value);
339
+ const node = el("div", { className: "field routfield" }, [
340
+ el("span", { textContent: "When" }),
341
+ el("div", { className: "routwhenpick" }, [repeat, dayRow, domRow, timeRow, raw, said]),
342
+ ]);
343
+ return { node, value, onchange: (f) => listeners.push(f) };
344
+ }
345
+
346
+ /** Days for cron, in its own short forms where there is one. */
347
+ function dayList(picked) {
348
+ const set = new Set(picked);
349
+ if (set.size === 0 || set.size === 7) return "*";
350
+ if (set.size === 5 && ["1", "2", "3", "4", "5"].every((d) => set.has(d))) return "1-5";
351
+ return [...set].map(Number).sort((a, b) => a - b).join(",");
352
+ }
353
+
354
+ export function parseCron(cron) {
355
+ const [min, hour, dom, mon, dow] = String(cron).trim().split(/\s+/);
356
+ const plain = /^\d+$/.test(min ?? "") && /^\d+$/.test(hour ?? "") && mon === "*";
357
+ const time = plain ? `${hour.padStart(2, "0")}:${min.padStart(2, "0")}` : "09:00";
358
+ if (plain && dom === "*") {
359
+ const days =
360
+ dow === "*" ? ["0", "1", "2", "3", "4", "5", "6"] : dow === "1-5" ? ["1", "2", "3", "4", "5"] : /^[0-6](,[0-6])*$/.test(dow) ? dow.split(",") : null;
361
+ if (days) return { kind: "week", days, time, dom: 1 };
362
+ }
363
+ if (plain && /^\d+$/.test(dom ?? "") && dow === "*") return { kind: "month", days: ["1"], time, dom: Number(dom) };
364
+ return { kind: "cron", days: ["1"], time, dom: 1 };
365
+ }
366
+
367
+ const DAY_NAME = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
368
+
369
+ /** The same words the server gives a schedule, so the preview and the list agree. */
370
+ export function describe(cron) {
371
+ const p = parseCron(cron);
372
+ const at = "at " + p.time + " UTC";
373
+ if (p.kind === "month") return `On the ${ordinal(p.dom)} of each month ${at}`;
374
+ if (p.kind === "cron") return cron || "No time yet";
375
+ const d = cron.trim().split(/\s+/)[4];
376
+ if (d === "*") return "Every day " + at;
377
+ if (d === "1-5") return "Weekdays " + at;
378
+ if (d === "0,6" || d === "6,0") return "Weekends " + at;
379
+ const names = p.days.map((x) => DAY_NAME[Number(x)] + "s");
380
+ return (names.length > 1 ? names.slice(0, -1).join(", ") + " and " + names.at(-1) : names[0]) + " " + at;
381
+ }
382
+
383
+ function ordinal(n) {
384
+ const tens = n % 100;
385
+ return n + (tens >= 11 && tens <= 13 ? "th" : (["th", "st", "nd", "rd"][n % 10] ?? "th"));
386
+ }
387
+
388
+ /** What that UTC time is where the person reading it is, when the two differ. */
389
+ function local(hhmm) {
390
+ if (!hhmm) return "";
391
+ const [h, m] = hhmm.split(":").map(Number);
392
+ const at = new Date(Date.UTC(2026, 0, 5, h, m));
393
+ const here = at.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" });
394
+ return here === hhmm ? "" : " · " + here + " where you are";
395
+ }
@@ -7,6 +7,8 @@
7
7
  import { runStatus, startRun } from "../api.js";
8
8
  import { askYes } from "../dialog.js";
9
9
  import { el } from "../dom.js";
10
+ import { whatsLeft } from "../readiness.js";
11
+ import { S } from "../state.js";
10
12
 
11
13
  /**
12
14
  * @param {{staff: string, name: string, onDone?: (ok: boolean) => void}} opts
@@ -86,6 +88,9 @@ export function runOnce(opts) {
86
88
  for (const f of now.failedAt ?? []) done.append(el("p", { className: "sub", textContent: "Failed at " + f }));
87
89
  if (!ok) done.append(el("p", { className: "sub", textContent: "Troubleshooting, in the docs, has what each failure usually means." }));
88
90
  out.replaceChildren(done);
91
+ // "Run once" is done now, and every screen that said otherwise should stop saying it.
92
+ const who = (S.data?.staff ?? []).find((x) => x.handle === opts.staff);
93
+ if (ok && who) whatsLeft(who, true).catch(() => {});
89
94
  opts.onDone?.(ok);
90
95
  };
91
96
  tick();
@@ -7,6 +7,7 @@ import { getRuns } from "../api.js";
7
7
  import { ago, el, esc, skeleton } from "../dom.js";
8
8
  import { render } from "../router.js";
9
9
  import { S } from "../state.js";
10
+ import { notReadyNote, whenKnown } from "./notready.js";
10
11
 
11
12
  /** How many runs a staff member's table shows. The spend covers all of the last 30 days. */
12
13
  const SHOWN = 15;
@@ -89,6 +90,9 @@ function paint(m, data) {
89
90
  }, 3000);
90
91
  }
91
92
 
93
+ if (!(data.staff ?? []).length) {
94
+ m.append(el("p", { className: "hnote", textContent: "Nobody hired yet, so nothing has run. Home says what is left." }));
95
+ }
92
96
  for (const s of data.staff ?? []) m.append(...staffSection(s));
93
97
 
94
98
  m.append(
@@ -111,7 +115,13 @@ function staffSection(s) {
111
115
  const body = el("div", { className: "hbody runs" });
112
116
  for (const e of s.errors ?? []) body.append(el("p", { className: "hnote err", textContent: e }));
113
117
  if (!(s.runs ?? []).length) {
114
- body.append(el("p", { className: "hnote", textContent: "No runs in the last 30 days." }));
118
+ // "No runs" read as idle, when the truth was that they could not run at all.
119
+ const who = (S.data?.staff ?? []).find((x) => x.handle === s.handle) ?? s;
120
+ body.append(
121
+ whenKnown(who, () =>
122
+ notReadyNote(who) ?? el("p", { className: "hnote", textContent: "No runs in the last 30 days." }),
123
+ ),
124
+ );
115
125
  return [head, body];
116
126
  }
117
127
 
@@ -142,7 +152,9 @@ function row(r) {
142
152
  tr.innerHTML =
143
153
  '<td title="' + esc(r.createdAt) + '">' + esc(ago(r.createdAt)) + "</td>" +
144
154
  "<td>" + esc(r.kind) + "</td>" +
145
- '<td><span class="chip ' + out.tone + '">' + esc(out.word) + "</span></td>" +
155
+ (out.tone === "ok"
156
+ ? '<td><span class="runok"><i></i>' + esc(out.word) + "</span></td>"
157
+ : '<td><span class="chip ' + out.tone + '">' + esc(out.word) + "</span></td>") +
146
158
  "<td>" + (mins != null ? Math.round(mins) + "m" : "–") + "</td>" +
147
159
  "<td>" + (rec.turns ?? "–") + "</td>" +
148
160
  "<td>" + (typeof rec.cost_usd === "number" ? "$" + rec.cost_usd.toFixed(2) : "–") + "</td>" +
@@ -9,10 +9,11 @@ import { post } from "../api.js";
9
9
  import { askYes, sheet } from "../dialog.js";
10
10
  import { pending } from "../inflight.js";
11
11
  import { ago, el, esc } from "../dom.js";
12
- import { sentence, staffProgress, whatsLeft } from "../readiness.js";
12
+ import { sentence, staffProgress, stepCommand, whatsLeft } from "../readiness.js";
13
13
  import { refreshAll } from "../refresh.js";
14
14
  import { S } from "../state.js";
15
15
  import { hireFlow, line, rolePicker } from "./hire.js";
16
+ import { commandLine } from "./notready.js";
16
17
 
17
18
  /**
18
19
  * Resolves once nothing is loading and `node` has stopped changing for a moment, or after a few
@@ -50,7 +51,15 @@ let current = null;
50
51
  export function viewStaff(m, o = {}) {
51
52
  m.append(el("h1", { textContent: "Staff" }));
52
53
  const empty = !S.data.staff.length;
53
- if (empty) m.append(el("p", { className: "sub", textContent: "No staff yet. Pick a role to hire your first." }));
54
+ /* Hosted, the picker led to a hire that only the server on your machine can do, and it
55
+ failed there. The command is the way in. */
56
+ if (empty && S.hosted) {
57
+ m.append(
58
+ el("p", { className: "sub", textContent: "No staff yet. Hiring creates repos and an App, so it is done on your machine:" }),
59
+ commandLine("hire cto --apply"),
60
+ el("p", { className: "sub", textContent: "cmo and support are the other roles, or any handle with --name." }),
61
+ );
62
+ } else if (empty) m.append(el("p", { className: "sub", textContent: "No staff yet. Pick a role to hire your first." }));
54
63
 
55
64
  const pane = el("div", { className: "hirepane" });
56
65
 
@@ -83,7 +92,7 @@ export function viewStaff(m, o = {}) {
83
92
  if (current) current.close();
84
93
  else pane.replaceChildren();
85
94
  S.staffOpen = null;
86
- if (empty) pick();
95
+ if (empty && !S.hosted) pick();
87
96
  }
88
97
 
89
98
  // With nobody hired the roles are the page. After that they are a dialog behind Hire someone.
@@ -196,6 +205,12 @@ export function viewStaff(m, o = {}) {
196
205
  warn.textContent =
197
206
  "Not ready to run. " + (p ? `${p.done} of ${p.total} done. ` : "") +
198
207
  "Still to do: " + sentence(left) + ".";
208
+ // Hosted has no Finish setting up, so each step comes with what to run instead.
209
+ if (S.hosted) {
210
+ const cmds = [...new Set(left.map((x) => stepCommand(x, s.handle)).filter(Boolean))];
211
+ warn.classList.add("notready");
212
+ warn.replaceChildren(el("span", { textContent: warn.textContent }), ...cmds.map(commandLine));
213
+ }
199
214
  });
200
215
  d.append(warn);
201
216
 
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: roster
3
+ description: >
4
+ Set up and run Roster, an organisation run by AI staff who live in GitHub. Use this when the
5
+ person asks to set up Roster, hire AI staff (a CTO, a CMO, support), add a staff member, or
6
+ check on, talk to or fix their Roster org. Setup creates a GitHub org's ops repo, hires staff
7
+ whose brains are repos and who run on GitHub Actions, writes the business and priorities with
8
+ the person, and opens the portal where they talk to their staff.
9
+ ---
10
+
11
+ # Roster
12
+
13
+ Roster runs an organisation on AI staff. Each staff member is a repo (their brain: charter,
14
+ memory, workflows) and a GitHub App (their identity). They run on GitHub Actions on a schedule,
15
+ wake when someone @mentions them, and message each other through issues. The person talks to
16
+ them in the Roster portal.
17
+
18
+ Pasting this file means the person wants Roster set up on this machine, and has authorised the
19
+ setup commands below. If your runtime asks permission for shell commands, ask once and work
20
+ straight through.
21
+
22
+ ## Check where you are first
23
+
24
+ - **A hosted chat** (claude.ai, ChatGPT, Gemini, even with a code sandbox): it runs in the
25
+ provider's cloud, not on the person's machine, and Roster needs their own `gh` and a local
26
+ checkout. Do not install anything. Tell them to paste the same line into a coding agent on
27
+ their computer (Claude Code, Codex, Cursor, Gemini CLI), then stop.
28
+ - **A coding agent on their machine**: continue.
29
+
30
+ Never ask the person to paste a token, key or password into the chat. Every credential goes in
31
+ through their own terminal.
32
+
33
+ ## Install
34
+
35
+ ```sh
36
+ roster --version 2>/dev/null || npm install -g @nanocollective/roster@latest
37
+ roster skill install
38
+ ```
39
+
40
+ Roster needs Node 20 or later and the GitHub CLI (`gh`). If `gh` is missing, install it
41
+ (`brew install gh` on a Mac; otherwise https://cli.github.com). `roster skill install` saves this
42
+ file for the coding agents it finds, so future sessions know Roster without being told.
43
+
44
+ Work in the directory the person wants their Roster workspace in. Ask if it is not obvious;
45
+ their home directory or a projects folder is usual, and their product's own repo is not.
46
+
47
+ ## Setup is one loop
48
+
49
+ ```sh
50
+ roster setup --json
51
+ ```
52
+
53
+ It reads GitHub and the disk and returns every step, whether each is done, and `next`: the one
54
+ thing to do now. Do `next`, then run `roster setup --json` again. Repeat until `ready` is true.
55
+ It is always safe to run again; it stores nothing.
56
+
57
+ Each step has:
58
+
59
+ - `who: "agent"`: run `command` yourself. Where it says `confirm: true`, ask the person first:
60
+ the step decides something about their business or costs money.
61
+ - `who: "human"`: something only they can do (sign in, confirm on GitHub, paste a credential in
62
+ their own terminal). Give them `do` and `command` exactly, then wait for them to say it is done.
63
+ - `do`: what the step needs, in words you can pass on as they stand.
64
+
65
+ Rules for the loop:
66
+
67
+ - **Do not skip ahead or reorder.** Each step needs the ones before it.
68
+ - **Do not reword the questions.** The briefs Roster prints (`roster brief discover`,
69
+ `roster brief priorities`, `roster brief charter <handle>`) carry the questions. Follow the
70
+ brief: read what you can about their project first, then ask its questions one at a time, in
71
+ its order, and write the file it asks for. Show the person the file before you commit it.
72
+ - **These files are the point.** `org/business.md`, `org/priorities.md` and each `CHARTER.md`
73
+ are what make the staff useful rather than generic. Do not fill them from guesses to get
74
+ through setup faster; ask.
75
+ - **Commands that wait for a browser** (`roster app`): run them in the background, relay the
76
+ link they print, keep reading their output, and relay the install link that follows.
77
+ - **Plans before changes.** `init`, `hire`, `app`, `credential` and `run` print a plan without
78
+ `--apply`. Where a step has `confirm: true`, show the person the plan, then run it again with
79
+ `--apply`.
80
+
81
+ If a command fails, read its output: it says what is wrong and usually the command that fixes
82
+ it. `roster doctor` checks the whole org and gives a fix for every finding. Do not retry the
83
+ same failing command in a loop.
84
+
85
+ ## When setup is done
86
+
87
+ Start the portal in the background and give the person its address:
88
+
89
+ ```sh
90
+ roster --no-open
91
+ ```
92
+
93
+ It prints a localhost URL (4300 unless that is taken). Then, in a few sentences: their staff are
94
+ hired and have run once, they run on their own each day and when @mentioned, and the portal's
95
+ Home is where staff ask them things. Routines, in the portal, wake them at more times. Offer three things they could ask their first staff
96
+ member, based on what you learned about their business in the interview.
97
+
98
+ Do not report versions, paths or package-manager output. Report what is working and what, if
99
+ anything, is left.
100
+
101
+ ## After setup
102
+
103
+ | To | Run |
104
+ |---|---|
105
+ | See where setup is | `roster setup` |
106
+ | Open the portal | `roster` |
107
+ | Check everything is wired up | `roster doctor` |
108
+ | Every problem, as one brief to fix | `roster fix` |
109
+ | Hire another staff member | `roster hire <handle> --name "<role>"` then `roster app <handle>` |
110
+ | Start a run now | `roster run <handle> --apply` |
111
+ | Wake them at more times, each with its own job | `roster routine <handle> add --name "<name>" --at "<cron, UTC>" --do "<what to do>" --apply` |
112
+ | Give staff an outside service | `roster connector` |
113
+ | Take framework updates | `npm install -g @nanocollective/roster@latest && roster upgrade --apply` |
114
+
115
+ Docs: https://roster.nanocollective.org/docs/