Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(scripts): reformat source files for consistent style

Steven Enamakel7542648f46f6
diff --git a/scripts/life-scenarios/fixtures/search-index.json b/scripts/life-scenarios/fixtures/search-index.json
index 810dadfc76..27170079ba 100644
--- a/scripts/life-scenarios/fixtures/search-index.json
+++ b/scripts/life-scenarios/fixtures/search-index.json
@@ -18,7 +18,17 @@
"url": "https://www.delta.com/us/en/baggage/carry-on-baggage",
"title": "Carry-On Baggage | Delta Air Lines",
"publish_date": null,
- "keywords": ["delta", "carry-on", "carry on", "baggage", "personal item", "hand luggage", "basic economy", "dimensions", "size"],
+ "keywords": [
+ "delta",
+ "carry-on",
+ "carry on",
+ "baggage",
+ "personal item",
+ "hand luggage",
+ "basic economy",
+ "dimensions",
+ "size"
+ ],
"excerpts": [
"Delta allows one carry-on bag plus one personal item free of charge on every fare, including Basic Economy. The page states the exact maximum dimensions and the linear-inch limit."
]
@@ -27,7 +37,15 @@
"url": "https://www.delta.com/us/en/baggage/overview",
"title": "Baggage Information Overview | Delta Air Lines",
"publish_date": null,
- "keywords": ["delta", "baggage", "overview", "allowance", "checked", "policy", "rules"],
+ "keywords": [
+ "delta",
+ "baggage",
+ "overview",
+ "allowance",
+ "checked",
+ "policy",
+ "rules"
+ ],
"excerpts": [
"Entry point for Delta's baggage rules: carry-on, checked allowances, size and weight maximums, and the fee structure by cabin and route."
]
@@ -36,7 +54,19 @@
"url": "https://www.delta.com/us/en/baggage/checked-baggage/excess-overweight-baggage",
"title": "Excess & Overweight Baggage Fees | Delta Air Lines",
"publish_date": null,
- "keywords": ["delta", "checked", "baggage", "fee", "fees", "overweight", "oversized", "excess", "transatlantic", "europe", "international"],
+ "keywords": [
+ "delta",
+ "checked",
+ "baggage",
+ "fee",
+ "fees",
+ "overweight",
+ "oversized",
+ "excess",
+ "transatlantic",
+ "europe",
+ "international"
+ ],
"excerpts": [
"Per-piece weight and size limits by cabin, and the published excess, overweight and oversized charges for travel between North America and Europe."
]
@@ -45,7 +75,17 @@
"url": "https://www.delta.com/us/en/baggage/checked-baggage/previous-baggage-fees",
"title": "Previous Baggage Fees | Delta Air Lines",
"publish_date": null,
- "keywords": ["delta", "baggage", "fee", "fees", "previous", "historical", "basic economy", "europe", "change"],
+ "keywords": [
+ "delta",
+ "baggage",
+ "fee",
+ "fees",
+ "previous",
+ "historical",
+ "basic economy",
+ "europe",
+ "change"
+ ],
"excerpts": [
"Historical record of fee changes, including first-bag pricing for Delta Main Basic on U.S./Canada/Mexico to Europe itineraries ticketed before a stated date. A change notice, not the current published fare."
]
@@ -54,7 +94,17 @@
"url": "https://www.delta.com/us/en/baggage/additional-baggage-information/flight-partners",
"title": "Baggage on Partner Airlines | Delta Air Lines",
"publish_date": null,
- "keywords": ["delta", "baggage", "partner", "codeshare", "interline", "joint venture", "virgin atlantic", "klm", "air france"],
+ "keywords": [
+ "delta",
+ "baggage",
+ "partner",
+ "codeshare",
+ "interline",
+ "joint venture",
+ "virgin atlantic",
+ "klm",
+ "air france"
+ ],
"excerpts": [
"Which carrier's baggage rules govern an itinerary operated by a partner, which matters on transatlantic routes that Delta codeshares."
]
@@ -63,7 +113,16 @@
"url": "https://www.delta.com/us/en/baggage/special-items",
"title": "Special Items & Sports Equipment | Delta Air Lines",
"publish_date": null,
- "keywords": ["delta", "baggage", "special", "sports", "equipment", "musical", "instrument", "bicycle"],
+ "keywords": [
+ "delta",
+ "baggage",
+ "special",
+ "sports",
+ "equipment",
+ "musical",
+ "instrument",
+ "bicycle"
+ ],
"excerpts": [
"Handling and charges for items that fall outside the standard checked allowance."
]
@@ -73,7 +132,18 @@
"url": "https://www.bls.gov/news.release/flex2.nr0.htm",
"title": "Telework and Remote Work — U.S. Bureau of Labor Statistics",
"publish_date": "2025-06-18",
- "keywords": ["remote work", "telework", "work from home", "hybrid", "statistic", "statistics", "percent", "workers", "survey", "current"],
+ "keywords": [
+ "remote work",
+ "telework",
+ "work from home",
+ "hybrid",
+ "statistic",
+ "statistics",
+ "percent",
+ "workers",
+ "survey",
+ "current"
+ ],
"excerpts": [
"Official U.S. federal survey estimates of the share of employed people who teleworked, broken out by industry and occupation. The release carries the reference period the figure belongs to."
]
@@ -82,7 +152,17 @@
"url": "https://www.census.gov/topics/employment/telework.html",
"title": "Telework — U.S. Census Bureau",
"publish_date": "2025-09-04",
- "keywords": ["remote work", "telework", "work from home", "statistic", "statistics", "census", "survey", "share", "current"],
+ "keywords": [
+ "remote work",
+ "telework",
+ "work from home",
+ "statistic",
+ "statistics",
+ "census",
+ "survey",
+ "share",
+ "current"
+ ],
"excerpts": [
"Census Bureau tables tracking work-from-home rates over time, with the year each estimate covers stated alongside it."
]
@@ -91,7 +171,16 @@
"url": "https://www.pewresearch.org/social-trends/2023/03/30/about-a-third-of-us-workers-who-can-work-from-home-do-so-all-the-time/",
"title": "How Americans View Their Jobs — Remote Work | Pew Research Center",
"publish_date": "2023-03-30",
- "keywords": ["remote work", "work from home", "hybrid", "survey", "pew", "statistic", "statistics", "workers"],
+ "keywords": [
+ "remote work",
+ "work from home",
+ "hybrid",
+ "survey",
+ "pew",
+ "statistic",
+ "statistics",
+ "workers"
+ ],
"excerpts": [
"Survey of U.S. workers whose jobs can be done from home, reporting how many do so all of the time versus some of the time. Note the fieldwork date when judging whether this is current."
]
diff --git a/scripts/life-scenarios/mock-search.mjs b/scripts/life-scenarios/mock-search.mjs
index 7f80ddbd26..6ff407ebe4 100644
--- a/scripts/life-scenarios/mock-search.mjs
+++ b/scripts/life-scenarios/mock-search.mjs
@@ -64,10 +64,48 @@ import path from "node:path";
/** Words too common to carry a topic; dropped before scoring. */
const STOPWORDS = new Set([
- "a", "an", "and", "are", "as", "at", "be", "by", "current", "do", "does",
- "for", "from", "how", "i", "in", "is", "it", "its", "me", "my", "of", "on",
- "or", "s", "that", "the", "their", "there", "they", "this", "to", "was",
- "what", "when", "where", "which", "who", "will", "with", "you", "your",
+ "a",
+ "an",
+ "and",
+ "are",
+ "as",
+ "at",
+ "be",
+ "by",
+ "current",
+ "do",
+ "does",
+ "for",
+ "from",
+ "how",
+ "i",
+ "in",
+ "is",
+ "it",
+ "its",
+ "me",
+ "my",
+ "of",
+ "on",
+ "or",
+ "s",
+ "that",
+ "the",
+ "their",
+ "there",
+ "they",
+ "this",
+ "to",
+ "was",
+ "what",
+ "when",
+ "where",
+ "which",
+ "who",
+ "will",
+ "with",
+ "you",
+ "your",
]);
/** Lowercase alphanumeric terms, stopwords and one-character noise removed. */
@@ -155,7 +193,11 @@ export function startMockSearch({ indexPath, requestsPath, port = 0 }) {
if (!requestsPath) return;
fs.writeFileSync(
requestsPath,
- JSON.stringify({ searches: ctx.searches, requests: ctx.requests }, null, 2),
+ JSON.stringify(
+ { searches: ctx.searches, requests: ctx.requests },
+ null,
+ 2,
+ ),
);
},
};
@@ -178,7 +220,10 @@ export function startMockSearch({ indexPath, requestsPath, port = 0 }) {
body.query,
].filter((q) => typeof q === "string" && q.trim());
const queryTerms = [...new Set(queries.flatMap(terms))];
- const limit = Math.min(Math.max(Number(body?.excerpts?.maxResults) || 5, 1), 10);
+ const limit = Math.min(
+ Math.max(Number(body?.excerpts?.maxResults) || 5, 1),
+ 10,
+ );
// An off-topic query must come back empty rather than with the least-bad
// rows in the corpus: a confidently wrong result set is worse for the
@@ -228,9 +273,16 @@ export function startMockSearch({ indexPath, requestsPath, port = 0 }) {
}
}
const p = url.pathname.replace(/\/+$/, "");
- ctx.requests.push({ at: new Date().toISOString(), method: req.method, path: p });
+ ctx.requests.push({
+ at: new Date().toISOString(),
+ method: req.method,
+ path: p,
+ });
- if (p === "/agent-integrations/parallel/search" && req.method === "POST") {
+ if (
+ p === "/agent-integrations/parallel/search" &&
+ req.method === "POST"
+ ) {
try {
return json(res, 200, search(body));
} catch (e) {
diff --git a/scripts/life-scenarios/run.mjs b/scripts/life-scenarios/run.mjs
index 1c02e4525c..86feb655e5 100644
--- a/scripts/life-scenarios/run.mjs
+++ b/scripts/life-scenarios/run.mjs
@@ -94,7 +94,10 @@ function parseArgs(argv) {
return v;
};
if (a === "--only")
- o.only = next().split(",").map((s) => s.trim()).filter(Boolean);
+ o.only = next()
+ .split(",")
+ .map((s) => s.trim())
+ .filter(Boolean);
else if (a === "--driver") o.driver = next();
else if (a === "--agent") o.agentId = next();
else if (a === "--model") o.model = next();
@@ -164,7 +167,11 @@ async function snapshotTree(root) {
else {
const st = await fsp.stat(p).catch(() => null);
if (st)
- out.push({ rel: path.relative(root, p), bytes: st.size, mtimeMs: st.mtimeMs });
+ out.push({
+ rel: path.relative(root, p),
+ bytes: st.size,
+ mtimeMs: st.mtimeMs,
+ });
}
}
}
@@ -293,7 +300,9 @@ async function withRetries(fn, { attempts, delayMs, what }) {
await new Promise((r) => setTimeout(r, delayMs));
}
}
- throw new Error(`${what} never settled after ${attempts} attempts: ${last?.message ?? last}`);
+ throw new Error(
+ `${what} never settled after ${attempts} attempts: ${last?.message ?? last}`,
+ );
}
// ---------------------------------------------------------------------------
@@ -377,7 +386,9 @@ class Core {
}
await sleep(500);
}
- throw new Error(`core did not become healthy on ${this.url}; see ${logPath}`);
+ throw new Error(
+ `core did not become healthy on ${this.url}; see ${logPath}`,
+ );
}
async rpc(method, params, timeoutMs = 120_000) {
@@ -387,12 +398,19 @@ class Core {
"content-type": "application/json",
authorization: `Bearer ${this.token}`,
},
- body: JSON.stringify({ jsonrpc: "2.0", id: `ls-${Date.now()}`, method, params }),
+ body: JSON.stringify({
+ jsonrpc: "2.0",
+ id: `ls-${Date.now()}`,
+ method,
+ params,
+ }),
signal: AbortSignal.timeout(timeoutMs),
});
const text = await res.text();
if (!res.ok)
- throw new Error(`RPC ${method} HTTP ${res.status}: ${text.slice(0, 400)}`);
+ throw new Error(
+ `RPC ${method} HTTP ${res.status}: ${text.slice(0, 400)}`,
+ );
let body;
try {
body = JSON.parse(text);
@@ -400,10 +418,13 @@ class Core {
throw new Error(`RPC ${method} non-JSON: ${text.slice(0, 300)}`);
}
if (body.error)
- throw new Error(`RPC ${method} error: ${JSON.stringify(body.error).slice(0, 500)}`);
+ throw new Error(
+ `RPC ${method} error: ${JSON.stringify(body.error).slice(0, 500)}`,
+ );
// `apply_log_envelope` wraps a result that carried log lines.
const r = body.result;
- if (r && typeof r === "object" && "result" in r && "logs" in r) return r.result;
+ if (r && typeof r === "object" && "result" in r && "logs" in r)
+ return r.result;
return r;
}
@@ -441,7 +462,10 @@ class EventStream {
async connect() {
const url = `${this.core.url}/events?client_id=${encodeURIComponent(this.clientId)}`;
const res = await fetch(url, {
- headers: { authorization: `Bearer ${this.core.token}`, accept: "text/event-stream" },
+ headers: {
+ authorization: `Bearer ${this.core.token}`,
+ accept: "text/event-stream",
+ },
signal: this.controller.signal,
});
if (!res.ok || !res.body)
@@ -515,10 +539,16 @@ class ApprovalResponder {
this.loop = (async () => {
while (this.running) {
try {
- const pending = await this.core.rpc("openhuman.approval_list_pending", {}, 15_000);
+ const pending = await this.core.rpc(
+ "openhuman.approval_list_pending",
+ {},
+ 15_000,
+ );
const rows = Array.isArray(pending)
? pending
- : (pending && (pending.requests || pending.pending || pending.items)) || [];
+ : (pending &&
+ (pending.requests || pending.pending || pending.items)) ||
+ [];
for (const row of rows) {
// `PendingApproval.request_id` — the decide RPC takes `request_id`,
// not `id`, and a wrong key comes back as a redacted
@@ -571,7 +601,10 @@ class ApprovalResponder {
* while a turn runs, and a window would sweep them in.
*/
async function usageIds(core) {
- const log = await core.rpc("openhuman.cost_get_usage_log", { days: 1, limit: 1000 });
+ const log = await core.rpc("openhuman.cost_get_usage_log", {
+ days: 1,
+ limit: 1000,
+ });
const records = (log && log.records) || [];
return new Map(records.map((r) => [r.id, r]));
}
@@ -602,7 +635,8 @@ function foldUsage(rows) {
...t,
models: [...models],
cost_sources: [...sources],
- cache_hit_pct: t.input_tokens > 0 ? (t.cached_input_tokens / t.input_tokens) * 100 : 0,
+ cache_hit_pct:
+ t.input_tokens > 0 ? (t.cached_input_tokens / t.input_tokens) * 100 : 0,
};
}
@@ -652,7 +686,11 @@ function gradeScenario(scenario, sandbox, transcript) {
({ checks } = scenario.grade(ctx));
} catch (e) {
checks = [
- { id: "grader_crashed", ok: false, detail: String(e.message).slice(0, 200) },
+ {
+ id: "grader_crashed",
+ ok: false,
+ detail: String(e.message).slice(0, 200),
+ },
];
}
const passed = checks.filter((c) => c.ok).length;
@@ -672,7 +710,14 @@ function gradeScenario(scenario, sandbox, transcript) {
* The desktop path: `channel_web_chat` acks immediately and the answer arrives
* on the event stream as `chat_done`, carrying the turn's own usage payload.
*/
-async function sendDesktopTurn({ core, events, clientId, threadId, message, opts }) {
+async function sendDesktopTurn({
+ core,
+ events,
+ clientId,
+ threadId,
+ message,
+ opts,
+}) {
const toolCalls = [];
let done = null;
let requestId = null;
@@ -717,7 +762,11 @@ async function sendDesktopTurn({ core, events, clientId, threadId, message, opts
const timeout = sleep(opts.turnTimeoutMs).then(() => "timeout");
const outcome = await Promise.race([finished, timeout]);
if (outcome === "timeout")
- return { error: `turn did not emit chat_done within ${opts.turnTimeoutMs}ms`, requestId, toolCalls };
+ return {
+ error: `turn did not emit chat_done within ${opts.turnTimeoutMs}ms`,
+ requestId,
+ toolCalls,
+ };
if (done && done.event === "chat_error")
return {
@@ -755,14 +804,28 @@ async function sendRpcTurn({ core, threadId, message, sandbox, opts }) {
},
opts.turnTimeoutMs,
);
- return { reply: typeof reply === "string" ? reply : "", usage: null, requestId: null, toolCalls: [] };
+ return {
+ reply: typeof reply === "string" ? reply : "",
+ usage: null,
+ requestId: null,
+ toolCalls: [],
+ };
}
// ---------------------------------------------------------------------------
// run one scenario
// ---------------------------------------------------------------------------
-async function runScenario({ core, events, clientId, approvals, scenario, runDir, opts, attempt }) {
+async function runScenario({
+ core,
+ events,
+ clientId,
+ approvals,
+ scenario,
+ runDir,
+ opts,
+ attempt,
+}) {
const sandboxRoot = path.join(runDir, "sandbox");
const sandbox = path.join(sandboxRoot, scenario.id);
await fsp.rm(sandbox, { recursive: true, force: true });
@@ -788,7 +851,14 @@ async function runScenario({ core, events, clientId, approvals, scenario, runDir
try {
turn =
opts.driver === "desktop"
- ? await sendDesktopTurn({ core, events, clientId, threadId, message, opts })
+ ? await sendDesktopTurn({
+ core,
+ events,
+ clientId,
+ threadId,
+ message,
+ opts,
+ })
: await sendRpcTurn({ core, threadId, message, sandbox, opts });
if (turn.error) error = turn.error;
} catch (e) {
@@ -833,7 +903,8 @@ async function runScenario({ core, events, clientId, approvals, scenario, runDir
ok: !error,
error,
latency_ms: latencyMs,
- ledger_elapsed_ms: ledger && ledger.telemetry ? ledger.telemetry.elapsedMs : null,
+ ledger_elapsed_ms:
+ ledger && ledger.telemetry ? ledger.telemetry.elapsedMs : null,
tool_calls: turn.toolCalls,
tool_call_count:
ledger && ledger.telemetry && ledger.telemetry.toolCount != null
@@ -887,7 +958,17 @@ function printReport(results) {
a.total += r.grade.total;
return a;
},
- { input: 0, cached: 0, output: 0, cost: 0, latency: 0, tools: 0, approvals: 0, passed: 0, total: 0 },
+ {
+ input: 0,
+ cached: 0,
+ output: 0,
+ cost: 0,
+ latency: 0,
+ tools: 0,
+ approvals: 0,
+ passed: 0,
+ total: 0,
+ },
);
console.log(
`TOTAL completion ${tot.passed}/${tot.total} (${Math.round(
@@ -956,7 +1037,9 @@ async function main() {
);
console.log(`run dir : ${runDir}`);
- console.log(`driver : ${opts.driver}${opts.agentId ? ` agent=${opts.agentId}` : " agent=orchestrator"}`);
+ console.log(
+ `driver : ${opts.driver}${opts.agentId ? ` agent=${opts.agentId}` : " agent=orchestrator"}`,
+ );
let search = null;
if (opts.mockSearch) {
@@ -994,7 +1077,9 @@ async function main() {
composioBase: composio ? composio.url : "",
approvals: opts.approvals,
});
- console.log(`core : ${core.url} (pid ${health.pid}, healthy=${health.healthy})`);
+ console.log(
+ `core : ${core.url} (pid ${health.pid}, healthy=${health.healthy})`,
+ );
// Stand in for login.
const localUserId = "life-scenarios-local";
@@ -1039,7 +1124,12 @@ async function main() {
// `config.get` wraps the config under `config` (see
// `snapshot_config_json`), and the RPC envelope may wrap that again.
const snap = await core.rpc("openhuman.config_get", {});
- const cfg = snap?.config ?? snap?.snapshot?.config ?? snap?.snapshot ?? snap ?? {};
+ const cfg =
+ snap?.config ??
+ snap?.snapshot?.config ??
+ snap?.snapshot ??
+ snap ??
+ {};
const providers = cfg.cloud_providers ?? [];
const routed =
cfg.inference_url === opts.inferenceUrl &&
@@ -1071,7 +1161,9 @@ async function main() {
try {
for (let attempt = 1; attempt <= opts.repeat; attempt += 1) {
for (const scenario of selected) {
- process.stdout.write(`running ${scenario.id} (attempt ${attempt}) ... `);
+ process.stdout.write(
+ `running ${scenario.id} (attempt ${attempt}) ... `,
+ );
const r = await runScenario({
core,
events,
@@ -1102,7 +1194,11 @@ async function main() {
if (approvals)
await fsp.writeFile(
path.join(runDir, "approvals.json"),
- JSON.stringify({ decisions: approvals.decisions, errors: approvals.errors }, null, 2),
+ JSON.stringify(
+ { decisions: approvals.decisions, errors: approvals.errors },
+ null,
+ 2,
+ ),
);
if (composio) {
await fsp.writeFile(