Rebuild the agent form as the fetch gate, the feed order, the cut and summarise, and name fetch text and the overrides as built

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet 5.5 committed 2026-10-04 15:27:03 +02:00
1 parent fbc0f16c4a
commit 61aadff681
7 files changed
+185 -198

No files matched your search

+72 -96
View File
@@ -5,18 +5,24 @@
* switch, its prompts, its gates in words, its weights, and a link to the
* Roles tab in its order. The prompts are the body, since fit is measured
* against the one a role fits best; the weights only share out the terms.
* The form edits the prompts as rows, and the gates as a Where block, a
* short list of lines a role passes by matching any one of, over a row per
* remaining rule under Advanced; a gate Where cannot say lands in a row, so
* a load and a save lose nothing. Edit turns a card
* The form edits the prompts as rows, and the fetch gate in three parts: the
* region (the scope select), the place (a short list of lines a role passes by
* matching any one of: countries, towns, remote) and the role (the fetch terms
* and the titles to leave out), over a row per remaining rule under Advanced;
* a gate the three parts cannot say lands in a row, so a load and a save lose
* nothing. A gate is a field, values and a mode (must, one of, not), with no
* weight. After it come the feed order (the four weights of the final score and
* the CV match weights), the cut (the best N by fit and the best M by CV
* closeness, each with a minimum level) and the size of summarise. Edit turns a card
* into the form from the page's `<template>`, in place, and New agent puts a
* blank card on top in the same state. One card edits at a time, so the
* form's ids stay unique. Votes, liked companies and scores are the agent's,
* so a delete takes them with it, and the confirm says so.
*
* The fetch terms are chips of free text, as the towns are: words that
* narrow what big boards read with the wide reach send (app/jobs/reach.py).
* The card says them in a line of their own, or that boards send every role.
* The fetch terms are chips of free text, as the towns are: words a big board
* (300 roles or more) whose host takes a query must match before it sends a
* role (app/jobs/reach.py). The card says them in a line of their own, or that
* boards send every role.
*
* The CV fieldset holds what the judge stage reads a role against: the CV as
* text (typed, or read from a .md/.txt file by the browser), the languages it
@@ -40,14 +46,14 @@
const DEFAULT_WEIGHTS = { fit: 0.6, recency: 0.2, affinity: 0.2, taste: 0.2,
cv_skills: 30, cv_experience: 25, cv_career: 30 };
// What the model reads after a pull, per agent: the best `extract_top`
// roles scoring at least `extract_min` get their gate columns filled, the
// best `summarise_top` at `summarise_min` or more a summary, and so does any
// role that is saved or liked, whatever its score. The judge reads the best
// `judge_top` at `judge_min` or more and the `judge_cv_top` ungated roles
// closest to the CV that those leave out.
const DEFAULT_LIMITS = { extract_top: 500, extract_min: 0.55, summarise_top: 30, summarise_min: 0.65,
judge_top: 150, judge_min: 0.55, judge_cv_top: 50 };
// What the models read after a pull, per agent (`app.models.Limits`): the
// cut is the best `cut_fit_top` roles by fit at `cut_fit_min` or more, then
// the best `cut_cv_top` by CV closeness at `cut_cv_min` or more that the
// first list leaves out, and every role liked or saved. Fetch text, extract
// and judge read the cut; summarise reads the top `summarise_top` of the
// feed and the roles liked or saved.
const DEFAULT_LIMITS = { cut_fit_top: 500, cut_fit_min: 0.6, cut_cv_top: 150, cut_cv_min: 0.6,
summarise_top: 50 };
// The levels of a language, the order of the server's ladder, and how big a
// CV file the browser reads into the box.
const LEVELS = ["basic", "conversational", "professional", "fluent", "native"];
@@ -57,13 +63,12 @@
const EUROPE = rh.EUROPE;
const FIELDS = ["place", "country", "remote", "remote_from", "seniority", "function", "salary_min",
"currency", "permit", "languages", "company", "title"];
const MODES = [["require", "must"], ["any", "one of"], ["prefer", "prefer"], ["exclude", "not"]];
const HYBRID_WEIGHT = 0.05;
const MODES = [["require", "must"], ["any", "one of"], ["exclude", "not"]];
/** @type {object[]} every agent, as the server lists them */
let agents = [];
/** @type {Object<string, boolean>} whether extract, summarise and judge run, from
* `/api/stages`; empty when that did not answer, and then a card says
/** @type {Object<string, boolean>} whether extract, summarise, judge and
* fetch_text run, from `/api/stages`; empty when that did not answer, and then a card says
* nothing about them */
let stageOn = {};
/** @type {number | "new" | null} the card in edit mode: an agent's id, NEW
@@ -249,7 +254,7 @@
return `with ${gate.field.replace("_", " ")} ${values.join(", ")}`;
}
// The scope of the Where block in words: "Within Europe", "Within Denmark or
// The region in words: "Within Europe", "Within Denmark or
// Sweden", "Everywhere".
function scopeWords(scope) {
if (scope.kind === "everywhere") return "Everywhere";
@@ -257,7 +262,7 @@
return `Within ${phrase({ field: "country", values: scope.values }).replace(/^in /, "")}`;
}
// The Where block in words, one sentence led by its scope, then the lines a
// The region and place in words, one sentence led by the region, then the lines a
// role may match, with the one-of rows among them since they are the same
// group: "Within Europe: keeps roles anywhere in Denmark, in Malmö, Lund or
// Helsingborg, or remote, and leaves out the rest." The lines add up, which
@@ -276,50 +281,51 @@
return `${scopeWords(where.scope)}: keeps roles ${list}, and leaves out the rest.`;
}
// The gates in words: where a role may be, then what it must meet, then
// what lifts it. "Within Europe: keeps roles anywhere in Denmark, or remote,
// and leaves out the rest. Only roles with seniority senior. Prefers
// hybrid."
// The gates in words: the region and the places a role may be, then what
// it must meet, then what is left out. "Within Europe: keeps roles anywhere
// in Denmark, or remote, and leaves out the rest. Only roles with seniority
// senior. Leaves out titles with “sales”."
function rulesLine(gates) {
const { where, rest } = rh.distribute(gates);
const of = (mode) => rest.filter((g) => g.mode === mode);
const must = of("require").map(phrase);
const prefer = of("prefer").map((g) => phrase(g).replace(/^with /, ""));
if (where.hybrid) prefer.unshift("hybrid");
const not = of("exclude").map(phrase);
const sentences = [];
const any = whereSentence(where, of("any"));
if (any) sentences.push(any);
if (must.length) sentences.push(`Only roles ${must.join(" and ")}.`);
if (prefer.length) sentences.push(`Prefers ${prefer.join("; ")}.`);
if (where.titles) sentences.push(`Leaves out titles with ${orList(where.titles.values.map((t) => `“${t}”`))}.`);
if (not.length) sentences.push(`Leaves out roles ${not.join(" or ")}.`);
return sentences.join(" ");
}
// What the model reads after a pull, one clause per stage. A stage that is
// off says so, with a link to its switch under Runs: the numbers are only
// what it would read once it is on.
// What the models read after a pull: the cut, then the stages that read
// it, then summarise's own size. A stage that is off says so, with a link to
// its switch under Runs: the numbers are only what it would read once it is
// on. The stage names are those of `/api/stages`.
function limitsLine(row) {
const l = Object.assign({}, DEFAULT_LIMITS, row.limits);
const p = el("p", "agent-limits");
const judged = `${l.judge_top} at ${l.judge_min}`
+ (l.judge_cv_top ? ` and the ${l.judge_cv_top} closest to the CV` : "");
const clauses = [
["extract", `reads ${l.extract_top} at ${l.extract_min}`, `${l.extract_top} at ${l.extract_min}`],
["summarise", `summarises ${l.summarise_top} at ${l.summarise_min}`, `${l.summarise_top} at ${l.summarise_min}`],
["judge", `judges ${judged}`, judged],
];
clauses.forEach(([name, on, would], i) => {
if (i) p.append(" · ");
if (stageOn[name] === false) {
const off = link("/settings/sources#stages", `${name} is off`);
off.title = "Switch it on under Runs, What the model reads.";
p.append(off, ` (${would})`);
} else {
p.append(on);
}
});
const lists = [];
if (l.cut_fit_top) lists.push(`the best ${l.cut_fit_top} by fit at ${l.cut_fit_min} or more`);
if (l.cut_cv_top) lists.push(`the best ${l.cut_cv_top} by closeness to the CV at ${l.cut_cv_min} or more`);
const cut = lists.length ? `${orList(lists)}, and liked and saved roles` : "liked and saved roles only";
p.append(`The cut: ${cut}.`);
const off = (name, would) => {
const a = link("/settings/sources#stages", `${name} is off`);
a.title = "Switch it on under Runs.";
p.append(" · ", a, ` (${would})`);
};
const reads = [["fetch_text", "fetch text"], ["extract", "extract"], ["judge", "judge"]];
const on = reads.filter(([key]) => stageOn[key] !== false).map(([, name]) => name);
if (on.length) {
const said = on.length < 2 ? on[0] : `${on.slice(0, -1).join(", ")} and ${on[on.length - 1]}`;
p.append(` ${said[0].toUpperCase()}${said.slice(1)} ${on.length > 1 ? "read" : "reads"} it`);
}
for (const [key, name] of reads) if (stageOn[key] === false) off(name, "reads the cut");
const summarised = `the top ${l.summarise_top} of the feed and liked and saved roles`;
if (stageOn.summarise === false) off("summarise", `summarises ${summarised}`);
else p.append(` · summarises ${summarised}`);
return p;
}
@@ -504,7 +510,7 @@
function termsLine(row) {
const terms = row.fetch_terms || [];
return el("p", "agent-terms", terms.length
? `Big boards read across Europe send only roles matching ${orList(terms.map((t) => `“${t}”`))}.`
? `Boards of 300 or more roles whose host takes a query send only roles matching ${orList(terms.map((t) => `“${t}”`))}.`
: "Big boards send every role: no fetch terms.");
}
@@ -578,8 +584,7 @@
return { node: row, read: () => ({ language: code.value.trim().toLowerCase(), level: level.value }) };
}
// A gate as a row: field, mode, values, the weight while it is prefer, and
// Remove. Values untouched since the load are sent as they came, so a
// A gate as a row: field, mode, values and Remove. Values untouched since the load are sent as they came, so a
// value with a comma in it survives a save.
function ruleRow(gate, remove) {
const row = el("div", "rule-row");
@@ -593,31 +598,16 @@
values.value = gate.values.join(", ");
values.setAttribute("aria-label", "Values, separated by commas");
const loaded = values.value;
const weight = el("input");
weight.type = "number";
weight.min = "0";
weight.step = "0.05";
weight.value = gate.mode === "prefer" && gate.weight !== undefined ? gate.weight : HYBRID_WEIGHT;
weight.setAttribute("aria-label", "Weight");
weight.title = "What a role that meets it gains.";
// A must or one-of gate carries a weight nobody reads; kept as it came.
const kept = gate.mode === "prefer" ? undefined : gate.weight;
const drop = linky("Remove");
drop.addEventListener("click", () => remove(row));
const shown = () => { weight.hidden = mode.value !== "prefer"; };
mode.addEventListener("change", shown);
shown();
row.append(field, mode, values, weight, drop);
row.append(field, mode, values, drop);
function read() {
const parts = values.value === loaded
? gate.values
: values.value.split(",").map((v) => v.trim()).filter(Boolean)
.map((v) => (field.value === "salary_min" ? Number(v) : v));
const out = { field: field.value, values: parts, mode: mode.value };
if (mode.value === "prefer") out.weight = Number(weight.value);
else if (kept !== undefined && kept !== 1) out.weight = kept;
return out;
return { field: field.value, values: parts, mode: mode.value };
}
return { node: row, read };
}
@@ -720,12 +710,6 @@
remoteFrom.node.hidden = remoteMode.value !== "from";
};
offer();
// The hybrid weight shows only when it is not the default; either way it
// is sent back as it came.
const hybridWeight = where.hybrid && where.hybrid.weight !== undefined ? where.hybrid.weight : HYBRID_WEIGHT;
$("#a-hybrid", f).checked = Boolean(where.hybrid);
$("#a-hybrid-weight", f).value = hybridWeight;
$("#a-hybrid-weight-line", f).hidden = hybridWeight === HYBRID_WEIGHT;
$("details.advanced", f).open = rest.length > 0;
const rules = [];
@@ -742,13 +726,12 @@
};
rest.forEach(addRule);
$("#a-add-rule", f).addEventListener("click", () => {
$("select", addRule({ field: "seniority", values: [], mode: "prefer", weight: HYBRID_WEIGHT }).node).focus();
$("select", addRule({ field: "seniority", values: [], mode: "require" }).node).focus();
changed(f);
});
// The gates the Where block says, in the order the starter agents have
// them: the scope, the lines, then hybrid; and the titles left out, the
// block under it.
// The gates the fetch gate's three parts say, in the order the starter
// agents have them: the region, the place lines, and the titles left out.
function whereGates() {
const out = [];
const within = countries.values();
@@ -762,20 +745,17 @@
if (remoteMode.value === "scope") out.push({ field: "remote", values: ["remote"], mode: "any" });
if (remoteMode.value === "from" && from.length) out.push({ field: "remote_from", values: from, mode: "any" });
if (towns.length) out.push({ field: "place", values: towns, mode: "any" });
if ($("#a-hybrid", f).checked) {
out.push({ field: "remote", values: ["hybrid"], mode: "prefer", weight: Number($("#a-hybrid-weight", f).value) });
}
const left = titles.values();
if (left.length) out.push({ field: "title", values: left, mode: "exclude" });
return out;
}
// The gates Save sends: the Where block's, then the rows. The sentence
// under Where says them all, as the card will, rows included.
// The gates Save sends: the fetch gate's, then the rows. The sentence
// under it says them all, as the card will, rows included.
const gates = () => whereGates().concat(rules.map((r) => r.read()));
const view = () => {
offer();
$("#a-gates", f).value = JSON.stringify(gates(), null, 2);
$("#a-where-sum", f).textContent = rulesLine(gates()) || "Keeps roles anywhere.";
$("#a-where-sum", f).textContent = rulesLine(gates()) || "Passes every role.";
};
view();
@@ -786,13 +766,11 @@
$("#a-cv-skills", f).value = weights.cv_skills;
$("#a-cv-experience", f).value = weights.cv_experience;
$("#a-cv-career", f).value = weights.cv_career;
$("#a-extract-top", f).value = limits.extract_top;
$("#a-extract-min", f).value = limits.extract_min;
$("#a-cut-fit-top", f).value = limits.cut_fit_top;
$("#a-cut-fit-min", f).value = limits.cut_fit_min;
$("#a-cut-cv-top", f).value = limits.cut_cv_top;
$("#a-cut-cv-min", f).value = limits.cut_cv_min;
$("#a-summarise-top", f).value = limits.summarise_top;
$("#a-summarise-min", f).value = limits.summarise_min;
$("#a-judge-top", f).value = limits.judge_top;
$("#a-judge-min", f).value = limits.judge_min;
$("#a-judge-cv-top", f).value = limits.judge_cv_top;
$("#a-delete", f).hidden = !row;
f.addEventListener("input", () => { f.dataset.dirty = "true"; view(); });
f.addEventListener("change", view);
@@ -898,13 +876,11 @@
cv_career: Number($("#a-cv-career", f).value),
},
limits: {
extract_top: Number($("#a-extract-top", f).value),
extract_min: Number($("#a-extract-min", f).value),
cut_fit_top: Number($("#a-cut-fit-top", f).value),
cut_fit_min: Number($("#a-cut-fit-min", f).value),
cut_cv_top: Number($("#a-cut-cv-top", f).value),
cut_cv_min: Number($("#a-cut-cv-min", f).value),
summarise_top: Number($("#a-summarise-top", f).value),
summarise_min: Number($("#a-summarise-min", f).value),
judge_top: Number($("#a-judge-top", f).value),
judge_min: Number($("#a-judge-min", f).value),
judge_cv_top: Number($("#a-judge-cv-top", f).value),
},
fetch_terms: read.terms(),
cv_text: $("#a-cv-text", f).value,
+27 -31
View File
@@ -188,38 +188,34 @@
/* The two fetch overrides, one more pair of toggles in the affinity
buttons' fragment beside them, in a group of their own since they are
global rather than an agent's stance (app/jobs/reach.py). Fetching has
two filters, and by default a company follows the agents on both:
- All countries reads its big boards (300 roles or more) with the
agents' wide reach, Europe today, rather than their places.
- All roles reads them with no role-type narrowing: none of the agents'
fetch terms, which only apply with the wide reach, and none of the
role filters that may come later.
On queues a pull on the server, as the other reopening switches do; off
asks nothing, since no role closes until the next pull reads the board
with its filters again. `company` is the shared list's row;
`onChange` runs after the server accepted a switch, with the company it
answered. */
global rather than an agent's stance (app/jobs/reach.py). The fetch gate
has three parts, region, place and role, and a company follows every
agent's on all three unless it is set to:
- All countries: the place part is skipped. The company's roles are
fetched and kept from the whole region (Europe), not only the agents'
places, for every agent. The region itself still holds.
- All roles: the role part is skipped: no fetch terms and no titles to
leave out.
Turning either on or off queues a rescore on the server, as the other
switches that change what passes do, and a pull reads the board anew.
`company` is the shared list's row; `onChange` runs after the server
accepted a switch, with the company it answered. */
const OVERRIDES = [
{ value: "countries", field: "all_countries", path: "all-countries", text: "All countries",
on: "All countries is on: this company's big boards are read across the agents' wide "
+ "reach (Europe), not only the agents' places. The default is the agents' places. "
+ "Boards under 300 roles are read whole either way. Turning it off asks nothing "
+ "first: no role closes until the next pull reads the board again.",
off: "All countries: read this company's big boards across the agents' wide reach "
+ "(Europe) instead of the agents' places, the default. Boards under 300 roles are "
+ "read whole already. Turning it on queues a pull.",
said: (on) => (on ? "all countries in the agents' wide reach" : "the agents' places") },
on: "All countries is on: this company's roles are fetched and kept from the whole "
+ "region (Europe), not only the agents' places, for every agent. The region still "
+ "holds. Turning it off puts the agents' places back and rescores.",
off: "All countries: fetch and keep this company's roles from the whole region "
+ "(Europe) instead of only the agents' places, for every agent. Turning it on "
+ "rescores.",
said: (on) => (on ? "all countries in the region" : "the agents' places") },
{ value: "roles", field: "all_roles", path: "all-roles", text: "All roles",
on: "All roles is on: this company's boards are read with no role-type narrowing, "
+ "none of the agents' fetch terms. The default follows the terms, which only apply "
+ "with All countries or on a host that cannot ask for each country. Turning it off "
+ "asks nothing first.",
off: "All roles: no role-type narrowing for this company, none of the agents' fetch "
+ "terms, the default, nor later role filters. The terms only apply with All "
+ "countries or on a host that cannot ask for each country, so on its own this "
+ "changes nothing today. Turning it on queues a pull.",
said: (on) => (on ? "every role type" : "the agents' terms") },
on: "All roles is on: this company's roles are fetched with no fetch terms and kept "
+ "whatever their title, for every agent. Turning it off puts the agents' fetch "
+ "terms and titles to leave out back and rescores.",
off: "All roles: fetch this company's roles with no fetch terms and no titles to "
+ "leave out, for every agent. Turning it on rescores.",
said: (on) => (on ? "every role type" : "the agents' fetch terms and titles") },
];
function overridesControl(companyKey, company, onChange) {
@@ -258,8 +254,8 @@
company.all_roles = Boolean(updated.all_roles);
}
window.toast.info(on
? `${updated.name}: ${o.said(true)}. Reading now, or with the pull right after.`
: `${updated.name}: back to ${o.said(false)} from the next pull.`);
? `${updated.name}: ${o.said(true)}. Rescoring now, and a pull reads the board right after.`
: `${updated.name}: back to ${o.said(false)}. Rescoring now, and the next pull reads the board anew.`);
if (onChange) await onChange(updated);
}
+9 -7
View File
@@ -25,9 +25,10 @@
* from app/jobs/reach.py), so the row shows whether the company follows the
* agents' filters or overrides them. Its editor has a second line that sets
* the board's own reach: the agents', or its own countries and remote,
* posted to `/api/sources/{id}/reach`. The wide reach (Europe) and no role
* narrowing are the company's two overrides instead, and the board's own
* countries win over All countries.
* posted to `/api/sources/{id}/reach`. Fetching from the whole region (All
* countries) and no fetch terms or titles to leave out (All roles) are the
* company's two overrides instead, and the board's own countries win over
* All countries.
*
* Beside that line stands the board's size, set when it was added and
* changed only by a Recheck ("999 roles · checked 30 Sep"). Recheck, beside
@@ -325,11 +326,12 @@
note.className = "muted small";
note.textContent = [
company.all_countries
? "All countries is on; countries set here win over it."
: "All countries, beside the stars, reads the agents' wide reach (Europe).",
? "All countries is on: roles are fetched and kept from the whole region, and countries set here win over it."
: "All countries, beside the stars, fetches and keeps this company's roles from the whole region (Europe), not only the agents' places.",
company.all_roles
? "All roles is on: no fetch terms."
: "All roles drops the agents' fetch terms.",
? "All roles is on: no fetch terms and no titles to leave out."
: "All roles drops the fetch terms and the titles to leave out.",
"Turning either on or off rescores.",
].join(" ");
form.append(mode, codes, remote, save, note);
form.addEventListener("submit", async (event) => {
+18 -16
View File
@@ -1,5 +1,6 @@
/* The Runs section of Sources: the "Run the pull now" button, and the
* switches for the stages of a pull: the two that ask a model and enrich.
* switches for the stages of a pull: extract, summarise and judge, which ask a
* model, and fetch text, which reads a role's own page and asks none.
*
* The switches are `/api/stages`: one row per stage, drawn as the search
* rows above are (`.srow`, `.switch`), and a switch is a PUT that stores the
@@ -59,12 +60,15 @@
// ------------------------------------------------- what the model reads
// `depth` is whose setting says how many roles a stage reads: every stage
// but summarise reads each agent's cut, summarise its own size.
const DOES = {
extract: "fills in country, seniority, salary and the like from what the posting says",
summarise: "writes a short summary and tags for the best roles",
judge: "scores the best roles against a search agent's CV, for CV match",
enrich: "reads the own page of the best roles whose list gave no text",
extract: "fills in location, remote area, seniority, languages and the like from what the posting says, for every role in the cut",
summarise: "writes a short summary and tags for the top of the feed, and for every role you liked or saved",
judge: "scores every role in the cut against a search agent's CV, for CV match",
fetch_text: "reads the own page of every role in the cut that came without text, with no model, before extract and judge",
};
const NAMES = { fetch_text: "Fetch text" };
const el = (tag, className, text) => {
const node = document.createElement(tag);
@@ -106,20 +110,18 @@
const row = el("div", "srow");
if (!stage.on) row.dataset.muted = "true";
const name = el("span", "name");
name.append(el("span", "", stage.name[0].toUpperCase() + stage.name.slice(1)),
name.append(el("span", "", NAMES[stage.name] || stage.name[0].toUpperCase() + stage.name.slice(1)),
...(stage.model ? [el("span", "badge", stage.model)] : []));
row.append(name, stageSwitch(stage, () => renderStages(stages)));
const sub = el("span", "sub");
if (stage.name === "enrich") {
/* Global, unlike the model stages: `enrich.top` and `enrich.min_score`. */
sub.append(`${DOES[stage.name]}. How many it reads is set for every agent alike by `
+ "enrich.top and enrich.min_score in config.yaml");
} else {
sub.append(`${DOES[stage.name]}. How deep it reads is set per search agent, under `);
const agents = el("a", "", "Search agents");
agents.href = "/settings/agents";
sub.append(agents);
}
/* Depth is per search agent: the cut for fetch text, extract and judge,
summarise's own size. Fetch text keeps per_board, per_run and
retry_days in config.yaml, which only bound its load on a host. */
sub.append(`${DOES[stage.name]}. How many it reads is each search agent's `
+ `${stage.name === "summarise" ? "summarise size" : "cut"}, under `);
const agents = el("a", "", "Search agents");
agents.href = "/settings/agents";
sub.append(agents);
sub.append(stage.source === "config"
? ". Following config.yaml until this switch is used."
: ".");