A page plugin that compares the agent harnesses behind magpie's gateway by agent: input tokens, cache hits, failures, latency and estimated tool-definition size. A local service on 127.0.0.1:3496 reads magpie's usage ledger, and a read-only gateway hook writes tool counts, sizes and names to <config>/harnessweight/tools.jsonl. Since the review at e0a0ae97 (7c6cd626a, then main merged in): - Port 3492 -> 3496 (window-warmup has 3492; 3496 is used by no other package). - Config dir: input.directory, then a cwd probe, then an absolute XDG_CONFIG_HOME, then ~/.config/magpie. A relative XDG is ignored. - tools.jsonl is append-only. Past 8 MiB it is renamed to tools.jsonl.1. Age is checked at most hourly. Appends from two hosts are serialized by a cross-process lock that is skipped after 100 ms. - MAGPIE_ADDR is honoured; the UI has English and Chinese (zh-TW and ja read English); preview PNGs dropped; /%E0 returns 400. Run at 961b20e63c7e00e1dcca723bc2aa1d302f5dd9a3, in WSL (magpie-desktop, Node 22.23.4): - node --test test/*.test.mjs in the package: 60 pass, 0 fail. - bun scripts/check.mjs: clean (registry.json ok; the package has hooks, so check skips it). - Probes against createHandler: - Origin null without the token: 403. With the token: 200. - A foreign Origin, a loopback Origin on another port, a file:// Origin, a rebound Host and a localhost Host on another port: all 403. - The index HTML carries the token and no ACAO. - ..%2f: 400. /%E0: 400. - Rollover with 40-tool rows (1306 B each), 9.5 MiB written: the file peaked at 8,388,590 B (cap 8,388,608) with one rename to .1. Append p50 was 1.35 ms, p99 9.2 ms and max 24 ms. - Portable dir: the hook's cwd probe and the service's input.directory gave the same tools.jsonl. - Broken by hand: - Size rotation turned off: two rollover tests went red. - The Host check removed: the service test "other hosts, other origins and path traversal are refused" went red. Co-authored-by: webkubor <29485642+webkubor@users.noreply.github.com>
72 lines
2.1 KiB
JSON
72 lines
2.1 KiB
JSON
{
|
|
"name": "@magpie-community/page-harnessweight",
|
|
"version": "0.4.0",
|
|
"description": "HarnessWeight: a magpie page that weighs every agent harness behind your gateway, by agent rather than by model: input tokens, cache hit rate, tokens at full price, failures, latency, and the tool definitions each harness re-sends every turn",
|
|
"type": "module",
|
|
"files": [
|
|
"index.mjs",
|
|
"harnessweight.hooks.mjs",
|
|
"service.mjs",
|
|
"lib",
|
|
"page",
|
|
"app",
|
|
"brand/assets",
|
|
"README.md",
|
|
"LICENSE"
|
|
],
|
|
"keywords": [
|
|
"magpie",
|
|
"magpie-plugin",
|
|
"agent-harness",
|
|
"harness",
|
|
"token-usage",
|
|
"claude-code",
|
|
"codex",
|
|
"cost",
|
|
"llm-gateway"
|
|
],
|
|
"license": "MIT",
|
|
"magpie": {
|
|
"hooks": "./harnessweight.hooks.mjs",
|
|
"page": {
|
|
"title": "HarnessWeight",
|
|
"titles": {
|
|
"zh": "HarnessWeight",
|
|
"zh-TW": "HarnessWeight",
|
|
"ja": "HarnessWeight"
|
|
},
|
|
"file": "page/index.html",
|
|
"icon": "page/icon.svg",
|
|
"service": {
|
|
"port": 3496,
|
|
"option": "port"
|
|
}
|
|
},
|
|
"options": {
|
|
"port": 3496,
|
|
"dataDir": "",
|
|
"usageLog": "",
|
|
"agents": [],
|
|
"gatewayTimeoutMs": 2000,
|
|
"gatewayUrl": ""
|
|
},
|
|
"permissions": [],
|
|
"summary": {
|
|
"en": "Compare agent harnesses behind your gateway by input tokens, cache, failures, latency and estimated tool-definition size. Its local service reads this machine's usage ledger; a read-only hook samples tool sizes and tracks in-flight requests.",
|
|
"zh": "按 Agent 对比网关后面的输入 token、缓存、失败率、延迟与工具定义体积估算。本机服务读取用量记录,只读 hook 采样工具大小并追踪进行中的请求。"
|
|
}
|
|
},
|
|
"main": "./index.mjs",
|
|
"scripts": {
|
|
"test": "node --test test/*.test.mjs",
|
|
"dev": "node service.mjs"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/magpie-community/plugins.git",
|
|
"directory": "packages/page-harnessweight"
|
|
},
|
|
"homepage": "https://github.com/webkubor/harnessweight",
|
|
"author": "webkubor"
|
|
}
|