@nanocollective/roster 0.1.0-beta.13 → 0.1.0-beta.14
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/cli.js +47 -15
- package/dist/worker/index.js +36 -7
- package/docs/doctor-codes.md +1 -1
- package/docs/export.md +1 -1
- package/docs/hosting.md +2 -0
- package/docs/org-yaml.md +8 -0
- package/docs/prompts.md +2 -1
- package/package.json +1 -1
- package/templates/ops/compose.mjs +8 -2
- package/templates/ops/prompts/_identity.md +6 -0
package/dist/cli.js
CHANGED
|
@@ -1215,13 +1215,24 @@ function readHumans(org) {
|
|
|
1215
1215
|
github,
|
|
1216
1216
|
name: name || github,
|
|
1217
1217
|
marker: String(entry.marker ?? "").trim() || defaultMarker(name || github),
|
|
1218
|
-
role: entry.role === void 0 || entry.role === null ? void 0 : String(entry.role)
|
|
1218
|
+
role: entry.role === void 0 || entry.role === null ? void 0 : String(entry.role),
|
|
1219
|
+
...entry.view_only === true ? { viewOnly: true } : {}
|
|
1219
1220
|
});
|
|
1220
1221
|
}
|
|
1221
1222
|
return out;
|
|
1222
1223
|
}
|
|
1224
|
+
function staffHumans(org) {
|
|
1225
|
+
return readHumans(org).filter((h) => !h.viewOnly);
|
|
1226
|
+
}
|
|
1227
|
+
function isViewOnly(org, login) {
|
|
1228
|
+
const l = login.toLowerCase();
|
|
1229
|
+
return readHumans(org).some((h) => h.viewOnly && h.github.toLowerCase() === l);
|
|
1230
|
+
}
|
|
1231
|
+
function primaryHuman(org) {
|
|
1232
|
+
return staffHumans(org)[0] ?? null;
|
|
1233
|
+
}
|
|
1223
1234
|
function humanLogins(org) {
|
|
1224
|
-
return
|
|
1235
|
+
return staffHumans(org).map((h) => h.github).filter(Boolean);
|
|
1225
1236
|
}
|
|
1226
1237
|
function defaultMarker(name) {
|
|
1227
1238
|
return String(name).trim().split(/[\s-]+/)[0].toLowerCase().replace(/[^a-z0-9]/g, "") || "human";
|
|
@@ -1390,6 +1401,8 @@ function validateOrgYaml(text2, parseYaml3) {
|
|
|
1390
1401
|
}
|
|
1391
1402
|
for (const h of doc.humans ?? []) {
|
|
1392
1403
|
if (!h?.github) return "every entry in humans needs a github login";
|
|
1404
|
+
if (h.view_only !== void 0 && typeof h.view_only !== "boolean")
|
|
1405
|
+
return "view_only is true or false";
|
|
1393
1406
|
}
|
|
1394
1407
|
return null;
|
|
1395
1408
|
}
|
|
@@ -1496,7 +1509,7 @@ function staffTokens(ws, org, handle, parseYaml3) {
|
|
|
1496
1509
|
return tokensFor(spec(org, ws), specFromManifest(manifest, dir));
|
|
1497
1510
|
}
|
|
1498
1511
|
function spec(org, ws) {
|
|
1499
|
-
const humans =
|
|
1512
|
+
const humans = staffHumans(org);
|
|
1500
1513
|
const first = humans[0];
|
|
1501
1514
|
return {
|
|
1502
1515
|
org: org.org,
|
|
@@ -2089,7 +2102,7 @@ function buildPlan(ws, org, handle, opts, parseYaml3) {
|
|
|
2089
2102
|
"status_issue is 0 until --apply opens the pinned issue; prompts will not compose before then"
|
|
2090
2103
|
);
|
|
2091
2104
|
}
|
|
2092
|
-
const humans =
|
|
2105
|
+
const humans = staffHumans(org);
|
|
2093
2106
|
const orgSpec2 = {
|
|
2094
2107
|
org: org.org,
|
|
2095
2108
|
name: org.name,
|
|
@@ -2104,7 +2117,7 @@ function buildPlan(ws, org, handle, opts, parseYaml3) {
|
|
|
2104
2117
|
warnings.push("org.yaml has no human.github, so the mention gate will never match");
|
|
2105
2118
|
if (humans.length > 1) {
|
|
2106
2119
|
warnings.push(
|
|
2107
|
-
`the mention gate accepts ${humans.map((h) => h.github).join(", ")} \u2014 everyone in org.yaml`
|
|
2120
|
+
`the mention gate accepts ${humans.map((h) => h.github).join(", ")} \u2014 everyone in org.yaml but the view-only`
|
|
2108
2121
|
);
|
|
2109
2122
|
}
|
|
2110
2123
|
const tokens = tokensFor(orgSpec2, staff);
|
|
@@ -4003,8 +4016,8 @@ function planBrains(ws, parseYaml3) {
|
|
|
4003
4016
|
name: org.name,
|
|
4004
4017
|
opsRepo: `${org.org}/${ws.opsName}`,
|
|
4005
4018
|
opsDirName: ws.opsName,
|
|
4006
|
-
human:
|
|
4007
|
-
humanMarker:
|
|
4019
|
+
human: primaryHuman(org)?.github ?? "",
|
|
4020
|
+
humanMarker: primaryHuman(org)?.marker ?? "human",
|
|
4008
4021
|
humanLogins: humanLogins(org),
|
|
4009
4022
|
allowedTools: toolsOf(org)
|
|
4010
4023
|
};
|
|
@@ -4238,12 +4251,12 @@ function checkWorkspace(ws, org) {
|
|
|
4238
4251
|
title: `org.yaml names ${org.repos?.length ?? 0} repos and ${org.staff?.length ?? 0} staff`
|
|
4239
4252
|
});
|
|
4240
4253
|
const humans = readHumans(org);
|
|
4241
|
-
if (!
|
|
4254
|
+
if (!staffHumans(org).some((h) => h.github)) {
|
|
4242
4255
|
out.push({
|
|
4243
4256
|
scope,
|
|
4244
4257
|
level: "fail",
|
|
4245
4258
|
id: "human",
|
|
4246
|
-
title: "org.yaml names no human with a github login",
|
|
4259
|
+
title: "org.yaml names no human with a github login who is not view-only",
|
|
4247
4260
|
fix: "The mention callers gate on these logins. Without one nothing can wake an agent. Write `human: { github: you }`, or a `humans:` list for more than one."
|
|
4248
4261
|
});
|
|
4249
4262
|
} else if (humans.some((h) => !h.github)) {
|
|
@@ -4610,7 +4623,7 @@ async function checkStaff(ws, org, entry, composer, online) {
|
|
|
4610
4623
|
});
|
|
4611
4624
|
}
|
|
4612
4625
|
if (online && manifest.brain) {
|
|
4613
|
-
const logins =
|
|
4626
|
+
const logins = humanLogins(org);
|
|
4614
4627
|
out.push(...await checkStaffOnline(scope, manifest, callers, logins));
|
|
4615
4628
|
}
|
|
4616
4629
|
return out;
|
|
@@ -5224,7 +5237,7 @@ function buildExport(ws, org, parseYaml3, opts = {}) {
|
|
|
5224
5237
|
s.soloBots = s.bots.filter((b) => times.get(b) === 1);
|
|
5225
5238
|
s.sharedBots = s.bots.filter((b) => (times.get(b) ?? 0) > 1);
|
|
5226
5239
|
}
|
|
5227
|
-
const humans =
|
|
5240
|
+
const humans = staffHumans(org);
|
|
5228
5241
|
return {
|
|
5229
5242
|
org: org.org,
|
|
5230
5243
|
name: org.name,
|
|
@@ -6528,7 +6541,8 @@ function readHumans2(org) {
|
|
|
6528
6541
|
github,
|
|
6529
6542
|
name: name || github,
|
|
6530
6543
|
marker: String(entry.marker ?? "").trim() || defaultMarker2(name || github),
|
|
6531
|
-
role: entry.role ?? void 0
|
|
6544
|
+
role: entry.role ?? void 0,
|
|
6545
|
+
...entry.view_only === true ? { viewOnly: true } : {}
|
|
6532
6546
|
});
|
|
6533
6547
|
}
|
|
6534
6548
|
return out;
|
|
@@ -6580,7 +6594,8 @@ function compose({
|
|
|
6580
6594
|
};
|
|
6581
6595
|
const inflightFile = join27(runDir ?? join27(brainsDir, ".roster-run"), "inflight.md");
|
|
6582
6596
|
const inflight = existsSync18(inflightFile) ? readFileSync18(inflightFile, "utf8").trim() : "";
|
|
6583
|
-
const
|
|
6597
|
+
const everyone = readHumans2(org);
|
|
6598
|
+
const humans = everyone.filter((h) => !h.viewOnly);
|
|
6584
6599
|
const ctx = {
|
|
6585
6600
|
org,
|
|
6586
6601
|
event: event2,
|
|
@@ -6613,7 +6628,9 @@ function compose({
|
|
|
6613
6628
|
// makes `{{#if humans_extra}}` the right way to mention the others at all.
|
|
6614
6629
|
human_list: humanSentence(humans),
|
|
6615
6630
|
inflight,
|
|
6616
|
-
humans_extra: humanSentence(humans.slice(1))
|
|
6631
|
+
humans_extra: humanSentence(humans.slice(1)),
|
|
6632
|
+
// Who can read along and cannot rule. Empty, and the paragraph gone, when nobody is.
|
|
6633
|
+
humans_viewing: humanSentence(everyone.filter((h) => h.viewOnly))
|
|
6617
6634
|
};
|
|
6618
6635
|
const readPartial = (rel) => {
|
|
6619
6636
|
const p = rel.startsWith("staff:") ? join27(brainDir, rel.slice(6)) : join27(opsDir, rel);
|
|
@@ -6727,6 +6744,12 @@ ${ticks}`;
|
|
|
6727
6744
|
|
|
6728
6745
|
// src/lib/act.ts
|
|
6729
6746
|
var MERGE_METHODS = ["squash", "merge", "rebase"];
|
|
6747
|
+
function wouldWake(req, handles) {
|
|
6748
|
+
if (req.action === "ask") return true;
|
|
6749
|
+
const text2 = `${req.title ?? ""}
|
|
6750
|
+
${req.body ?? ""}`.toLowerCase();
|
|
6751
|
+
return handles.some((h) => new RegExp(`@${h.toLowerCase()}(?![\\w-])`).test(text2));
|
|
6752
|
+
}
|
|
6730
6753
|
async function act(gh, req) {
|
|
6731
6754
|
const { action, repo } = req;
|
|
6732
6755
|
if (action === "create") {
|
|
@@ -7477,7 +7500,7 @@ function renderBrief2(text2, tokens) {
|
|
|
7477
7500
|
return text2.replace(/%%([A-Z_]+)%%/g, (m, name) => tokens[name] ?? m);
|
|
7478
7501
|
}
|
|
7479
7502
|
function orgSpec(org, w) {
|
|
7480
|
-
const humans =
|
|
7503
|
+
const humans = staffHumans(org);
|
|
7481
7504
|
const first = humans[0];
|
|
7482
7505
|
return {
|
|
7483
7506
|
org: org.org,
|
|
@@ -8197,6 +8220,15 @@ var ROUTES = {
|
|
|
8197
8220
|
if (payload.action === "ask" && !known.includes(payload.ask?.pr?.repo ?? "")) {
|
|
8198
8221
|
return json({ error: `${payload.ask?.pr?.repo ?? ""} is not a repo in org.yaml` }, 400);
|
|
8199
8222
|
}
|
|
8223
|
+
const handles = (org.staff ?? []).map((s) => String(s.handle));
|
|
8224
|
+
if (isViewOnly(org, actor.id) && wouldWake(payload, handles)) {
|
|
8225
|
+
return json(
|
|
8226
|
+
{
|
|
8227
|
+
error: "You are view-only in org.yaml, so this would not reach the staff. Nothing was posted."
|
|
8228
|
+
},
|
|
8229
|
+
403
|
|
8230
|
+
);
|
|
8231
|
+
}
|
|
8200
8232
|
try {
|
|
8201
8233
|
const result = await act(actor.gh, payload);
|
|
8202
8234
|
portal.caches.inbox.delete(actor.id);
|