@nanocollective/roster 0.1.0-beta.24 → 0.1.0-beta.26

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.
@@ -114,7 +114,19 @@ other key.
114
114
 
115
115
  ## A service that is not in the catalogue
116
116
 
117
- Write it out in `org.yaml`, with a `url` or a `command`, and the names of the keys it needs:
117
+ On the Connectors screen, pick **Custom server** and give it a name and its MCP URL (https).
118
+ Then choose how it signs in:
119
+
120
+ - **Key**: a header name (`Authorization` unless you change it) and its value, for example
121
+ `Bearer sk_…`. The value is stored as the secret `CONNECTOR_<NAME>_TOKEN`.
122
+ - **Sign in**: on the hosted portal, for a server that signs in with a browser the way Notion
123
+ does. It has to let a new app register itself, as MCP servers that sign in usually do.
124
+ - **No key**: for a server that needs none.
125
+
126
+ Read only cannot be enforced on a server roster has no entry for, so give it a key that can only
127
+ read if that is what you want.
128
+
129
+ A server run as a command, or one with more than one key, is written out in `org.yaml`, with a `url` or a `command`, and the names of the keys it needs:
118
130
 
119
131
  ```yaml
120
132
  connectors:
package/docs/hosting.md CHANGED
@@ -67,8 +67,21 @@ CMO to draft this week's post". The tools:
67
67
  | `reply` | A reply as you, optionally closing the issue |
68
68
  | `ask_staff` | A new issue on a staff member's tracker with their mention, which starts them |
69
69
  | `ask_for_report` | Asks a staff member to bring their report up to date now |
70
+ | `list_issues` | Open issues and pull requests, by staff member, repo, kind or label |
71
+ | `run` | Starts a staff member's session now, or one of their routines |
72
+ | `runs` | Recent runs: how each went, how long, what it cost, and its log |
70
73
  | `read_brain` | `STATE.md`, `CHARTER.md`, `memory/INDEX.md`, `log/decisions.md` or `staff.yaml` |
71
74
 
75
+ The Connectors screen has the line to paste for Claude Code, Codex and Claude, under **Connect
76
+ your own agent**. From Claude Code:
77
+
78
+ ```bash
79
+ claude mcp add --transport http roster-acme https://roster.acme.com/mcp
80
+ ```
81
+
82
+ then `/mcp` to sign in. With more than one Roster, give each its own name (`roster-acme`,
83
+ `roster-globex`): an agent keeps each server's tools apart by that name.
84
+
72
85
  It cannot merge, approve, hire, or change the org: those stay on Home, where you see the diff
73
86
  or the plan first. Everything it posts is posted as you.
74
87
 
@@ -105,6 +118,9 @@ and commits two files to the ops repo:
105
118
  - `portal/wrangler.jsonc`: the Worker's name, the domain, the org. Nothing secret.
106
119
  - `.github/workflows/portal.yaml`: redeploys it.
107
120
 
121
+ To show your own icon on the sign-in page and in the portal, commit a square image as
122
+ `portal/icon.png` (or `.svg`, `.jpg`, `.webp`). The push redeploys the portal with it.
123
+
108
124
  ## Keeping it up to date
109
125
 
110
126
  The workflow redeploys the portal when its config changes, every morning, and when you run it
package/docs/portal.md CHANGED
@@ -19,6 +19,11 @@ It can also be hosted, on your own URL behind Sign in with GitHub: see [hosting]
19
19
 
20
20
  ## The sidebar
21
21
 
22
+ **Your own icon.** Put a square image in the ops repo at `portal/icon.png` (or `.svg`, `.jpg`,
23
+ `.webp`) and it replaces roster's mark in the sidebar and the browser tab, and on a hosted
24
+ portal's sign-in page. Locally it shows on the next reload; a hosted portal picks it up when it
25
+ redeploys, which a push to `portal/` does.
26
+
22
27
  **Search everything** with ⌘K (Ctrl+K off a Mac), from anywhere, or the Search field at the
23
28
  top of the sidebar, which opens the same dialog. It searches as you type, across:
24
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanocollective/roster",
3
- "version": "0.1.0-beta.24",
3
+ "version": "0.1.0-beta.26",
4
4
  "description": "An agent-run org, powered by GitHub. Scaffold AI staff members whose brain is a repo.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,6 +17,12 @@ h1 + div > .connhead:first-child,h1 + .connerr + div > .connhead:first-child{mar
17
17
  .connacts{margin:0;flex-wrap:nowrap}
18
18
  .connacts .ghbtn.danger{color:var(--err);border-color:color-mix(in srgb,var(--err) 40%,transparent)}
19
19
 
20
+ /* This portal's MCP server, one row per agent: the line to paste and a Copy button. */
21
+ .connmcp{grid-template-columns:minmax(0,1fr) auto}
22
+ .connmcp code{font:12.5px/1.5 var(--mono);color:var(--ink);background:var(--bg);border:1px solid var(--line);
23
+ border-radius:var(--r);padding:6px 9px;overflow-wrap:anywhere;user-select:all}
24
+ .connmcp small{font-size:12px;color:var(--ink-dim)}
25
+
20
26
  .connicon{display:grid;place-items:center;width:32px;height:32px;border-radius:9px;flex:none;
21
27
  background:var(--accent-soft);color:var(--accent);--ic:16px}
22
28
 
@@ -47,4 +53,6 @@ h1 + div > .connhead:first-child,h1 + .connerr + div > .connhead:first-child{mar
47
53
  .connrow{grid-template-columns:32px minmax(0,1fr);row-gap:10px}
48
54
  .connrow > .chip{grid-column:2;justify-self:start}
49
55
  .connacts{grid-column:2}
56
+ .connmcp{grid-template-columns:minmax(0,1fr)}
57
+ .connmcp > .ghbtn{justify-self:start}
50
58
  }
@@ -8,9 +8,9 @@
8
8
  .brand{padding:4px 10px 16px;font:600 15px/1.2 var(--sans);letter-spacing:-.02em;
9
9
  display:grid;grid-template-columns:auto 1fr;column-gap:10px;align-items:center}
10
10
  /* The tab icon, in the corner it belongs in. Drawn rather than fetched so it takes the
11
- theme's accent and costs no request. */
11
+ theme's accent and costs no request, unless the org has its own (app.js, initIcon). */
12
12
  .brand .mark{grid-row:1/3;display:inline-block;width:24px;height:24px;border-radius:7px;
13
- background:var(--accent-fill)}
13
+ background:var(--accent-fill);object-fit:cover}
14
14
  .brand small{display:block;color:var(--ink-faint);font-weight:400;font-size:11.5px;
15
15
  letter-spacing:0;margin-top:2px;overflow:hidden;text-overflow:ellipsis;
16
16
  white-space:nowrap}
@@ -78,6 +78,7 @@ const NAV = [
78
78
 
79
79
  export async function boot() {
80
80
  initTheme();
81
+ initIcon();
81
82
 
82
83
  /* Bound before the first request rather than after it. The sidebar is markup, so it is on
83
84
  screen and clickable while /api/org is still building the export, and a click in that
@@ -490,6 +491,18 @@ function applyTheme(name) {
490
491
  }
491
492
  }
492
493
 
494
+ /* The org's own icon, if its ops repo has one at portal/icon.*: in the sidebar and the tab. */
495
+ function initIcon() {
496
+ const img = document.createElement("img");
497
+ img.className = "mark";
498
+ img.alt = "";
499
+ img.onload = () => {
500
+ document.querySelector(".brand .mark")?.replaceWith(img);
501
+ document.querySelector('link[rel="icon"]')?.setAttribute("href", "/icon");
502
+ };
503
+ img.src = "/icon";
504
+ }
505
+
493
506
  function initTheme() {
494
507
  let theme = store("roster.theme") ?? "system";
495
508
  if (!THEMES.includes(theme)) theme = "system";
@@ -108,7 +108,7 @@ export async function toClipboard(text, btn, label) {
108
108
  };
109
109
  try {
110
110
  await navigator.clipboard.writeText(text);
111
- said("copied · " + Math.round(text.length / 1000) + "k");
111
+ said(text.length < 1000 ? "copied" : "copied · " + Math.round(text.length / 1000) + "k");
112
112
  return true;
113
113
  } catch {
114
114
  /* fall through */
@@ -8,9 +8,10 @@
8
8
 
9
9
  import { getConnectors, post } from "../api.js";
10
10
  import { sheet } from "../dialog.js";
11
- import { el } from "../dom.js";
11
+ import { el, toClipboard } from "../dom.js";
12
12
  import { icon } from "../icons.js";
13
13
  import { render } from "../router.js";
14
+ import { S } from "../state.js";
14
15
 
15
16
  /* The last answer, so a repaint after Save does not flash an empty screen. */
16
17
  let last = null;
@@ -64,7 +65,53 @@ function draw(body, d) {
64
65
  card.onclick = () => open(e, null, d);
65
66
  grid.append(card);
66
67
  }
68
+ const own = el("button", { className: "conncard" }, [
69
+ el("span", { className: "connicon" }, [icon("plug")]),
70
+ el("span", {}, [el("b", { textContent: "Custom server" }), el("small", { textContent: "Any MCP server, by its URL." })]),
71
+ ]);
72
+ own.onclick = () => openCustom(d);
73
+ grid.append(own);
67
74
  body.append(el("h2", { className: "connhead", textContent: d.connectors.length ? "Add another" : "Add a service" }), grid);
75
+ body.append(...ownAgent());
76
+ }
77
+
78
+ /* --------------------- this portal as an MCP server, elsewhere --------------------- */
79
+
80
+ /** How to add this portal's MCP server to Claude Code, Codex, Claude or anything else. */
81
+ function ownAgent() {
82
+ const head = el("h2", { className: "connhead", textContent: "Connect your own agent" });
83
+ if (!S.hosted) {
84
+ return [head, el("p", { className: "sub", textContent: "Needs the hosted portal: roster portal deploy." })];
85
+ }
86
+ const url = location.origin + "/mcp";
87
+ // Named after the org, so a second Roster in the same agent gets tools of its own.
88
+ const slug = String(S.data?.name ?? S.data?.org ?? "")
89
+ .toLowerCase()
90
+ .replace(/[^a-z0-9]+/g, "-")
91
+ .replace(/^-|-$/g, "");
92
+ const name = slug ? "roster-" + slug : "roster";
93
+ const rows = [
94
+ ["Claude Code", `claude mcp add --transport http ${name} ${url}`, "Then run /mcp and sign in."],
95
+ ["Codex", `codex mcp add ${name} --url ${url} && codex mcp login ${name}`, ""],
96
+ ["Claude", url, "Settings → Connectors → Add custom connector."],
97
+ ["Anything else", url, ""],
98
+ ];
99
+ const list = el("div", { className: "connlist" });
100
+ for (const [label, text, then] of rows) {
101
+ const copy = el("button", { className: "ghbtn", textContent: "Copy" });
102
+ copy.onclick = () => toClipboard(text, copy, "Copy");
103
+ list.append(
104
+ el("div", { className: "connrow connmcp" }, [
105
+ el("div", { className: "conntext" }, [
106
+ el("b", { textContent: label }),
107
+ el("code", { textContent: text }),
108
+ then ? el("small", { textContent: then }) : null,
109
+ ].filter(Boolean)),
110
+ copy,
111
+ ]),
112
+ );
113
+ }
114
+ return [head, el("p", { className: "sub", textContent: "Sign in with GitHub when it asks." }), list];
68
115
  }
69
116
 
70
117
  /** "Notion (integration key)" is only Notion where it is the one Notion on offer. */
@@ -92,7 +139,7 @@ function row(c, d) {
92
139
 
93
140
  const edit = el("button", { className: "ghbtn", textContent: "Edit" });
94
141
  edit.onclick = () => open(e ?? custom(c), c, d);
95
- edit.disabled = !d.canWrite || !e;
142
+ edit.disabled = !d.canWrite || (!e && Boolean(c.problem));
96
143
  const remove = el("button", { className: "ghbtn", textContent: "Remove" });
97
144
  remove.disabled = !d.canWrite;
98
145
  remove.onclick = () => confirmRemove(c, remove);
@@ -108,9 +155,104 @@ function row(c, d) {
108
155
  ]);
109
156
  }
110
157
 
111
- /** A hand-written connector the catalogue does not describe: editable in org.yaml only. */
158
+ /** A server the catalogue does not describe: who has it, and its key when it takes one. */
112
159
  function custom(c) {
113
- return { id: c.id, name: c.name, fields: [], steps: [], auth: c.auth };
160
+ const fields = c.auth === "key" && c.secrets.length === 1 ? [{ id: "token", label: c.secrets[0].label, secret: true }] : [];
161
+ return { id: c.id, name: c.name, summary: c.url ?? "", fields, steps: [], auth: c.auth };
162
+ }
163
+
164
+ /* --------------------------- a server of your own ---------------------------- */
165
+
166
+ function openCustom(d) {
167
+ let box = null;
168
+ const node = customForm(d, () => box?.close());
169
+ box = sheet({ node, onClose: () => {} });
170
+ if (!box) document.querySelector("#main")?.append(node);
171
+ }
172
+
173
+ function customForm(d, close) {
174
+ const out = el("div", { className: "connform" });
175
+ out.append(el("h2", { className: "sheettitle", textContent: "Connect a custom server" }));
176
+
177
+ const input = (placeholder, type = "text") => el("input", { type, autocomplete: "off", spellcheck: false, placeholder });
178
+ const name = input("acme");
179
+ const url = input("https://mcp.acme.dev/mcp");
180
+ const header = input("Authorization");
181
+ header.value = "Authorization";
182
+ const key = input("Bearer …", "password");
183
+ const field = (label, node) => el("label", { className: "field" }, [el("span", { textContent: label }), node]);
184
+ out.append(el("div", { className: "setupform" }, [field("Name", name), field("URL", url)]));
185
+
186
+ // How it signs in: a key in a header, the hosted portal's sign-in, or nothing.
187
+ let auth = "key";
188
+ const keyFields = el("div", { className: "setupform" }, [field("Header", header), field("Value", key)]);
189
+ const choices = el("div", { className: "connstaff" });
190
+ for (const [value, label] of [["key", "Key"], ["oauth", "Sign in"], ["none", "No key"]]) {
191
+ if (value === "oauth" && !d.signIn) continue;
192
+ const radio = el("input", { type: "radio", name: "connauth", checked: value === auth });
193
+ radio.onchange = () => {
194
+ auth = value;
195
+ keyFields.hidden = auth !== "key";
196
+ save.textContent = auth === "oauth" ? "Sign in" : "Save";
197
+ };
198
+ choices.append(el("label", { className: "conntick" }, [radio, el("span", { textContent: label })]));
199
+ }
200
+ out.append(el("h3", { className: "connsub", textContent: "Sign-in" }), choices, keyFields);
201
+
202
+ const picked = new Set(d.staff.length === 1 ? [d.staff[0].handle] : []);
203
+ out.append(el("h3", { className: "connsub", textContent: "Who can use it" }), staffPicker(d, picked));
204
+
205
+ const status = el("div");
206
+ const cancel = el("button", { className: "ghbtn", textContent: "Cancel" });
207
+ cancel.onclick = close;
208
+ const save = el("button", { className: "ghbtn primary", textContent: "Save" });
209
+ save.disabled = !d.canWrite;
210
+ const fail = (msg) => status.replaceChildren(el("p", { className: "err", textContent: msg }));
211
+ save.onclick = async () => {
212
+ const id = name.value.trim().toLowerCase();
213
+ if (!id) return fail("Give it a name.");
214
+ if (!picked.size) return fail("Pick at least one staff member.");
215
+ if (auth === "key" && !key.value.trim()) return fail("Paste the key, or pick No key.");
216
+ const label = save.textContent;
217
+ save.disabled = true;
218
+ save.textContent = auth === "oauth" ? "Opening…" : "Saving…";
219
+ try {
220
+ if (auth === "oauth") {
221
+ const r = await post({ id, staff: [...picked], custom: { url: url.value.trim() } }, "/api/connectors/signin");
222
+ location.href = r.url;
223
+ return;
224
+ }
225
+ await post(
226
+ {
227
+ id,
228
+ staff: [...picked],
229
+ custom: { url: url.value.trim(), header: header.value.trim() },
230
+ values: { token: auth === "key" ? key.value.trim() : "" },
231
+ },
232
+ "/api/connectors/save",
233
+ );
234
+ last = null;
235
+ close();
236
+ render();
237
+ } catch (err) {
238
+ save.disabled = false;
239
+ save.textContent = label;
240
+ fail(String(err.message || err));
241
+ }
242
+ };
243
+
244
+ out.append(status, el("div", { className: "row connfoot" }, [save, cancel]));
245
+ return out;
246
+ }
247
+
248
+ function staffPicker(d, picked) {
249
+ const who = el("div", { className: "connstaff" });
250
+ for (const s of d.staff) {
251
+ const box = el("input", { type: "checkbox", checked: picked.has(s.handle) });
252
+ box.onchange = () => (box.checked ? picked.add(s.handle) : picked.delete(s.handle));
253
+ who.append(el("label", { className: "conntick" }, [box, el("span", { textContent: s.name })]));
254
+ }
255
+ return who;
114
256
  }
115
257
 
116
258
  async function confirmRemove(c, btn) {
@@ -143,7 +285,7 @@ function open(e, c, d) {
143
285
  function form(e, c, d, close) {
144
286
  const out = el("div", { className: "connform" });
145
287
  out.append(el("h2", { className: "sheettitle", textContent: (c ? "" : "Connect ") + shortName(e) }));
146
- if (!c) out.append(el("p", { className: "sub", textContent: e.summary }));
288
+ if (!c || !c.known) out.append(el("p", { className: "sub", textContent: e.summary }));
147
289
 
148
290
  const oauth = e.auth === "oauth";
149
291
  if (!c && e.steps.length && !oauth) {
@@ -194,13 +336,7 @@ function form(e, c, d, close) {
194
336
 
195
337
  const picked = new Set(c ? c.staff : (e.suggest ?? []).filter((h) => d.staff.some((s) => s.handle === h)));
196
338
  if (!picked.size && d.staff.length === 1) picked.add(d.staff[0].handle);
197
- const who = el("div", { className: "connstaff" });
198
- for (const s of d.staff) {
199
- const box = el("input", { type: "checkbox", checked: picked.has(s.handle) });
200
- box.onchange = () => (box.checked ? picked.add(s.handle) : picked.delete(s.handle));
201
- who.append(el("label", { className: "conntick" }, [box, el("span", { textContent: s.name })]));
202
- }
203
- out.append(el("h3", { className: "connsub", textContent: "Who can use it" }), who);
339
+ out.append(el("h3", { className: "connsub", textContent: "Who can use it" }), staffPicker(d, picked));
204
340
 
205
341
  let ro = null;
206
342
  if (e.readOnly) {