aiinfra-tools 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/CHANGELOG.md +268 -0
  2. package/README.md +27 -3
  3. package/bin/aiinfra.mjs +5 -2
  4. package/bin/report.mjs +177 -0
  5. package/fleetops/README.md +33 -1
  6. package/fleetops/deploy/shadow-gate/argo-analysistemplate.yaml +34 -0
  7. package/fleetops/deploy/shadow-gate/argo-rollout-example.yaml +38 -0
  8. package/fleetops/deploy/shadow-gate/flagger-canary.yaml +34 -0
  9. package/fleetops/deploy/shadow-gate/judge.yaml +51 -0
  10. package/fleetops/deploy/shadow-gate/llmd-canary-example.yaml +35 -0
  11. package/fleetops/deploy/shadow-gate/podmonitor-vllm.yaml +20 -0
  12. package/fleetops/deploy/shadow-live/README.md +41 -0
  13. package/fleetops/deploy/shadow-live/kit.yaml +123 -0
  14. package/fleetops/deploy/shadow-live/load-canary.yaml +26 -0
  15. package/fleetops/deploy/shadow-live/run.sh +53 -0
  16. package/fleetops/docs/ADMISSION.md +9 -9
  17. package/fleetops/docs/FABRIC-STORAGE.md +1 -1
  18. package/fleetops/docs/SERVING.md +11 -1
  19. package/fleetops/docs/SHADOW.md +250 -0
  20. package/fleetops/docs/SIGNALS.md +5 -2
  21. package/fleetops/docs/WORKLOADS.md +1 -1
  22. package/fleetops/package.json +7 -4
  23. package/fleetops/src/adapters/fabric.mjs +19 -7
  24. package/fleetops/src/adapters/live.mjs +38 -5
  25. package/fleetops/src/adapters/logs.mjs +10 -7
  26. package/fleetops/src/adapters/nvsentinel.mjs +95 -0
  27. package/fleetops/src/adapters/topology.mjs +53 -1
  28. package/fleetops/src/admission.mjs +26 -18
  29. package/fleetops/src/api.mjs +2 -1
  30. package/fleetops/src/bundle.mjs +3 -0
  31. package/fleetops/src/calibrate.mjs +1 -1
  32. package/fleetops/src/detect.mjs +1 -1
  33. package/fleetops/src/export.mjs +5 -1
  34. package/fleetops/src/goodput.mjs +0 -2
  35. package/fleetops/src/incidents.mjs +1 -2
  36. package/fleetops/src/ingest.mjs +10 -3
  37. package/fleetops/src/inject.mjs +2 -2
  38. package/fleetops/src/live.mjs +2 -1
  39. package/fleetops/src/llmd.mjs +7 -3
  40. package/fleetops/src/optimize.mjs +1 -1
  41. package/fleetops/src/power.mjs +7 -7
  42. package/fleetops/src/procure.mjs +67 -0
  43. package/fleetops/src/rca.mjs +1 -1
  44. package/fleetops/src/rollout.mjs +1 -1
  45. package/fleetops/src/schema.mjs +3 -2
  46. package/fleetops/src/security.mjs +1 -1
  47. package/fleetops/src/serving.mjs +32 -10
  48. package/fleetops/src/shadow-canary.mjs +74 -0
  49. package/fleetops/src/shadow-gate.mjs +49 -0
  50. package/fleetops/src/shadow-prom.mjs +205 -0
  51. package/fleetops/src/shadow-replay.mjs +147 -0
  52. package/fleetops/src/shadow.mjs +291 -0
  53. package/fleetops/src/stats.mjs +14 -0
  54. package/fleetops/src/traces.mjs +0 -5
  55. package/fleetops/tests/fixtures/real/README.md +5 -0
  56. package/fleetops/tools/admit-node.sh +51 -16
  57. package/fleetops/tools/amd-admit.py +111 -0
  58. package/fleetops/tools/cmd/calibrate.mjs +61 -0
  59. package/fleetops/tools/cmd/capacity.mjs +116 -0
  60. package/fleetops/tools/cmd/common.mjs +32 -0
  61. package/fleetops/tools/cmd/data.mjs +343 -0
  62. package/fleetops/tools/cmd/help.mjs +243 -0
  63. package/fleetops/tools/cmd/incidents.mjs +216 -0
  64. package/fleetops/tools/cmd/rollout.mjs +122 -0
  65. package/fleetops/tools/cmd/server.mjs +122 -0
  66. package/fleetops/tools/cmd/serving.mjs +95 -0
  67. package/fleetops/tools/cmd/shadow.mjs +204 -0
  68. package/fleetops/tools/cmd/training.mjs +79 -0
  69. package/fleetops/tools/collect.sh +6 -1
  70. package/fleetops/tools/fleetops.mjs +18 -1308
  71. package/fleetops/tools/loop-demo.mjs +1 -1
  72. package/fleetops/tools/workload-profile.mjs +0 -1
  73. package/fleetscope/README.md +5 -1
  74. package/fleetscope/build.mjs +4 -0
  75. package/fleetscope/dist/index.html +1013 -28
  76. package/fleetscope/docs/AGENTIC.md +89 -0
  77. package/fleetscope/docs/PLANNING.md +4 -2
  78. package/fleetscope/docs/VALIDATION-AGENTIC.md +37 -0
  79. package/fleetscope/package.json +4 -3
  80. package/fleetscope/src/agentic.js +288 -0
  81. package/fleetscope/src/ask.js +0 -1
  82. package/fleetscope/src/cluster-ui.js +1 -0
  83. package/fleetscope/src/engine.js +29 -13
  84. package/fleetscope/src/index.src.html +15 -5
  85. package/fleetscope/src/inference-ui.js +1 -0
  86. package/fleetscope/src/ingest.js +89 -3
  87. package/fleetscope/src/optimize.js +11 -5
  88. package/fleetscope/src/plan.js +1 -1
  89. package/fleetscope/src/training-ui.js +1 -0
  90. package/fleetscope/tools/agentic.mjs +148 -0
  91. package/fleetscope/tools/tracelab-data.mjs +27 -0
  92. package/gpu-health/README.md +13 -2
  93. package/gpu-health/docs/CONFIG.md +29 -1
  94. package/gpu-health/package.json +7 -4
  95. package/gpu-health/src/actions.mjs +16 -3
  96. package/gpu-health/src/analyze.mjs +3 -0
  97. package/gpu-health/src/config.mjs +3 -0
  98. package/gpu-health/src/executors.mjs +9 -4
  99. package/gpu-health/src/health.mjs +1 -1
  100. package/gpu-health/src/ingest.mjs +27 -3
  101. package/gpu-health/src/platforms.mjs +109 -0
  102. package/gpu-health/src/vendors.mjs +12 -5
  103. package/gpu-health/tools/gpu-health.mjs +6 -4
  104. package/gpu-ledger/README.md +3 -1
  105. package/gpu-ledger/package.json +12 -4
  106. package/gpu-ledger/src/adapters.mjs +3 -2
  107. package/gpu-ledger/src/cloud.mjs +104 -0
  108. package/gpu-ledger/src/core.mjs +12 -10
  109. package/gpu-ledger/tools/ledger.mjs +8 -2
  110. package/harness-ledger/README.md +152 -0
  111. package/harness-ledger/docs/FORMATS.md +114 -0
  112. package/harness-ledger/docs/METHOD.md +133 -0
  113. package/harness-ledger/docs/VALIDATION-ECONOMICS.md +59 -0
  114. package/harness-ledger/docs/VALIDATION-SWEBENCH.md +26 -0
  115. package/harness-ledger/docs/VALIDATION-TRACELAB.md +56 -0
  116. package/harness-ledger/package.json +19 -0
  117. package/harness-ledger/src/demo.mjs +115 -0
  118. package/harness-ledger/src/economics.mjs +184 -0
  119. package/harness-ledger/src/gpu.mjs +80 -0
  120. package/harness-ledger/src/html.mjs +63 -0
  121. package/harness-ledger/src/importers.mjs +247 -0
  122. package/harness-ledger/src/ledger.mjs +128 -0
  123. package/harness-ledger/src/opencost.mjs +55 -0
  124. package/harness-ledger/src/outcomes.mjs +67 -0
  125. package/harness-ledger/src/prices.mjs +75 -0
  126. package/harness-ledger/src/record.mjs +52 -0
  127. package/harness-ledger/src/waste.mjs +136 -0
  128. package/harness-ledger/tools/harness-ledger.mjs +199 -0
  129. package/harness-ledger/tools/validate-economics.mjs +69 -0
  130. package/harness-ledger/tools/validate-swebench.mjs +57 -0
  131. package/harness-ledger/tools/validate-tracelab.mjs +74 -0
  132. package/hybrid-tracing/package.json +4 -3
  133. package/hybrid-tracing/tools/fix-skew.mjs +1 -1
  134. package/inference-sizer/README.md +5 -1
  135. package/inference-sizer/build.mjs +1 -0
  136. package/inference-sizer/dist/index.html +299 -31
  137. package/inference-sizer/docs/ACCELERATORS.md +62 -0
  138. package/inference-sizer/docs/CATALOG.md +71 -0
  139. package/inference-sizer/docs/METHOD.md +1 -1
  140. package/inference-sizer/docs/VALIDATION-INFERENCEX.md +37 -0
  141. package/inference-sizer/package.json +4 -3
  142. package/inference-sizer/src/accelerators.js +194 -0
  143. package/inference-sizer/src/catalog.js +55 -22
  144. package/inference-sizer/src/fit-ui.js +1 -1
  145. package/inference-sizer/src/index.src.html +3 -0
  146. package/inference-sizer/src/model.js +45 -7
  147. package/inference-sizer/src/ui.js +1 -1
  148. package/inference-sizer/tools/validate-agentx.mjs +116 -0
  149. package/inference-sizer/tools/validate-inferencex.mjs +132 -0
  150. package/mcp/README.md +6 -1
  151. package/mcp/server.mjs +34 -0
  152. package/package.json +10 -6
  153. package/schemas/README.md +3 -0
  154. package/schemas/aiinfra.report.schema.json +474 -0
  155. package/schemas/commands.mjs +14 -0
  156. package/schemas/fleetops.shadow.canary.schema.json +96 -0
  157. package/schemas/fleetops.shadow.compare.schema.json +266 -0
  158. package/schemas/fleetops.shadow.prom.schema.json +354 -0
  159. package/schemas/harness-ledger.economics.schema.json +567 -0
  160. package/schemas/sizer.list.schema.json +15 -2
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+ // The Inference Sizer against SemiAnalysis AgentX: agentic multi-turn traffic (long contexts, ~95% prefix-cache hits,
3
+ // subagent bursts) measured on real GPUs. For each AgentX result the sizer predicts the same layout at the same load
4
+ // (calls in flight from the measured rate and latency, Little's law), with the prompt, output and cache hit the run
5
+ // recorded, and is scored on TPOT and output tokens/s per GPU. With --fit it also fits the sizer's efficiencies per GPU
6
+ // on one part of the results and scores the rest.
7
+ //
8
+ // node tools/validate-agentx.mjs --results DIR|FILE… [--models map.json] [--hf-config ID=config.json] [--fit] [--markdown|--json]
9
+ //
10
+ // Results: AgentX aggregate JSON as InferenceX writes it (infx/results/agentic: hw, model, framework, precision, conc,
11
+ // tp, ep, dp_attention, num_gpus, disagg, request_metrics.{tokens, latency, throughput.per_gpu, qps, cache},
12
+ // server_metrics.cache), one per file or as an array. They are not in this repository: download them from InferenceX.
13
+ // Models: AgentX names models by prefix (dsv4, glm5.3, kimi-k3…). --models maps a prefix to a sizer model id; a model
14
+ // the catalog lacks can be added from its Hugging Face config.json with --hf-config ID=path.
15
+ import fs from 'node:fs';
16
+ import path from 'node:path';
17
+ import { createRequire } from 'node:module';
18
+ import { fileURLToPath } from 'node:url';
19
+ import { GPU, summary } from './validate-inferencex.mjs';
20
+
21
+ const require = createRequire(import.meta.url);
22
+ const C = require('../src/catalog.js'), M = require('../src/model.js');
23
+
24
+ // InferenceX's model prefixes (infmax_model_prefix, as its recipes name them) → sizer catalog ids. The longest
25
+ // matching prefix wins, so dsv41flash is not read as dsv4. null: a model the sizer can't size yet (counted as skipped).
26
+ // A prefix not here: --models map.json.
27
+ export const MODELS = { dsr1: 'deepseek-v3', dsv3: 'deepseek-v3', dsv4: 'deepseek-v4-pro', dsv41flash: null,
28
+ kimik3: 'kimi-k3', 'kimik3.1': 'kimi-k3', 'kimi-k2': 'kimi-k2', 'glm5.2': 'glm-5.3', 'glm5.3': 'glm-5.3', 'glm5.3flash': null,
29
+ minimaxm3: 'minimax-m3', minimaxm31flash: 'minimax-m3', musespark: 'muse-spark-open', 'qwen3.5': 'qwen35-397b', 'qwen3.8next': null, h3: null,
30
+ gptoss: 'gpt-oss-120b', 'gpt-oss-120b': 'gpt-oss-120b', 'qwen3-235b': 'qwen3-235b', 'qwen3-coder': 'qwen3-coder-480b', llama4: 'llama4-maverick' };
31
+ const get = (o, p) => p.split('.').reduce((a, k) => (a == null ? undefined : a[k]), o);
32
+ const firstNum = (o, ps) => { for (const p of ps) { const v = get(o, p); const n = typeof v === 'object' && v ? (v.mean ?? v.avg ?? v.median ?? v.p50) : v; if (Number.isFinite(+n) && n !== null && n !== '') return +n; } return null; };
33
+
34
+ // One AgentX result → the fields the sizer needs (null when the result can't be scored)
35
+ export function normalize(r, models = MODELS, catalog = C.MODELS) {
36
+ const hw0 = String(r.hw || r.hardware || '').toLowerCase().replace(/-(nv|sxm|oam).*$/, ''), hw = GPU[hw0] ? hw0 : hw0.split('-')[0]; // b200-nscale: a B200 at a cloud
37
+ const prefix = String(r.infmax_model_prefix || r.model || '').toLowerCase();
38
+ const key = Object.keys(models).sort((a, b) => b.length - a.length).find(k => prefix.startsWith(k.toLowerCase()));
39
+ const model = key && catalog.find(m => m.id === models[key]), gpu = C.GPUS.find(g => g.id === GPU[hw]);
40
+ const rm = r.request_metrics || r.metrics || {};
41
+ const tpot = firstNum(rm, ['latency.tpot.median', 'latency.tpot.p50', 'latency.tpot', 'median_tpot']);
42
+ const ttft = firstNum(rm, ['latency.ttft.median', 'latency.ttft.p50', 'latency.ttft', 'median_ttft']);
43
+ const e2e = firstNum(rm, ['latency.e2el.mean', 'latency.e2el.median', 'latency.e2el', 'mean_e2el']);
44
+ const qps = firstNum(rm, ['qps.mean', 'qps', 'mean_qps']);
45
+ const isl = firstNum(rm, ['tokens.input', 'tokens.input_tokens', 'mean_isl']), osl = firstNum(rm, ['tokens.output_actual', 'tokens.output', 'mean_osl']);
46
+ const outPerGpu = firstNum(rm, ['throughput.per_gpu.output_tput_tps', 'output_tput_per_gpu']);
47
+ const hit = firstNum(r, ['server_metrics.cache.gpu_cache_hit_rate', 'request_metrics.cache.theoretical_cache_hit_rate', 'cache_hit_rate']);
48
+ const tp = +(r.decode_tp || r.tp || r.num_gpus || 0), why = [];
49
+ if (!gpu) why.push(`GPU ${r.hw || r.hardware}`); if (!model) why.push(`model ${prefix}`); if (r.disagg) why.push('disaggregated'); if (r.is_multinode) why.push('multi-node');
50
+ if (!(tpot > 0 && outPerGpu > 0 && qps > 0 && e2e > 0 && isl > 0 && osl > 0)) why.push('metrics');
51
+ if (why.length) return { skip: why.join(', ') };
52
+ // seconds, unless the value only makes sense in milliseconds (a TPOT over 5 s, a TTFT or call over 10 minutes)
53
+ const tpotS = tpot > 5 ? tpot / 1000 : tpot, ttftS = ttft != null ? (ttft > 60 ? ttft / 1000 : ttft) : null, e2eS = e2e > 600 ? e2e / 1000 : e2e;
54
+ return { hardware: hw, gpu: gpu.id, model: model.id, prefix, framework: r.framework, precision: r.precision || model.wprec, tp: tp || gpu.domain || 8, dpAttention: !!(r.dp_attention || r.decode_dp_attention),
55
+ conc: +r.conc, inflight: Math.max(1, qps * e2eS), isl, osl, prefixHit: hit != null ? 100 * (hit > 1 ? hit / 100 : hit) : 0, metrics: { tpot: tpotS, ttft: ttftS, outPerGpu } };
56
+ }
57
+
58
+ export function predict(x, over, catalog = C.MODELS) {
59
+ const g = C.GPUS.find(v => v.id === x.gpu), m = catalog.find(v => v.id === x.model);
60
+ const s = Object.assign({}, M.SETTINGS, m, g, { wprec: x.precision, kvprec: 'fp8', avgIn: x.isl, peakIn: x.isl, avgOut: x.osl, peakOut: x.osl, ctx: Math.max(x.isl + x.osl, m.maxCtx || 0), prefixHit: x.prefixHit }, over || {});
61
+ // calls in flight per instance: the run's in-flight calls spread over its instances
62
+ const inst = Math.max(1, Math.round((x.numGpus || x.tp) / x.tp));
63
+ return M.operatingPoint(s, M.derive(s), { g: x.tp, kind: x.dpAttention ? 'DPEP' : 'TPEP', pp: 1, tpl: x.tp }, Math.max(1, Math.round(x.inflight / inst)));
64
+ }
65
+ const lerr = (p, m) => Math.log(p / m);
66
+ const score = (xs, over, cat) => xs.map(x => { const p = predict(x, typeof over === 'function' ? over(x) : over, cat); return { x, tpot: lerr(p.tpot, x.metrics.tpot), thr: lerr(p.outPerGpu, x.metrics.outPerGpu), ttft: x.metrics.ttft ? lerr(p.ttft, x.metrics.ttft) : 0 }; });
67
+ const GRID = []; for (const effDecodeBW of [0.4, 0.55, 0.7, 0.85]) for (const effDecodeComp of [0.03, 0.06, 0.1, 0.2, 0.35]) for (const stepMs of [1.5, 4, 8, 14]) for (const effPrefill of [0.05, 0.15, 0.3, 0.5]) GRID.push({ effDecodeBW, effDecodeComp, stepMs, effPrefill });
68
+ export function fit(xs, cat) { let best = null; for (const g of GRID) { const l = score(xs, g, cat).reduce((a, e) => a + e.tpot ** 2 + e.thr ** 2, 0); if (!best || l < best.l) best = { g, l }; } return best && best.g; }
69
+
70
+ export function run(results, opt = {}) {
71
+ const cat = opt.catalog || C.MODELS, models = Object.assign({}, MODELS, opt.models || {});
72
+ const norm = results.map(r => ({ r, x: normalize(r, models, cat) }));
73
+ const xs = norm.filter(n => !n.x.skip).map(n => Object.assign(n.x, { numGpus: +n.r.num_gpus || n.x.tp }));
74
+ const skipped = {}; for (const n of norm) if (n.x.skip) skipped[n.x.skip] = (skipped[n.x.skip] || 0) + 1;
75
+ const res = { results: results.length, scored: xs.length, skipped, overall: xs.length ? { defaults: summary(score(xs, undefined, cat)) } : null, byGpu: {}, byModel: {}, fits: {} };
76
+ for (const gpu of new Set(xs.map(x => x.gpu))) res.byGpu[gpu] = summary(score(xs.filter(x => x.gpu === gpu), undefined, cat));
77
+ for (const m of new Set(xs.map(x => x.model))) res.byModel[m] = summary(score(xs.filter(x => x.model === m), undefined, cat));
78
+ if (opt.fit && xs.length) {
79
+ // fit per GPU on every other concurrency level, score the rest
80
+ const isTrain = x => { const levels = [...new Set(xs.filter(y => y.gpu === x.gpu).map(y => y.conc))].sort((a, b) => a - b); return levels.indexOf(x.conc) % 2 === 0; };
81
+ for (const gpu of new Set(xs.map(x => x.gpu))) { const tr = xs.filter(x => x.gpu === gpu && isTrain(x)); if (tr.length) res.fits[gpu] = fit(tr, cat); }
82
+ const test = xs.filter(x => !isTrain(x) && res.fits[x.gpu]);
83
+ if (test.length) { res.overall.defaultsTest = summary(score(test, undefined, cat)); res.overall.calibratedTest = summary(score(test, x => res.fits[x.gpu], cat)); }
84
+ }
85
+ return res;
86
+ }
87
+
88
+ const P = x => `${Math.round(x * 100)}%`, B = x => `${x.toFixed(2)}×`;
89
+ export function markdown(R) {
90
+ const row = (n, s) => `| ${n} | ${s.n} | ${P(s.tpot.median)} | ${P(s.tpot.p90)} | ${B(s.tpot.bias)} | ${P(s.thr.median)} | ${P(s.thr.p90)} | ${B(s.thr.bias)} |`;
91
+ const head = '| | Results | TPOT: median error | p90 | predicted ÷ measured | Output tok/s per GPU: median error | p90 | predicted ÷ measured |\n| --- | --- | --- | --- | --- | --- | --- | --- |';
92
+ const L = ['# Inference Sizer against AgentX', '', `${R.scored} of ${R.results} AgentX results scored.${Object.keys(R.skipped).length ? ' Skipped: ' + Object.entries(R.skipped).map(([k, v]) => `${v} (${k})`).join('; ') + '.' : ''}`, '', head];
93
+ if (R.overall) { L.push(row('Sizer defaults', R.overall.defaults)); if (R.overall.calibratedTest) { L.push(row('Defaults, held-out concurrency levels', R.overall.defaultsTest)); L.push(row('**Calibrated per GPU, held-out concurrency levels**', R.overall.calibratedTest)); } }
94
+ L.push('', '| GPU | Results | TPOT error | tok/s error | tok/s predicted ÷ measured |', '| --- | --- | --- | --- | --- |', ...Object.entries(R.byGpu).map(([g, s]) => `| ${g} | ${s.n} | ${P(s.tpot.median)} | ${P(s.thr.median)} | ${B(s.thr.bias)} |`), '');
95
+ return L.join('\n');
96
+ }
97
+
98
+ function readResults(paths) {
99
+ const out = [];
100
+ const add = j => { if (Array.isArray(j)) j.forEach(add); else if (j && (j.data || j.results) && !j.request_metrics) add(j.data || j.results); else if (j && typeof j === 'object') out.push(j); };
101
+ for (const p of paths) {
102
+ const files = fs.statSync(p).isDirectory() ? fs.readdirSync(p).filter(f => f.endsWith('.json')).map(f => path.join(p, f)) : [p];
103
+ for (const f of files) { try { add(JSON.parse(fs.readFileSync(f, 'utf8'))); } catch (e) { throw new Error(`${f}: ${e.message}`); } }
104
+ }
105
+ return out;
106
+ }
107
+
108
+ if (process.argv[1] && fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
109
+ const a = process.argv.slice(2), o = { results: [], hf: [] };
110
+ for (let i = 0; i < a.length; i++) { if (a[i] === '--results') { while (a[i + 1] && !a[i + 1].startsWith('--')) o.results.push(a[++i]); } else if (a[i] === '--hf-config') o.hf.push(a[++i]); else if (a[i] === '--models') o.models = JSON.parse(fs.readFileSync(a[++i], 'utf8')); else o[a[i].replace(/^--/, '')] = true; }
111
+ if (!o.results.length || o.help) { console.log(fs.readFileSync(fileURLToPath(import.meta.url), 'utf8').split('\n').slice(1, 15).map(l => l.replace(/^\/\/ ?/, '')).join('\n')); process.exit(o.results.length ? 0 : 2); }
112
+ const catalog = [...C.MODELS];
113
+ for (const h of o.hf) { const [id, f] = h.split('='); const m = C.fromHFConfig(JSON.parse(fs.readFileSync(f, 'utf8'))).model; catalog.push(Object.assign({}, C.MODEL_DEFAULTS || {}, m, { id })); }
114
+ const R = run(readResults(o.results), { fit: !!o.fit, models: o.models, catalog });
115
+ console.log(o.json ? JSON.stringify(R, null, 1) : o.markdown ? markdown(R) : markdown(R));
116
+ }
@@ -0,0 +1,132 @@
1
+ #!/usr/bin/env node
2
+ // Checks the Inference Sizer against measured runs from InferenceX (SemiAnalysis's open, continuous inference
3
+ // benchmark): for each aggregated, single-node run of a GPU the sizer knows, the sizer predicts time per output token
4
+ // and output tokens/s per GPU for the same layout and concurrency, and compares with what was measured.
5
+ //
6
+ // node inference-sizer/tools/validate-inferencex.mjs [--data benchmarks.json] [--json] [--markdown FILE]
7
+ //
8
+ // Three predictors, so the numbers mean something:
9
+ // roofline the datasheet back-of-envelope: 100% of spec bandwidth and compute, no per-step overhead
10
+ // defaults the sizer as shipped (spec sheet × default efficiencies)
11
+ // calibrated efficiencies fitted per GPU on the 1k-in/1k-out runs, scored only on the 8k/1k and 1k/8k runs
12
+ //
13
+ // Data: a recorded snapshot of the InferenceX public API (the dashboard's test fixture), fetched with git at a pinned
14
+ // commit and checked by SHA-256. It is not copied into this repository (the dashboard repository is GPL-3.0).
15
+ import fs from 'node:fs';
16
+ import os from 'node:os';
17
+ import path from 'node:path';
18
+ import crypto from 'node:crypto';
19
+ import { execFileSync } from 'node:child_process';
20
+ import { createRequire } from 'node:module';
21
+ import { fileURLToPath } from 'node:url';
22
+
23
+ const require = createRequire(import.meta.url);
24
+ const C = require('../src/catalog.js'), M = require('../src/model.js');
25
+
26
+ export const SOURCE = {
27
+ repo: 'https://github.com/SemiAnalysisAI/InferenceX-app', commit: '187628924b6ec899b1f3f771617655dd4cd61d8c',
28
+ path: 'packages/app/cypress/fixtures/api/benchmarks.json', sha256: 'f46823a76cb63248705329f327e1494df02b4dfa4df0898b7ee084c75c20bd52',
29
+ };
30
+ export const GPU = { a100: 'A100', b200: 'B200', b300: 'B300', h200: 'H200', h100: 'H100', mi300x: 'MI300X', mi325x: 'MI325X', mi355x: 'MI355X', gb200: 'GB200-NVL72', gb300: 'GB300-NVL72', vr200: 'VR200-NVL72', mi455x: 'MI455X-Helios' };
31
+ const MODEL = { dsr1: 'deepseek-v3' }; // DeepSeek-R1 has DeepSeek-V3's architecture
32
+
33
+ export function fetchData(cache = path.join(os.homedir(), '.cache', 'aiinfra-tools', 'inferencex', SOURCE.commit.slice(0, 12))) {
34
+ const file = path.join(cache, 'benchmarks.json');
35
+ if (!fs.existsSync(file)) {
36
+ const repo = path.join(cache, 'repo'); fs.mkdirSync(repo, { recursive: true });
37
+ const git = (...a) => execFileSync('git', a, { cwd: repo, stdio: 'pipe', env: Object.assign({}, process.env, { GIT_LFS_SKIP_SMUDGE: '1' }), timeout: 600000 });
38
+ if (!fs.existsSync(path.join(repo, '.git'))) { git('init', '-q'); git('remote', 'add', 'origin', SOURCE.repo); }
39
+ git('fetch', '-q', '--depth', '1', '--filter=blob:none', 'origin', SOURCE.commit);
40
+ fs.writeFileSync(file, git('show', `${SOURCE.commit}:${SOURCE.path}`));
41
+ fs.rmSync(repo, { recursive: true, force: true });
42
+ }
43
+ return check(file);
44
+ }
45
+ function check(file) {
46
+ const buf = fs.readFileSync(file), h = crypto.createHash('sha256').update(buf).digest('hex');
47
+ if (h !== SOURCE.sha256) throw new Error(`${file}: SHA-256 ${h} is not the pinned snapshot's ${SOURCE.sha256}`);
48
+ return JSON.parse(buf.toString());
49
+ }
50
+
51
+ // the same layout and concurrency, predicted by the sizer
52
+ export function predict(r, over) {
53
+ const g = C.GPUS.find(x => x.id === GPU[r.hardware]), m = C.MODELS.find(x => x.id === MODEL[r.model]);
54
+ const s = Object.assign({}, M.SETTINGS, m, g, { wprec: r.precision, kvprec: 'fp8', avgIn: r.isl, peakIn: r.isl, avgOut: r.osl, peakOut: r.osl, ctx: r.isl + r.osl, prefixHit: 0 }, over || {});
55
+ const n = r.decode_tp;
56
+ return M.operatingPoint(s, M.derive(s), { g: n, kind: r.decode_dp_attention ? 'DPEP' : 'TPEP', pp: 1, tpl: n }, r.conc);
57
+ }
58
+ export const usable = rows => rows.filter(r => !r.disagg && !r.is_multinode && GPU[r.hardware] && MODEL[r.model] && r.metrics && r.metrics.median_tpot > 0 && r.metrics.output_tput_per_gpu > 0);
59
+ const ROOF = { effDecodeBW: 1, effDecodeComp: 1, effPrefill: 1, stepMs: 0 };
60
+ const GRID = []; for (const effDecodeBW of [0.4, 0.5, 0.6, 0.7, 0.8, 0.9]) for (const effDecodeComp of [0.02, 0.03, 0.04, 0.06, 0.08, 0.1, 0.15, 0.2, 0.3, 0.45]) for (const stepMs of [1.5, 3, 4.5, 6, 8, 10, 13, 16]) for (const effPrefill of [0.03, 0.05, 0.08, 0.12, 0.2, 0.3, 0.45]) GRID.push({ effDecodeBW, effDecodeComp, stepMs, effPrefill });
61
+
62
+ const lerr = (p, m) => Math.log(p / m); // signed log error: >0 the sizer predicts more than measured
63
+ function score(rs, over) {
64
+ return rs.map(r => { const p = predict(r, typeof over === 'function' ? over(r) : over), m = r.metrics;
65
+ return { r, tpot: lerr(p.tpot, m.median_tpot), thr: lerr(p.outPerGpu, m.output_tput_per_gpu), ttft: lerr(p.ttft, m.median_ttft) }; });
66
+ }
67
+ export function fit(rs) {
68
+ let best = null;
69
+ for (const g of GRID) { const l = score(rs, g).reduce((a, x) => a + x.tpot ** 2 + x.thr ** 2, 0); if (!best || l < best.l) best = { g, l }; }
70
+ return best.g;
71
+ }
72
+ const q = (a, f) => { const s = [...a].sort((x, y) => x - y); return s.length ? s[Math.min(s.length - 1, Math.floor(f * (s.length - 1)))] : NaN; };
73
+ // "off by" as a ratio: exp(|log error|) - 1, so 0.4 means 40% too high or 1.4× too low alike
74
+ export function summary(e) {
75
+ const abs = k => e.map(x => Math.abs(x[k])), sg = k => e.map(x => x[k]);
76
+ const f = x => Math.exp(x) - 1;
77
+ return { n: e.length, tpot: { median: f(q(abs('tpot'), 0.5)), p90: f(q(abs('tpot'), 0.9)), bias: Math.exp(q(sg('tpot'), 0.5)) },
78
+ thr: { median: f(q(abs('thr'), 0.5)), p90: f(q(abs('thr'), 0.9)), bias: Math.exp(q(sg('thr'), 0.5)) }, ttft: { median: f(q(abs('ttft'), 0.5)), bias: Math.exp(q(sg('ttft'), 0.5)) } };
79
+ }
80
+
81
+ export function run(rows) {
82
+ const all = usable(rows), isTrain = r => r.isl === 1024 && r.osl === 1024;
83
+ const train = all.filter(isTrain), test = all.filter(r => !isTrain(r));
84
+ const fits = {}; for (const hw of new Set(train.map(r => r.hardware))) fits[hw] = fit(train.filter(r => r.hardware === hw));
85
+ const cal = r => fits[r.hardware];
86
+ const calTest = test.filter(r => fits[r.hardware]);
87
+ const res = {
88
+ source: SOURCE, rows: rows.length, used: all.length, train: train.length, test: calTest.length,
89
+ dates: [all.map(r => r.date).sort()[0], all.map(r => r.date).sort().pop()],
90
+ overall: { roofline: summary(score(all, ROOF)), defaults: summary(score(all)), defaultsTest: summary(score(calTest)), calibratedTest: summary(score(calTest, cal)), calibratedTrain: summary(score(train, cal)) },
91
+ byGpu: {}, byFramework: {}, byConc: {}, fits,
92
+ };
93
+ for (const hw of new Set(all.map(r => r.hardware))) { const a = all.filter(r => r.hardware === hw), t = calTest.filter(r => r.hardware === hw);
94
+ res.byGpu[hw] = { runs: a.length, defaults: summary(score(a)), calibratedTest: t.length ? summary(score(t, cal)) : null }; }
95
+ for (const fw of new Set(all.map(r => r.framework))) res.byFramework[fw] = summary(score(all.filter(r => r.framework === fw)));
96
+ for (const b of [[1, 8], [16, 32], [64, 1e9]]) res.byConc[`${b[0]}–${b[1] > 1e8 ? '' : b[1]}`] = summary(score(all.filter(r => r.conc >= b[0] && r.conc <= b[1])));
97
+ return res;
98
+ }
99
+
100
+ const P = x => `${Math.round(x * 100)}%`, B = x => `${x.toFixed(2)}×`;
101
+ export function markdown(R) {
102
+ const row = (name, s) => `| ${name} | ${s.n} | ${P(s.tpot.median)} | ${P(s.tpot.p90)} | ${B(s.tpot.bias)} | ${P(s.thr.median)} | ${P(s.thr.p90)} | ${B(s.thr.bias)} |`;
103
+ const head = '| | Runs | TPOT: median error | p90 | median predicted ÷ measured | Output tok/s per GPU: median error | p90 | median predicted ÷ measured |\n| --- | --- | --- | --- | --- | --- | --- | --- |';
104
+ return [`# Inference Sizer against InferenceX`, '',
105
+ `Generated by \`node inference-sizer/tools/validate-inferencex.mjs --markdown\`. Data: ${R.used} measured runs (aggregated, one node) of DeepSeek-R1 on ${Object.keys(R.byGpu).map(h => GPU[h]).join(', ')}, from a snapshot of the [InferenceX](https://github.com/SemiAnalysisAI/InferenceX) public API (runs dated ${R.dates[0]} to ${R.dates[1]}; [snapshot](${SOURCE.repo}/blob/${SOURCE.commit}/${SOURCE.path}), SHA-256 \`${SOURCE.sha256.slice(0, 16)}…\`). For each run the sizer predicts the same layout (TP, DP-attention) at the same concurrency, input and output lengths and precision.`, '',
106
+ 'Error is how far off the prediction is either way, as a ratio: 40% means 1.4× too high or 1.4× too low. "Predicted ÷ measured" says which way: for TPOT, below 1 means the sizer predicts faster tokens than were measured; for throughput, above 1 means it predicts more than was measured. Both are the optimistic direction.', '',
107
+ '## Overall', '', head,
108
+ row('Datasheet roofline (100% of spec, no overhead)', R.overall.roofline),
109
+ row('Sizer defaults', R.overall.defaults),
110
+ row('Sizer defaults, held-out runs only', R.overall.defaultsTest),
111
+ row('**Calibrated per GPU on 1k/1k, scored on 8k/1k and 1k/8k**', R.overall.calibratedTest),
112
+ row('Calibrated, on the runs it was fitted to', R.overall.calibratedTrain), '',
113
+ '## By GPU (sizer defaults; calibrated on held-out runs)', '',
114
+ '| GPU | Runs | Defaults: TPOT error | Defaults: tok/s error | Defaults: tok/s predicted ÷ measured | Calibrated (held out): TPOT error | Calibrated: tok/s error | Fitted efficiencies (decode BW, decode compute, step ms, prefill) |', '| --- | --- | --- | --- | --- | --- | --- | --- |',
115
+ ...Object.entries(R.byGpu).map(([h, g]) => { const f = R.fits[h]; return `| ${GPU[h]} | ${g.runs} | ${P(g.defaults.tpot.median)} | ${P(g.defaults.thr.median)} | ${B(g.defaults.thr.bias)} | ${g.calibratedTest ? P(g.calibratedTest.tpot.median) : '–'} | ${g.calibratedTest ? P(g.calibratedTest.thr.median) : '–'} | ${f ? `${f.effDecodeBW}, ${f.effDecodeComp}, ${f.stepMs}, ${f.effPrefill}` : '–'} |`; }), '',
116
+ '## By framework and concurrency (sizer defaults)', '', '| | Runs | TPOT error | tok/s error | tok/s predicted ÷ measured |', '| --- | --- | --- | --- | --- |',
117
+ ...Object.entries(R.byFramework).map(([k, s]) => `| ${k} | ${s.n} | ${P(s.tpot.median)} | ${P(s.thr.median)} | ${B(s.thr.bias)} |`),
118
+ ...Object.entries(R.byConc).map(([k, s]) => `| concurrency ${k} | ${s.n} | ${P(s.tpot.median)} | ${P(s.thr.median)} | ${B(s.thr.bias)} |`), ''].join('\n');
119
+ }
120
+
121
+ if (process.argv[1] && fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
122
+ const a = process.argv.slice(2), opt = k => { const i = a.indexOf(k); return i >= 0 ? a[i + 1] : undefined; };
123
+ try {
124
+ const rows = opt('--data') ? check(opt('--data')) : fetchData();
125
+ const R = run(rows);
126
+ if (a.includes('--json')) console.log(JSON.stringify(R, null, 1));
127
+ else if (a.includes('--markdown')) { const f = opt('--markdown'); const md = markdown(R); if (f && !f.startsWith('--')) { fs.writeFileSync(f, md); console.log(`wrote ${f}`); } else console.log(md); }
128
+ else { const o = R.overall; const line = (n, s) => console.log(`${n.padEnd(52)} TPOT off by ${P(s.tpot.median)} (p90 ${P(s.tpot.p90)}); tok/s/GPU off by ${P(s.thr.median)} (p90 ${P(s.thr.p90)}); n=${s.n}`);
129
+ console.log(`InferenceX: ${R.used} runs of DeepSeek-R1 on ${Object.keys(R.byGpu).map(h => GPU[h]).join(', ')} (${R.dates[0]} to ${R.dates[1]})`);
130
+ line('datasheet roofline', o.roofline); line('sizer defaults', o.defaults); line('calibrated on 1k/1k, scored on 8k/1k + 1k/8k', o.calibratedTest); }
131
+ } catch (e) { console.error('validate-inferencex: ' + e.message); process.exit(1); }
132
+ }
package/mcp/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # AIInfraTools as an MCP server
2
2
 
