Initial import of streamline
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="zh"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Eddy export · local fixture</title></head><body><div id="root"></div><script type="module" src="./eddy-export.tsx"></script></body></html>
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
// Real export components, deterministic local API fixture. No production traffic.
|
||||
import React, { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { EddyExportBadge } from "../../src/components/EddyExportPanel";
|
||||
import StatsStrip from "../../src/components/StatsStrip";
|
||||
import { applyClusterSnapshot } from "../../src/lib/clusterStore";
|
||||
import type { ClusterNode } from "../../src/types";
|
||||
import RelayDialog from "../../src/components/RelayDialog";
|
||||
import { setLang } from "../../src/lib/i18n";
|
||||
import type { Feature } from "../../src/types";
|
||||
import type { EddyExport } from "@bbbug/shared/eddy_export";
|
||||
import "../../src/styles.css";
|
||||
setLang("zh");
|
||||
const feature = { id: "eddy-export-fixture", title: "给收藏列表增加排序入口", platform: "ios", status: "completed", branchName: "feature/collection-sort", repoKey: "tiktok-ios", mrUrl: "https://mr.invalid/123", executorNodeId: "fei-ios-01.shiro0.icu" } as Feature;
|
||||
const record: EddyExport = { id: "11111111-2222-4333-8444-555555555555", featureId: feature.id, nodeId: "fei-ios-01.shiro0.icu", commit: "1234567890abcdef1234567890abcdef12345678", branch: feature.branchName!, phase: "ready", createdAt: Date.now(), updatedAt: Date.now(), expiresAt: Date.now() + 7 * 86400_000, error: null,
|
||||
result: { baselineId: "tiktokm-fixture", commit: "1234567890abcdef1234567890abcdef12345678", eddyVersion: "v2.8", devicesimSha256: "a".repeat(64), artifacts: { app: { file: "baseline-tiktokm-fixture.zip", bytes: 782000000, sha256: "b".repeat(64) }, source: { file: "baseline-tiktokm-fixture-source.zip", bytes: 418000000, sha256: "c".repeat(64) } } } };
|
||||
let jobs: EddyExport[] = [], serviceEnabled = true, creates = 0;
|
||||
// Two satellites: the executor and a peer. Each mode sets which is up and what the job is doing.
|
||||
const sat = (id: string, live: boolean, fixInFlight: number): ClusterNode => ({ id, baseUrl: "", platform: "ios", status: live ? "online" : "offline", live,
|
||||
lastSeenAt: Date.now(), evalInFlight: 0, evalCapacity: 3, fixInFlight, fixCapacity: 1, createdAt: 0, clusters: ["default"] } as ClusterNode);
|
||||
const fleet = (home: [boolean, number], peer: [boolean, number]) =>
|
||||
applyClusterSnapshot({ nodes: [sat("fei-ios-01.shiro0.icu", ...home), sat("fei-ios-02.shiro0.icu", ...peer)], eval: { inFlight: 0, capacity: 6 }, fix: { inFlight: home[1] + peer[1], capacity: 2 } });
|
||||
fleet([true, 0], [true, 0]);
|
||||
window.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const url = String(input);
|
||||
if (url.endsWith("/handover")) return new Response("# Local relay fixture\n");
|
||||
if (url.endsWith("/lab-runs/running")) return Response.json({ runs: [] });
|
||||
if (url.endsWith("/eddy-exports/running")) return Response.json({ exports: jobs.filter(j => ["building", "packaging", "verifying", "uploading"].includes(j.phase))
|
||||
.map(j => ({ id: j.id, featureId: j.featureId, title: feature.title, nodeId: j.nodeId, phase: j.phase })) });
|
||||
if (!url.endsWith("/eddy-exports")) throw new Error("Fixture refuses network: " + url);
|
||||
if (init?.method === "POST") { creates++; jobs = [{ ...record, phase: "queued", result: null, expiresAt: null }]; return Response.json({ export: jobs[0] }); }
|
||||
return Response.json({ enabled: serviceEnabled, exports: jobs });
|
||||
}) as typeof fetch;
|
||||
function Fixture() {
|
||||
const [version, setVersion] = useState(0);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [platform, setPlatform] = useState<"ios" | "android">("ios");
|
||||
const mode = (phase: string) => {
|
||||
serviceEnabled = phase !== "disabled";
|
||||
const [state, where] = phase.split(":");
|
||||
// queued:busy — executor running another task; queued:offline — executor gone; queued:moved — rerouted to a busy peer.
|
||||
fleet(where === "offline" ? [false, 0] : [true, where === "busy" ? 1 : state === "building" ? 1 : 0], [true, where === "moved" ? 1 : 0]);
|
||||
jobs = ["empty", "disabled"].includes(state) ? [] : [{ ...record, phase: state as EddyExport["phase"], nodeId: where === "moved" ? "fei-ios-02.shiro0.icu" : record.nodeId,
|
||||
error: state === "failed" ? "卫星机执行中断或失去连接,可重试导出" : null }];
|
||||
setVersion(v => v + 1);
|
||||
};
|
||||
return <main style={{ maxWidth: 780, height: "100vh", overflow: "auto", margin: "0 auto", padding: 24 }}>
|
||||
<p>本地界面验证 · 示例数据 · 不连接线上</p>
|
||||
<div style={{ display: "flex", gap: 8, flexWrap: "wrap", marginBottom: 24 }}>{["empty", "queued", "queued:busy", "queued:offline", "queued:moved", "building", "ready", "failed", "expired", "disabled"].map(s => <button key={s} onClick={() => mode(s)}>{s}</button>)}</div>
|
||||
<button onClick={() => setPlatform(p => p === "ios" ? "android" : "ios")}>切换平台</button>
|
||||
<h2>{feature.title}</h2><p>Feature · {platform} · 已完成</p>
|
||||
{platform === "ios" && jobs[0] && <EddyExportBadge job={jobs[0]} />}
|
||||
<button onClick={() => setOpen(true)}>接力到本地</button>
|
||||
{open && <RelayDialog key={version + platform} item={{ ...feature, kind: "feature", platform }} onClose={() => setOpen(false)} onChanged={() => setVersion(v => v + 1)} />}
|
||||
<output>创建请求:{creates}</output>
|
||||
<div style={{ width: 300, marginTop: 24 }}><StatsStrip key={version} running={[]} queued={[]} evaluating={[]} awaitingEval={[]} onOpenTask={() => {}} onOpenFeature={() => setOpen(true)} /></div>
|
||||
</main>;
|
||||
}
|
||||
createRoot(document.getElementById("root")!).render(<Fixture />);
|
||||
+1
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="zh"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Eddy history fixture</title></head><body><div id="root"></div><script type="module" src="./eddy-history.tsx"></script></body></html>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import React from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import EddyTasksPage from '../../src/components/EddyTasksPage';
|
||||
import '../../src/styles.css';
|
||||
|
||||
// Browser fixture; no API is supplied here. The harness serves isolated synthetic data.
|
||||
createRoot(document.getElementById('root')!).render(<React.StrictMode><EddyTasksPage email="history-browser@example.com" onLogin={() => { document.documentElement.dataset.relogin = 'requested'; }} /></React.StrictMode>);
|
||||
+1
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="zh"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Eddy knowledge review · local fixture</title></head><body><div id="root"></div><script type="module" src="./eddy-review.tsx"></script></body></html>
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// Local rendering of real review components. No server or production requests.
|
||||
import React from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import DialogHost from "../../src/components/DialogHost";
|
||||
import EddyCompatPanel from "../../src/components/EddyCompatPanel";
|
||||
import { api } from "../../src/lib/api";
|
||||
import "../../src/styles.css";
|
||||
const baseline = 'notes-build-a';
|
||||
const source = '// review fixture: never execute\nreturn { install(ctx) { ctx.status("installed") }, dispose() {} };';
|
||||
const bytes = new TextEncoder().encode(source);
|
||||
const sha = Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", bytes))).map(x=>x.toString(16).padStart(2,'0')).join('');
|
||||
const knowledge = {category:'app-compat',confidence:'suspected',summary:'Notes Catalyst 布局递归:启动后无响应',cause:'父布局回调反复请求子布局',solution:'仅在指定调用栈中抑制重复布局请求',validation:'冷启动 120 秒,内存稳定;未验证真机',rollback:'移除 guard 后下次启动恢复原逻辑'};
|
||||
const fix = {knowledge,safety:{verdict:'allow',reason:'已自动检查:仅限定进程内布局,无外传行为'}, id:'fixture-layout',rev:1,tier:'frida-guard',problem:'hang:layout',title:'只抑制递归布局请求',state:'published',baseline,author:'local fixture',created:Date.now(),confirmations:{installed:0,stillFailing:0,regression:0},target:{baseline,executableUUID:'EXACT-BUILD-UUID'},runtimeContract:'eddy-compat-js-v1',payload:{path:'guard.js',sha256:sha},verify:{scope:'启动到登录页',durationSeconds:120,finalMiB:156},evidence:{sourceUnchanged:true,uncovered:['真实账号登录','真机回归']},verification:null };
|
||||
const overview = { baselines:[], observations:[], fixes:[fix], problems:[{knowledge,baseline,signature:'hang:window',aliases:['hang:layout'],kind:'hang',status:'open',firstSeen:Date.now(),lastSeen:Date.now(),scope:{platform:'Catalyst'}},{baseline:'other-build',signature:'hang:window',aliases:[],kind:'hang',status:'open',firstSeen:Date.now(),lastSeen:Date.now(),scope:{}}], advisories:[{knowledge,safety:{verdict:'allow',reason:'检查通过'}, id:'fixture-advice',baseline,problem:'hang:layout',title:'Notes Catalyst 布局循环:启动后无响应',text:'## 现象\n启动后主线程卡住,内存持续增长。\n\n## 根因\n父布局回调再次请求子视图布局,形成循环。\n\n## 处理\n只在指定调用栈中抑制重复布局请求。保持源码不变。\n\n**验证边界:** 冷启动持续 120 秒,未覆盖登录与完整业务回归。\n\n`<script>alert("must not execute")</script>`',state:'verified',manual:false,author:'local fixture',scope:{}}] };
|
||||
overview.problems.push({knowledge:{...knowledge,category:'devicesim',summary:'Catalyst 窗口尺寸变化导致容器渲染异常'},baseline,signature:'layout:window',aliases:[],kind:'layout',status:'open',firstSeen:Date.now(),lastSeen:Date.now(),scope:{platform:'Catalyst'}});
|
||||
api.eddyAdmin = async <T,>(path: string, init?: RequestInit): Promise<T> => {
|
||||
if (init?.method === 'POST') throw new Error('只读本地 fixture,不写入服务');
|
||||
if (path.endsWith('/overview')) return structuredClone(overview) as T;
|
||||
if (path.includes('/compat/packs/')) return {manifest:{id:fix.id,rev:1,target:fix.target},payload_b64:btoa(source),payload_name:'guard.js',sha256:sha} as T;
|
||||
throw new Error('Unexpected fixture request '+path);
|
||||
};
|
||||
createRoot(document.getElementById('root')!).render(<main style={{maxWidth:1200,height:'100vh',overflow:'auto',margin:'0 auto',padding:24}}><p>本地审核界面预览 · 示例数据 · 不连接线上</p><EddyCompatPanel /><DialogHost /></main>);
|
||||
@@ -0,0 +1,3 @@
|
||||
<!doctype html>
|
||||
<html lang="zh"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Product profiles · local UI fixture</title></head>
|
||||
<body><div id="root"></div><script type="module" src="./product-profiles.tsx"></script></body></html>
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Browser-only fixture. Real components, in-memory API, no production services.
|
||||
import React, { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import Management from "../../src/components/Management";
|
||||
import ImportDialog from "../../src/components/ImportDialog";
|
||||
import { api } from "../../src/lib/api";
|
||||
import { useI18n, setLang } from "../../src/lib/i18n";
|
||||
import { defaultProductProfiles, validateProductProfiles } from "@bbbug/shared/product_profiles";
|
||||
import "../../src/styles.css";
|
||||
|
||||
let saved = defaultProductProfiles();
|
||||
let lastRequest: unknown = null;
|
||||
api.adminProductProfiles = async () => structuredClone(saved);
|
||||
api.productProfiles = async () => ({ ...structuredClone(saved), profiles: structuredClone(saved.profiles.filter((p) => p.enabled)) });
|
||||
api.saveProductProfiles = async (config) => {
|
||||
if (config.revision !== saved.revision) throw new Error("Configuration changed. Reload before saving.");
|
||||
saved = { revision: saved.revision + 1, profiles: validateProductProfiles(config.profiles) };
|
||||
return structuredClone(saved);
|
||||
};
|
||||
api.clustersList = async () => ({ clusters: ["default"] });
|
||||
api.import = async (...args) => { lastRequest = args; return { added: [], skipped: [{ link: "local fixture", reason: JSON.stringify(args) }] }; };
|
||||
api.createFeature = async (input) => { lastRequest = input; throw new Error(`Local fixture only: ${JSON.stringify(input)}`); };
|
||||
setLang("zh");
|
||||
function Fixture() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [request, setRequest] = useState<unknown>(null);
|
||||
const { lang } = useI18n();
|
||||
return <main style={{ maxWidth: 1120, padding: 24, margin: "0 auto" }}>
|
||||
<header style={{ display: "flex", gap: 12, alignItems: "center", marginBottom: 20 }}><h2 style={{ marginRight: "auto" }}>Streamline</h2><span>Local UI fixture</span><button onClick={() => setLang(lang === "zh" ? "en" : "zh")}>中 / EN</button><button className="primary" onClick={() => setOpen(true)}>创建任务</button><button onClick={() => setRequest(lastRequest)}>检查请求</button></header>
|
||||
<Management supers={[]} admins={[]} onSave={async () => {}} nodes={[]} initialTab="products" />
|
||||
<ImportDialog open={open} onClose={() => setOpen(false)} />
|
||||
{request != null && <pre>{JSON.stringify(request, null, 2)}</pre>}
|
||||
</main>;
|
||||
}
|
||||
createRoot(document.getElementById("root")!).render(<Fixture />);
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
<!doctype html>
|
||||
<html lang="zh"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Claude usage · local UI fixture</title></head>
|
||||
<body><div id="root"></div><script type="module" src="./usage.tsx"></script></body></html>
|
||||
Vendored
+215
@@ -0,0 +1,215 @@
|
||||
// Browser-only fixture. Real Management/UsagePanel, no SSO, no production API.
|
||||
import { createRoot } from "react-dom/client";
|
||||
import Management from "../../src/components/Management";
|
||||
import type { ClusterNode } from "../../src/types";
|
||||
import type { ClaudeUsage, ClaudeTokenTotals, NodeMetrics, ClaudeSourceDay } from "@bbbug/shared/protocol";
|
||||
import { claudeApiCostUsd, claudeTokenTotal } from "@bbbug/shared/protocol";
|
||||
import type { ClaudeUsageSource } from "@bbbug/shared/claude_usage_source";
|
||||
import { api } from "../../src/lib/api";
|
||||
import { setLang } from "../../src/lib/i18n";
|
||||
import "../../src/styles.css";
|
||||
|
||||
const now = Date.now();
|
||||
|
||||
function metrics(usage: ClaudeUsage | null, over: Partial<NodeMetrics> = {}): NodeMetrics {
|
||||
return {
|
||||
at: now - 8_000, cores: 10, cpuPct: 22, loadPct: 31, uptimeSec: 86_400,
|
||||
diskUsedPct: 54, diskFreeBytes: 220e9, memTotalBytes: 32 * 2 ** 30,
|
||||
memUsedPct: 61, swapUsedBytes: 1.2 * 2 ** 30,
|
||||
slowAt: now - 20_000, slowError: null, slowMs: 240,
|
||||
agent: { mode: "pty", loggedIn: true, authMethod: "claude.ai", checkedAt: now - 20_000, error: null, authGateMs: 0 },
|
||||
claudeUsage: usage,
|
||||
...over,
|
||||
};
|
||||
}
|
||||
|
||||
function node(over: Partial<ClusterNode> & { id: string; platform: ClusterNode["platform"] }): ClusterNode {
|
||||
return {
|
||||
baseUrl: `http://${over.id}:5180`,
|
||||
status: "online", lastSeenAt: now - 4_000,
|
||||
evalInFlight: 0, evalCapacity: 3, fixInFlight: 0, fixCapacity: 1,
|
||||
version: "local-fixture", createdAt: now - 86400_000, live: true,
|
||||
clusters: ["default"],
|
||||
...over,
|
||||
};
|
||||
}
|
||||
|
||||
const day = 86_400_000;
|
||||
|
||||
/**
|
||||
* A `days`-long daily series ending today, scaled off the lifetime totals so
|
||||
* the window numbers stay plausible next to them.
|
||||
*/
|
||||
function dailySeries(tokens: ClaudeTokenTotals, days: number) {
|
||||
const share = 1 / (days * 6);
|
||||
return Array.from({ length: days }, (_, i) => {
|
||||
const tick = { date: new Date(now - (days - 1 - i) * day).toISOString().slice(0, 10) };
|
||||
const scale = share * (i % 5 === 0 ? 0 : 1);
|
||||
const t: ClaudeTokenTotals = {
|
||||
input: Math.round(tokens.input * scale),
|
||||
output: Math.round(tokens.output * scale),
|
||||
cacheRead: Math.round(tokens.cacheRead * scale),
|
||||
cacheCreation: Math.round(tokens.cacheCreation * scale),
|
||||
};
|
||||
const apiCostUsd = claudeApiCostUsd(t, "sonnet");
|
||||
return { ...tick, tokens: t, apiCostUsd, bySource: splitDay(claudeTokenTotal(t), apiCostUsd, i, days) };
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* [token share, API-price share] per source, from the 10-29 scan of the real
|
||||
* fleet (evaluator-android-01 / fei-ios-01). The two columns differ on purpose:
|
||||
* report generation is a sliver of the tokens but a real slice of the price.
|
||||
*/
|
||||
const SOURCE_MIX: [ClaudeUsageSource, number, number][] = [
|
||||
["bugfix", 0.70, 0.66], ["feature", 0.13, 0.12], ["verify", 0.08, 0.075], ["eval", 0.055, 0.07],
|
||||
["asking", 0.008, 0.012], ["asking_edit", 0.004, 0.006], ["report", 0.003, 0.03],
|
||||
["human", 0.006, 0.008], ["rsi", 0.001, 0.01], ["eddy", 0.0005, 0.001],
|
||||
];
|
||||
|
||||
/** Split one machine-day; 未识别 ramps up over the last ten days so the 增长 flag has something to flag. */
|
||||
function splitDay(tokens: number, usd: number, i: number, days: number): ClaudeSourceDay[] {
|
||||
if (tokens <= 0) return [];
|
||||
const unknown = i >= days - 10 ? 0.004 * (i - (days - 11)) : 0.002;
|
||||
const mix: [ClaudeUsageSource, number, number][] = [...SOURCE_MIX, ["unknown", unknown, unknown]];
|
||||
const tw = mix.reduce((a, m) => a + m[1], 0);
|
||||
const uw = mix.reduce((a, m) => a + m[2], 0);
|
||||
return mix.map(([source, t, u], k) => ({
|
||||
source,
|
||||
tokens: Math.round(tokens * t / tw),
|
||||
apiCostUsd: usd * u / uw,
|
||||
sessions: Math.max(1, Math.round(((k * 7 + i) % 5) + t * 40)),
|
||||
}));
|
||||
}
|
||||
|
||||
function makeUsage(
|
||||
{ coveredDays = 30, ...over }: Partial<ClaudeUsage> & {
|
||||
tokens: ClaudeTokenTotals; tokensAsOf: string; startedAt: number; coveredDays?: number;
|
||||
},
|
||||
): ClaudeUsage {
|
||||
return {
|
||||
at: now - 35_000, ms: 290, error: null,
|
||||
email: null, plan: "max", machineId: null,
|
||||
fiveHour: null, sevenDay: null, sevenDaySonnet: null, sevenDayOpus: null,
|
||||
quotaAt: null,
|
||||
apiCostUsd: claudeApiCostUsd(over.tokens, "sonnet"),
|
||||
daily: dailySeries(over.tokens, coveredDays),
|
||||
dailyFromAt: now - (coveredDays - 1) * day,
|
||||
...over,
|
||||
};
|
||||
}
|
||||
const nodes: ClusterNode[] = [
|
||||
// A Mac running two satellites: same machineId, same account. Both cards
|
||||
// show the machine's tokens; the fleet totals count them once.
|
||||
node({
|
||||
id: "lemon-ios-01.shiro0.icu", platform: "ios",
|
||||
metrics: metrics(makeUsage({
|
||||
email: "lemon@bytedance.com", machineId: "mach-lemon",
|
||||
fiveHour: { usedPct: 91, resetsAt: now + 48 * 60_000 },
|
||||
sevenDay: { usedPct: 67, resetsAt: now + 2 * day },
|
||||
quotaAt: now - 35_000,
|
||||
tokens: { input: 12_400_000, output: 980_000, cacheRead: 88_000_000, cacheCreation: 6_200_000 },
|
||||
tokensAsOf: "2026-09-12",
|
||||
startedAt: now - 265 * day,
|
||||
})),
|
||||
}),
|
||||
node({
|
||||
id: "lemon-android-01.shiro0.icu", platform: "android",
|
||||
metrics: metrics(makeUsage({
|
||||
at: now - 41_000, ms: 310,
|
||||
email: "lemon@bytedance.com", machineId: "mach-lemon",
|
||||
fiveHour: { usedPct: 91, resetsAt: now + 48 * 60_000 },
|
||||
sevenDay: { usedPct: 67, resetsAt: now + 2 * day },
|
||||
quotaAt: now - 41_000,
|
||||
tokens: { input: 12_400_000, output: 980_000, cacheRead: 88_000_000, cacheCreation: 6_200_000 },
|
||||
tokensAsOf: "2026-09-12",
|
||||
startedAt: now - 265 * day,
|
||||
})),
|
||||
}),
|
||||
// Own probe 429'd, so its meters must fill from the sibling on the same
|
||||
// account and say so, rather than reading 未知.
|
||||
node({
|
||||
id: "fei-android-01.shiro0.icu", platform: "android",
|
||||
metrics: metrics(makeUsage({
|
||||
at: now - 12_000, ms: 268, error: "oauth usage HTTP 429",
|
||||
email: "fei@bytedance.com", machineId: "mach-fei-a",
|
||||
tokens: { input: 7_800_000, output: 620_000, cacheRead: 40_000_000, cacheCreation: 2_400_000 },
|
||||
tokensAsOf: "2026-09-11",
|
||||
startedAt: now - 40 * day,
|
||||
})),
|
||||
}),
|
||||
// Same Claude login, different Mac: quota shared, tokens NOT merged.
|
||||
node({
|
||||
id: "fei-ios-01.shiro0.icu", platform: "ios",
|
||||
metrics: metrics(makeUsage({
|
||||
email: "fei@bytedance.com", machineId: "mach-fei-i",
|
||||
fiveHour: { usedPct: 38, resetsAt: now + 3 * 3600_000 },
|
||||
sevenDay: { usedPct: 52, resetsAt: now + 2 * day },
|
||||
quotaAt: now - 35_000,
|
||||
tokens: { input: 4_200_000, output: 410_000, cacheRead: 21_000_000, cacheCreation: 1_100_000 },
|
||||
tokensAsOf: "2026-09-12",
|
||||
startedAt: now - 80 * day,
|
||||
})),
|
||||
}),
|
||||
// Enrolled 9 days ago: prorates to $200 × 9/30 instead of a full month.
|
||||
node({
|
||||
id: "ux-ios-01.shiro0.icu", platform: "ios",
|
||||
metrics: metrics(makeUsage({
|
||||
email: "ux@bytedance.com", machineId: "mach-ux",
|
||||
fiveHour: { usedPct: 12, resetsAt: now + 90 * 60_000 },
|
||||
sevenDay: { usedPct: 21, resetsAt: now + day },
|
||||
quotaAt: now - 35_000,
|
||||
tokens: { input: 3_272, output: 1_289_779, cacheRead: 372_006_214, cacheCreation: 4_336_744 },
|
||||
tokensAsOf: "2026-09-12",
|
||||
startedAt: now - 9 * day,
|
||||
coveredDays: 9,
|
||||
})),
|
||||
}),
|
||||
node({
|
||||
id: "fei-android-02.shiro0.icu", platform: "android",
|
||||
metrics: metrics(null),
|
||||
}),
|
||||
// Satellite too old for a daily series: left out of the window totals and
|
||||
// called out, not silently counted as zero.
|
||||
node({
|
||||
id: "fei-ios-03.shiro0.icu", platform: "ios",
|
||||
live: false, status: "offline", lastSeenAt: now - 18 * 60_000,
|
||||
metrics: metrics({
|
||||
...makeUsage({
|
||||
at: now - 20 * 60_000, ms: 301,
|
||||
email: "ios-03@bytedance.com",
|
||||
fiveHour: { usedPct: 12, resetsAt: now - 10 * 60_000 },
|
||||
sevenDay: { usedPct: 44, resetsAt: now + day },
|
||||
tokens: { input: 1_050_000, output: 90_000, cacheRead: 3_400_000, cacheCreation: 220_000 },
|
||||
tokensAsOf: "2026-09-10",
|
||||
startedAt: now - 12 * day,
|
||||
}),
|
||||
daily: null, dailyFromAt: null,
|
||||
}),
|
||||
}),
|
||||
];
|
||||
|
||||
// The usage tab fetches its per-source detail itself; serve it from the
|
||||
// fixture nodes instead of a control plane.
|
||||
(api as { claudeSources: typeof api.claudeSources }).claudeSources = async () => ({
|
||||
entries: nodes.flatMap((n) => {
|
||||
const usage = n.metrics?.claudeUsage;
|
||||
if (!usage) return [];
|
||||
const withSamples: ClaudeUsage = usage.machineId === "mach-lemon"
|
||||
? { ...usage, unknownSamples: [
|
||||
{ prefix: "帮我把 feature/qi-story-widget-thought-sticky rebase 到 develop", cwd: "ai_workspace", sessions: 1, tokens: 20_800_000 },
|
||||
{ prefix: "I do git fetch --refetch on TikTok and return", cwd: "ai_workspace_ios", sessions: 2, tokens: 1_300_000 },
|
||||
] }
|
||||
: usage;
|
||||
return [{ nodeId: n.id, usage: withSamples }];
|
||||
}),
|
||||
});
|
||||
|
||||
setLang("zh");
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<div className="page-modal" style={{ position: "static", inset: "auto", width: "100%", minHeight: "100vh", borderRadius: 0 }}>
|
||||
<div className="page-modal-body" style={{ padding: "24px 32px 48px" }}>
|
||||
<Management supers={[]} admins={[]} onSave={async () => {}} nodes={nodes} initialTab="usage" />
|
||||
</div>
|
||||
</div>,
|
||||
);
|
||||
Reference in New Issue
Block a user