Show and set each board's reach on the Companies list, list the readers' declarations on Sources, and document filtering at the source

A company row says what a pull asks its board for; its editor sets the board's own reach (the agents', all roles, or countries and remote) through /api/sources/{id}/reach. /api/readers lists each reader's listing, text, filters, places and robots decision, folded under the Follow form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 10:03:41 +02:00
1 parent 3462a4abe7
commit dafca5435e
8 files changed
+333 -8

No files matched your search

+63 -1
View File
@@ -17,6 +17,11 @@
* into the Follow form's `#b-host`, and a slug. Saving posts to
* `/api/companies/{key}/board`, which reads the board once before keeping
* it; Detach stops reading it and keeps the company.
*
* A row with a board says what a pull asks it for ("reads DK, SE · agents",
* `reach` from app/jobs/reach.py), and its editor has a second line that
* sets the board's own reach: the agents', all roles, or its own countries
* and remote, posted to `/api/sources/{id}/reach`.
*/
(function () {
"use strict";
@@ -90,6 +95,7 @@
sub.appendChild(link);
}
sub.append(` · ${count(company.open_roles, "open role")}`);
if (company.reach) sub.append(` · reads ${company.reach}`);
if (company.failing_since) {
// The board has failed on every pull since then; after 21 days its
// roles close.
@@ -199,6 +205,58 @@
return form;
}
/** The open row's reach editor, for a row with a board: the agents' reach,
all roles, or the board's own countries and remote. */
function reachEditor(company, rerender) {
if (company.subscription_id == null) return null;
const own = company.reach_params || {};
const form = document.createElement("form");
form.className = "board-edit";
form.autocomplete = "off";
const mode = document.createElement("select");
mode.setAttribute("aria-label", `What ${company.name}'s board is asked for`);
for (const [value, label] of [["agents", "Agents' reach"], ["all", "All roles"],
["own", "These countries"]]) {
mode.appendChild(new Option(label, value));
}
mode.value = own.reach === "all" ? "all" : (own.countries || own.remote != null ? "own" : "agents");
const codes = document.createElement("input");
codes.type = "text";
codes.spellcheck = false;
codes.placeholder = "DK SE";
codes.value = (own.countries || []).join(" ");
codes.setAttribute("aria-label", "Country codes");
const remote = document.createElement("select");
remote.setAttribute("aria-label", "Remote roles");
remote.append(new Option("and remote", "yes"), new Option("no remote", "no"));
remote.value = own.remote ? "yes" : "no";
const save = document.createElement("button");
save.type = "submit";
save.textContent = "Set reach";
const shown = () => { codes.hidden = remote.hidden = mode.value !== "own"; };
mode.addEventListener("change", shown);
shown();
form.append(mode, codes, remote, save);
form.addEventListener("submit", async (event) => {
event.preventDefault();
save.disabled = true;
try {
const result = await api(`/api/sources/${company.subscription_id}/reach`, {
method: "POST",
body: { mode: mode.value, countries: codes.value.split(/[\s,]+/).filter(Boolean),
remote: remote.value === "yes" },
});
window.toast.info(`${company.name}: reads ${result.reach} from the next pull.`);
editing = null;
await loadCompanies(agentId());
rerender();
} catch (err) {
save.disabled = false;
}
});
return form;
}
/** The board switch, or nothing for a company with no board:
there is no subscription to switch. */
function onSwitch(company, rerender) {
@@ -274,7 +332,11 @@
row.appendChild(affinityControl(company.key, company.affinity, async () => render(), agent));
}
row.appendChild(subLine(company, render));
if (editing === company.key) row.appendChild(boardEditor(company, render));
if (editing === company.key) {
row.appendChild(boardEditor(company, render));
const reach = reachEditor(company, render);
if (reach) row.appendChild(reach);
}
body.appendChild(row);
}
const open = rows.reduce((sum, c) => sum + c.open_roles, 0);