3
3
  Every tool as [Model Context Protocol](https://modelcontextprotocol.io) tools, for any MCP client: Claude Code,
4
- Claude Desktop, Cursor, VS Code, your own agents. Node.js 20+, no dependencies, stdio transport.
4
+ Claude Desktop, Cursor, VS Code, your own agents. Node.js 22+, no dependencies, stdio transport.
5
5
 
6
6
  ## Add it
7
7
 
@@ -34,6 +34,11 @@ From a clone instead of npm: `"command": "node", "args": ["/path/to/AIInfraTools
34
34
  | `fleetscope_templates` · `fleetscope_run` · `fleetscope_ask` | simulate a hybrid fleet; plain-English what-ifs | `fleetscope.*` |
35
35
  | `gpu_health_analyze` | health problems, idle and underused GPUs, savings; proposals into the approval queue | `gpu-health.analyze` |
36
36
  | `ledger_report` · `ledger_insights` | GPU-hours and cost by owner (useful, idle, lost); ranked savings | `ledger.*` |
37
+ | `harness_waste` | where agent harnesses (Claude Code, Codex, OTel, Langfuse) waste tokens and money, by cause, tool and session | – |
38
+ | `infra_report` | plan → verify → account on one page: the sizer's GPU count before and after the store's calibration, the last shadow verdict, canaries awaiting approval, agent economics | `aiinfra.report` |
39
+ | `agent_economics` | cost per resolved agent task, fixes ranked by what they save per resolved task, self-hosting vs the API (break-even GPU-hour price; or OpenCost's measured cost) | `harness-ledger.economics` |
40
+ | `shadow_verdict` | an infra change judged against the baseline at matched load: from store records, or a canary's vLLM metrics in Prometheus; records the verdict, and with a plan refits the sizer's calibration | `fleetops.shadow.compare` / `fleetops.shadow.prom` |
41
+ | `canary_status` | where an llm-d canary stands: share, status, a step waiting for approval (advancing and approving stay with a person) | `fleetops.shadow.canary` |
37
42
  | `rca_detect` · `rca_diagnose` | incidents in a window; ranked root causes with evidence | `fleetops.rca.diagnose` |
38
43
  | `power_report` · `power_plan` | power against budget; a plan of GPU power caps | `fleetops.power.*` |
39
44
  | `fix_trace_skew` | clock offsets and ordering violations in OTLP traces | `fix-skew.demo` |
package/mcp/server.mjs CHANGED
@@ -77,6 +77,40 @@ export const TOOLS = [
77
77
  description: 'Ranked savings (idle timeouts, wrong GPU type, oversized serving, commitments…), each with an owner and how it was worked out.',
78
78
  input: { type: 'object', required: ['usage', 'config'], properties: { usage: str('Path to usage.jsonl'), config: str('Path to the ledger config JSON') } },
79
79
  cli: i => ['ledger', 'insights', '--usage', i.usage, '--config', i.config, '--json'] },
80
+ { name: 'harness_waste', title: 'Where agents waste tokens and money', annotations: T,
81
+ description: 'Reads Claude Code transcripts, Codex rollouts, OpenTelemetry GenAI/OpenInference spans or Langfuse exports and reports avoidable tokens and cost by cause (cache misses, oversized and repeated tool output, retry loops, unused tools), harness, tool and session, with fixes. Optional vLLM traces charge self-hosted calls their GPU time. Keeps counts only.',
82
+ input: { type: 'object', required: ['paths'], properties: { paths: str('Files or folders, comma-separated'), prices: str('Price file ($/M tokens per model); examples are used without it'),
83
+ engine: str('vLLM OTLP traces, for GPU time'), replicas: str('Replica GPUs and $/GPU-h (JSON)'), outcomes: str('Session outcomes (JSON or CSV)'), since: str('Only calls after this, e.g. 7d') } },
84
+ cli: i => ['harness-ledger', 'report', ...String(i.paths).split(',').map(s => s.trim()).filter(Boolean)]
85
+ .concat(...[['prices', i.prices], ['engine', i.engine], ['replicas', i.replicas], ['outcomes', i.outcomes], ['since', i.since]].filter(([, v]) => v).map(([k, v]) => [`--${k}`, String(v)]), '--json') },
86
+ { name: 'agent_economics', title: 'Cost per resolved agent task, and self-host vs API', schema: 'harness-ledger.economics', annotations: T,
87
+ description: 'From agent logs or traces (the same inputs as harness_waste): cost per resolved task, fixes ranked by what they save per resolved task, and, with selfHostModel and gpu, the GPU-hour price under which self-hosting an open model beats the API (sized with the Inference Sizer for the busiest day). opencost uses OpenCost\'s measured cost per token instead. A model, not a purchase recommendation.',
88
+ input: { type: 'object', required: ['paths'], properties: { paths: str('Files or folders, comma-separated'), outcomes: str('Session outcomes (JSON or CSV)'), prices: str('Price file ($/M tokens per model), or "relative"'),
89
+ selfHostModel: str('Open model from the sizer catalog, e.g. deepseek-v3'), gpu: str('GPU from the sizer catalog, e.g. H200'), gpuRate: num('$ per GPU-hour, for the monthly cost and the volume where self-hosting wins'),
90
+ selfHostSuccessRate: num('The open model\'s task success rate (0–1), e.g. from SWE-bench'), opencost: str('OpenCost /inferenceCost/total answer (file) for measured self-host cost'), opencostModel: str('Which OpenCost model to use'),
91
+ calibration: str('Sizer calibration profile (fleetops) for measured efficiencies'), days: num('Days the input covers'), tasksPerDay: num('Volume to plan for') } },
92
+ cli: i => ['harness-ledger', 'economics', ...String(i.paths).split(',').map(s => s.trim()).filter(Boolean)]
93
+ .concat(...[['outcomes', i.outcomes], ['prices', i.prices], ['self-host-model', i.selfHostModel], ['gpu', i.gpu], ['gpu-rate', i.gpuRate], ['self-host-success-rate', i.selfHostSuccessRate],
94
+ ['opencost', i.opencost], ['opencost-model', i.opencostModel], ['calibration', i.calibration], ['days', i.days], ['tasks-per-day', i.tasksPerDay]].filter(([, v]) => v !== undefined && v !== null && v !== '').map(([k, v]) => [`--${k}`, String(v)]), '--json') },
95
+ { name: 'infra_report', title: 'Plan → verify → account on one page', schema: 'aiinfra.report', annotations: T,
96
+ description: 'One page from what the tools already keep in a fleetops store: the Inference Sizer\'s GPU count for a model on a GPU before and after the store\'s measured calibration, the last shadow verdict (decision, metric effects, prediction vs measurement), the last promotion, each canary\'s share and any step waiting for a person\'s approval, and, with harness (an agent trace, or "demo"), cost per resolved task and self-hosting economics sized with the calibration. Reads only.',
97
+ input: { type: 'object', properties: { store: str('fleetops store folder'), model: str('Model from the sizer catalog, e.g. llama33-70b (defaults to the only calibrated one)'), gpu: str('GPU from the sizer catalog, e.g. H200'),
98
+ harness: str('Agent trace (file or folder) for economics, or "demo"'), outcomes: str('Session outcomes (JSON or CSV)'), gpuRate: num('$ per GPU-hour'), days: num('Days the trace covers'), tasksPerDay: num('Volume to plan for') } },
99
+ cli: i => ['report'].concat(...[['store', i.store], ['model', i.model], ['gpu', i.gpu], ['harness', i.harness], ['outcomes', i.outcomes], ['gpu-rate', i.gpuRate], ['days', i.days], ['tasks-per-day', i.tasksPerDay]]
100
+ .filter(([, v]) => v !== undefined && v !== null && v !== '').map(([k, v]) => [`--${k}`, String(v)]), '--json') },
101
+ { name: 'shadow_verdict', title: 'Judge an infra change against the baseline', schema: 'fleetops.shadow.compare', schemaFor: i => (i.prom ? 'fleetops.shadow.prom' : 'fleetops.shadow.compare'), annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
102
+ description: 'Compares a candidate (new GPUs, engine, config, topology) with the baseline at matched load: promote, roll back or extend, with each metric\'s effect and interval and the naive number beside it. Either request records in a fleetops store (baseline/candidate as field=value selectors), or a canary\'s per-version vLLM metrics in Prometheus (prom with baselineMatchers/candidateMatchers, e.g. llm_isvc_name="chat-v2"). Sends no traffic and changes no rollout; records the verdict in the store, and with plan refits the sizer\'s calibration when the prediction was off.',
103
+ input: { type: 'object', required: ['store'], properties: { store: str('fleetops store folder'),
104
+ baseline: str('Baseline requests in the store, e.g. variant=baseline'), candidate: str('Candidate requests, e.g. variant=candidate'),
105
+ prom: str('Prometheus URL (instead of store records)'), baselineMatchers: str('Prometheus label matchers for the baseline'), candidateMatchers: str('Prometheus label matchers for the candidate'),
106
+ select: str('Matchers both versions share, e.g. namespace="llm"'), lookback: num('Seconds of canary traffic to judge', { default: 3600 }), plan: str('plan.json from shadow plan (prediction vs measurement)') } },
107
+ cli: i => (i.prom
108
+ ? opt(opt(opt(['fleetops', 'shadow', 'prom', '--prom', i.prom, '--baseline', i.baselineMatchers || '', '--candidate', i.candidateMatchers || '', '--store', i.store], '--select', i.select), '--lookback', i.lookback), '--plan', i.plan)
109
+ : opt(['fleetops', 'shadow', 'compare', '--baseline', i.baseline || '', '--candidate', i.candidate || '', '--store', i.store], '--plan', i.plan)).concat('--json') },
110
+ { name: 'canary_status', title: 'Where an llm-d canary stands', schema: 'fleetops.shadow.canary', annotations: T,
111
+ description: 'An llm-d canary driven by the shadow judge: its share of traffic, status, a step waiting for approval, and its history. Read-only: advancing the canary or approving a step is done by a person outside this server.',
112
+ input: { type: 'object', required: ['store', 'name'], properties: { store: str('fleetops store folder'), name: str('Canary name') } },
113
+ cli: i => ['fleetops', 'shadow', 'canary', 'status', '--name', i.name, '--store', i.store, '--json'] },
80
114
  { name: 'rca_diagnose', title: 'Root cause of an incident', schema: 'fleetops.rca.diagnose', annotations: T,
81
115
  description: 'Ranks root-cause hypotheses for job failures, a latency regression or device faults in a window, with the evidence for each.',
82
116
  input: { type: 'object', required: ['store', 'symptom', 'from', 'to'], properties: { store: str('fleetops store folder'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiinfra-tools",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Open tools for running GPU fleets: size inference, simulate capacity, find root causes, cap power, deploy on llm-d, and charge back GPU-hours. No dependencies.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -23,10 +23,11 @@
23
23
  "llm-d",
24
24
  "root-cause-analysis",
25
25
  "chargeback",
26
+ "agent-harness",
26
27
  "agent-skills"
27
28
  ],
28
29
  "engines": {
29
- "node": ">=20"
30
+ "node": ">=22"
30
31
  },
31
32
  "bin": {
32
33
  "aiinfra-tools": "bin/aiinfra.mjs",
@@ -37,7 +38,8 @@
37
38
  "inference-sizer": "inference-sizer/tools/size.mjs",
38
39
  "fleetscope": "fleetscope/tools/fleetscope.mjs",
39
40
  "fix-skew": "hybrid-tracing/tools/fix-skew.mjs",
40
- "aiinfra-mcp": "mcp/server.mjs"
41
+ "aiinfra-mcp": "mcp/server.mjs",
42
+ "harness-ledger": "harness-ledger/tools/harness-ledger.mjs"
41
43
  },
42
44
  "files": [
43
45
  "bin/",
@@ -53,6 +55,7 @@
53
55
  "inference-sizer/",
54
56
  "fleetscope/",
55
57
  "hybrid-tracing/",
58
+ "harness-ledger/",
56
59
  "!**/tests/**",
57
60
  "!**/node_modules/**",
58
61
  "!fleetops/fleet-data/**",
@@ -66,10 +69,11 @@
66
69
  ],
67
70
  "scripts": {
68
71
  "test": "node --test tests/*.test.mjs",
69
- "test:all": "for t in fleetops gpu-health fleetscope inference-sizer hybrid-tracing gpu-ledger; do (cd $t && npm test) || exit 1; done"
72
+ "lint": "eslint .",
73
+ "check:formats": "node scripts/check-formats.mjs",
74
+ "test:all": "for t in fleetops gpu-health fleetscope inference-sizer hybrid-tracing gpu-ledger harness-ledger; do (cd $t && npm test) || exit 1; done"
70
75
  },
71
76
  "publishConfig": {
72
- "access": "public",
73
- "provenance": true
77
+ "access": "public"
74
78
  }
75
79
  }
package/schemas/README.md CHANGED
@@ -12,6 +12,9 @@ and scripts rely on, so you can build on them and know when they change.
12
12
  | `fleetops.rca.diagnose` | `aiinfra fleetops rca diagnose --symptom S --from T --to T` |
13
13
  | `fleetops.serving.fit` · `fleetops.serving.capacity` | `aiinfra fleetops serving fit …` · `serving capacity --model M …` |
14
14
  | `fleetops.power.report` · `fleetops.power.plan` | `aiinfra fleetops power report …` · `power plan …` |
15
+ | `fleetops.shadow.compare` · `fleetops.shadow.prom` · `fleetops.shadow.canary` | `aiinfra fleetops shadow compare …` · `shadow prom …` · `shadow canary status --name N` |
16
+ | `aiinfra.report` | `aiinfra report --store DIR --model M --gpu G [--harness PATH]` (or `--demo`) |
17
+ | `harness-ledger.economics` | `aiinfra harness-ledger economics PATH… [--self-host-model M --gpu G \| --opencost F]` |
15
18
  | `fix-skew.demo` | `aiinfra fix-skew --demo` (the same shape as for your traces) |
16
19
 
17
20
  **The contract.** A field listed in `required` is always there, with the type shown. New fields may appear at any