agentcompass 0.1.2: sync AgentCompass v0.3.8 scoring (floors, origin, frontier headroom, curves, work-kind inference) (#749)

Syncs Mode A's scoring with AgentCompass v0.3.8 (akiiwa-games/AgentCompass, accounts.json and scripts/allocator.py): ability floors routine 2.3 / hard 3.1, `ability_score_origin` (graded from max(floor, origin)), `critical_headroom_by_difficulty` {frontier: 0.1}, the tool_execution route floor {hard: 2.7}, the 13 effort curves and `effort_ability`/`effort_burn`, and 54bb51e's work-kind inference (COMPUTER_USE_PHRASES, CODE_FILE_RE guard, "translation of", the code-file/debug skip). `extractRequestFacts().hasComputerUse` uses the same phrases and guard, so continuity's GUI `capability_outgrown` no longer fires on bare "gui", "desktop app", "keyboard", "桌面", "键盘". Version 0.1.2.

Reviewed at head 4ff38ce1d (previous review at 4de283991; the 4ff38ce diff drops the four screenshot phrases and adds tests 8.9 to 8.12).

Checked against upstream v0.3.8 (e30836e7) by script: all 13 curves in 8.12's table and `effort_ability`/`effort_burn` equal accounts.json; COMPUTER_USE_PHRASES equals allocator.py:1088 exactly.

Run at 4ff38ce1d on mote (macOS, Bun 1.4.2, Node 22.22.0): `bun test` 40 pass 0 fail; `node --test test/router.test.mjs` 40 pass; `bun scripts/check.mjs agentcompass` exit 0. PR CI (test, on-npm) green.

Broken by hand at 4ff38ce1d, one at a time, each red:
- origin = floor -> 8.9
- CODE_FILE_RE guard off in inferKindFromObjective -> 8.10
- bare "keyboard"/"mouse" in COMPUTER_USE_PHRASES -> 8.10, 8.11
- "translation of" -> "translation" -> 8.10
- namesCode out of the translation skip -> 8.10
- hasComputerUse without the guard, or on GUI_WORDS -> 8.10, 8.11
- "take a screenshot" or "截屏操作" put back -> 8.10
- opus xhigh ability, carbon medium burn, effort_ability.xhigh, effort_burn.max changed -> 8.12
- criticalHeadroom ignoring the table -> 8.7; abilityFloor ignoring the route -> 8.8

Not tried: real routing traffic through a live magpie gateway.
This commit is contained in:
Akiiwa
2026-11-05 15:15:28 +08:00
committed by GitHub
parent 8e4105dd3d
commit bf959aa60e
5 changed files with 354 additions and 54 deletions
+30 -13
View File
@@ -78,26 +78,37 @@ export const READONLY_REVIEW_PHRASES = [
];
export const GUI_WORDS = [
"click the",
"click save",
"take a screenshot",
"capture a screenshot",
"click",
"screenshot",
" gui",
"desktop app",
"mouse",
"keyboard",
"点击",
"截图",
"桌面",
"鼠标",
];
export const COMPUTER_USE_PHRASES = [
"click the",
"click save",
"use the mouse",
"with the mouse",
"mouse and keyboard",
"keyboard and mouse",
"operate the browser",
"operate the desktop",
"点击",
"截取屏幕",
"截屏操作",
"桌面",
"鼠标",
"键盘",
"用鼠标",
"键鼠",
"鼠标键盘",
"操作浏览器",
"操作桌面",
];
export const CODE_FILE_RE =
/[\w-]\.(?:py|pyw|ts|tsx|js|jsx|mjs|cjs|go|rs|java|kt|cs|cpp|cc|c|h|hpp|rb|php|swift|lua|sh|ps1)(?!\w)(?!\.\w)/i;
const OBJECTIVE_LOCAL_RUNTIME_RE =
/\b(?:ssh|ssh-agent|vps|localhost|127\.0\.0\.1|pytest|unittest|sqlite|daemon|worktree|adb|emulator|intranet|webhook|credentials?)\b/i;
@@ -243,7 +254,7 @@ export function extractRequestFacts(body, ctx = {}) {
const effectivePrevUser = turnState.previousUserText || "";
const hasVisual = Boolean(turnState.hasAnyVisual);
const lowerObj = ` ${String(effectiveObjective || "").toLowerCase()} `;
const hasComputerUse = GUI_WORDS.some((w) => lowerObj.includes(w));
const hasComputerUse = !CODE_FILE_RE.test(lowerObj) && COMPUTER_USE_PHRASES.some((w) => lowerObj.includes(w));
const totalChars = sysChars + (turnState.totalChars || 0);
const hasExplicitEstimatedTokens =
Number.isFinite(body?.estimated_input_tokens) ||
@@ -290,7 +301,8 @@ export function extractRequestFacts(body, ctx = {}) {
export function inferKindFromObjective(objective) {
const capped = capProfileText(objective);
const text = ` ${capped.toLowerCase()} `;
if (GUI_WORDS.some((w) => text.includes(w))) {
const namesCode = CODE_FILE_RE.test(text);
if (!namesCode && COMPUTER_USE_PHRASES.some((w) => text.includes(w))) {
return "computer_use";
}
if (
@@ -381,7 +393,7 @@ export function inferKindFromObjective(objective) {
"text_in_text_out",
[
"translate",
"translation",
"translation of",
"draft a document",
"draft documentation",
"rewrite the text",
@@ -526,7 +538,12 @@ export function inferKindFromObjective(objective) {
],
];
const debugKeywords = rules.find(([k]) => k === "debug_review")?.[1] || [];
const debugging = debugKeywords.some((word) => text.includes(word));
for (const [kind, keywords] of rules) {
if (kind === "text_in_text_out" && (namesCode || debugging)) {
continue;
}
if (keywords.some((w) => text.includes(w))) {
return kind;
}