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,