lemma-agent 1.0.1 → 1.1.1
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.
- package/README.md +29 -0
- package/dist/account-discovery.js +159 -0
- package/dist/admin.js +20 -1
- package/dist/api-member.js +18 -5
- package/dist/app.js +45 -6
- package/dist/bridge.js +341 -0
- package/dist/config.js +157 -0
- package/dist/credentials.js +11 -0
- package/dist/dispatch.js +37 -23
- package/dist/main.js +34 -1
- package/dist/proxy.js +1251 -0
- package/dist/redact.js +185 -0
- package/dist/tools.js +2 -2
- package/package.json +3 -2
- package/web/js/views.js +40 -0
package/dist/redact.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { createHmac, randomBytes } from "node:crypto";
|
|
2
|
+
const PLACEHOLDER_PREFIX = "{{LEMMA_SECRET_";
|
|
3
|
+
const PLACEHOLDER_RE = /\{\{LEMMA_SECRET_[A-Z0-9_]+_[a-f0-9]{8}\}\}/g;
|
|
4
|
+
const MAX_PLACEHOLDER_TAIL = 80;
|
|
5
|
+
const DUMMY_VALUE_RE = /^(?:your[-_]|xxx+|example|changeme|placeholder|dummy|test[-_]key|<[^>]+>|\$\{[^}]+\})/i;
|
|
6
|
+
const BUILTIN_RULES = [
|
|
7
|
+
{ kind: "PRIVATE_KEY", regex: /-----BEGIN [A-Z0-9 ]+PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]+PRIVATE KEY-----/g },
|
|
8
|
+
{ kind: "ANTHROPIC_KEY", regex: /\bsk-ant-[A-Za-z0-9_-]{20,}\b/g },
|
|
9
|
+
{ kind: "OPENAI_KEY", regex: /\bsk-(?:proj-|svcacct-)?[A-Za-z0-9_-]{20,}\b/g },
|
|
10
|
+
{ kind: "GEMINI_KEY", regex: /\bAIza[0-9A-Za-z_-]{35,}\b/g },
|
|
11
|
+
{ kind: "GITHUB_TOKEN", regex: /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{30,}\b|\bgithub_pat_[A-Za-z0-9_]{22,}\b/g },
|
|
12
|
+
{ kind: "AWS_KEY", regex: /\bAKIA[0-9A-Z]{16}\b/g },
|
|
13
|
+
{ kind: "URI_SECRET", regex: /((?:postgres(?:ql)?|mysql|mongodb(?:\+srv)?|redis|amqp):\/\/[^:\s/@"']+:)(?!\{\{LEMMA_SECRET_)([^@\s/"']{4,})(@)/g, group: 2 },
|
|
14
|
+
{
|
|
15
|
+
kind: "ENV_SECRET",
|
|
16
|
+
regex: /((?:^|[\r\n])[ \t]*(?:export[ \t]+)?[A-Z0-9_]*(?:API_KEY|SECRET|PASSWORD|PASSWD|PRIVATE_KEY|ACCESS_TOKEN|AUTH_TOKEN)[ \t]*[=:][ \t]*["']?)([A-Za-z0-9_./+=-]{8,})(["']?)/g,
|
|
17
|
+
group: 2,
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
function escapeRegExp(s) {
|
|
21
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
22
|
+
}
|
|
23
|
+
function compileCustomRule(pattern) {
|
|
24
|
+
if (pattern.prefix) {
|
|
25
|
+
const len = pattern.minLength ?? 8;
|
|
26
|
+
return {
|
|
27
|
+
kind: pattern.kind,
|
|
28
|
+
regex: new RegExp(`${escapeRegExp(pattern.prefix)}[A-Za-z0-9_-]{${len},}`, "g"),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
kind: pattern.kind,
|
|
33
|
+
regex: new RegExp(pattern.regex, pattern.regex.includes("(?") ? "g" : "g"),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export class Redactor {
|
|
37
|
+
secret;
|
|
38
|
+
allowlist;
|
|
39
|
+
exemptPrefixes;
|
|
40
|
+
rules;
|
|
41
|
+
vault = new Map();
|
|
42
|
+
constructor(options = {}) {
|
|
43
|
+
this.secret = Buffer.isBuffer(options.hmacSecret)
|
|
44
|
+
? options.hmacSecret
|
|
45
|
+
: options.hmacSecret
|
|
46
|
+
? Buffer.from(options.hmacSecret, "utf8")
|
|
47
|
+
: randomBytes(32);
|
|
48
|
+
this.allowlist = new Set(options.allowlist ?? []);
|
|
49
|
+
this.exemptPrefixes = [PLACEHOLDER_PREFIX, "lemma-", ...(options.exemptPrefixes ?? [])];
|
|
50
|
+
this.rules = [...BUILTIN_RULES, ...(options.customPatterns ?? []).map(compileCustomRule)];
|
|
51
|
+
}
|
|
52
|
+
placeholderFor(kind, value) {
|
|
53
|
+
const digest = createHmac("sha256", this.secret).update(`${kind}:${value}`).digest("hex").slice(0, 8);
|
|
54
|
+
const placeholder = `${PLACEHOLDER_PREFIX}${kind}_${digest}}}`;
|
|
55
|
+
this.vault.set(placeholder, value);
|
|
56
|
+
return placeholder;
|
|
57
|
+
}
|
|
58
|
+
isExempt(value) {
|
|
59
|
+
if (!value || this.allowlist.has(value) || DUMMY_VALUE_RE.test(value))
|
|
60
|
+
return true;
|
|
61
|
+
return this.exemptPrefixes.some((p) => value.startsWith(p));
|
|
62
|
+
}
|
|
63
|
+
redactText(input, outMap) {
|
|
64
|
+
if (!input || input.length > 512_000)
|
|
65
|
+
return { text: input, count: 0, kinds: [] };
|
|
66
|
+
let text = input;
|
|
67
|
+
let count = 0;
|
|
68
|
+
const kinds = new Set();
|
|
69
|
+
for (const rule of this.rules) {
|
|
70
|
+
const re = new RegExp(rule.regex.source, rule.regex.flags.includes("g") ? rule.regex.flags : `${rule.regex.flags}g`);
|
|
71
|
+
text = text.replace(re, (...args) => {
|
|
72
|
+
const full = args[0];
|
|
73
|
+
if (rule.group !== undefined) {
|
|
74
|
+
const g1 = args[1] ?? "";
|
|
75
|
+
const target = args[rule.group] ?? "";
|
|
76
|
+
const g3 = args[rule.group + 1] ?? "";
|
|
77
|
+
if (!target || this.isExempt(target))
|
|
78
|
+
return full;
|
|
79
|
+
count++;
|
|
80
|
+
kinds.add(rule.kind);
|
|
81
|
+
const ph = this.placeholderFor(rule.kind, target);
|
|
82
|
+
outMap?.set(ph, target);
|
|
83
|
+
return `${g1}${ph}${g3}`;
|
|
84
|
+
}
|
|
85
|
+
if (this.isExempt(full))
|
|
86
|
+
return full;
|
|
87
|
+
count++;
|
|
88
|
+
kinds.add(rule.kind);
|
|
89
|
+
const ph = this.placeholderFor(rule.kind, full);
|
|
90
|
+
outMap?.set(ph, full);
|
|
91
|
+
return ph;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return { text, count, kinds: [...kinds] };
|
|
95
|
+
}
|
|
96
|
+
redactJson(value, outMap) {
|
|
97
|
+
let total = 0;
|
|
98
|
+
const kinds = new Set();
|
|
99
|
+
const walk = (node, parentKey) => {
|
|
100
|
+
if (typeof node === "string") {
|
|
101
|
+
// 跳过图片/文件 base64 大块,避免无谓正则扫描
|
|
102
|
+
if (parentKey === "data" && node.length > 256 && /^[A-Za-z0-9+/=]+$/.test(node.slice(0, 128)))
|
|
103
|
+
return node;
|
|
104
|
+
const res = this.redactText(node, outMap);
|
|
105
|
+
total += res.count;
|
|
106
|
+
for (const k of res.kinds)
|
|
107
|
+
kinds.add(k);
|
|
108
|
+
return res.text;
|
|
109
|
+
}
|
|
110
|
+
if (Array.isArray(node)) {
|
|
111
|
+
let changed = false;
|
|
112
|
+
const next = node.map((item) => {
|
|
113
|
+
const res = walk(item);
|
|
114
|
+
if (res !== item)
|
|
115
|
+
changed = true;
|
|
116
|
+
return res;
|
|
117
|
+
});
|
|
118
|
+
return changed ? next : node;
|
|
119
|
+
}
|
|
120
|
+
if (node && typeof node === "object") {
|
|
121
|
+
const obj = node;
|
|
122
|
+
let changed = false;
|
|
123
|
+
const next = {};
|
|
124
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
125
|
+
if (k === "mime_type" || k === "media_type") {
|
|
126
|
+
next[k] = v;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const res = walk(v, k);
|
|
130
|
+
if (res !== v)
|
|
131
|
+
changed = true;
|
|
132
|
+
next[k] = res;
|
|
133
|
+
}
|
|
134
|
+
return changed ? next : node;
|
|
135
|
+
}
|
|
136
|
+
return node;
|
|
137
|
+
};
|
|
138
|
+
return { value: walk(value), count: total, kinds: [...kinds] };
|
|
139
|
+
}
|
|
140
|
+
restoreText(input, localMap) {
|
|
141
|
+
if (!input || !input.includes(PLACEHOLDER_PREFIX))
|
|
142
|
+
return input;
|
|
143
|
+
return input.replace(PLACEHOLDER_RE, (match) => localMap?.get(match) ?? this.vault.get(match) ?? match);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* 跨 chunk 安全流式还原器:截留尾部可能未完整到达的 `{{LEMMA_SECRET_...` 片段,
|
|
148
|
+
* 避免 SSE 分片把单个占位符拆成两段而漏还原或破坏 JSON 结构。
|
|
149
|
+
*/
|
|
150
|
+
export class StreamUnredactor {
|
|
151
|
+
carry = "";
|
|
152
|
+
restore;
|
|
153
|
+
constructor(restoreFn) {
|
|
154
|
+
this.restore = restoreFn;
|
|
155
|
+
}
|
|
156
|
+
push(chunk) {
|
|
157
|
+
if (!chunk && !this.carry)
|
|
158
|
+
return "";
|
|
159
|
+
const combined = this.carry + chunk;
|
|
160
|
+
this.carry = "";
|
|
161
|
+
// 1. 先检查末尾是否有未闭合的 `{{LEMMA_SECRET_...`
|
|
162
|
+
const openIdx = combined.lastIndexOf(PLACEHOLDER_PREFIX);
|
|
163
|
+
if (openIdx >= 0 && combined.indexOf("}}", openIdx) < 0 && combined.length - openIdx <= MAX_PLACEHOLDER_TAIL && !/[\r\n]/.test(combined.slice(openIdx))) {
|
|
164
|
+
this.carry = combined.slice(openIdx);
|
|
165
|
+
return this.restore(combined.slice(0, openIdx));
|
|
166
|
+
}
|
|
167
|
+
// 2. 再检查末尾是否有被截断的前缀(如 `{` 或 `{{LEMMA_`)
|
|
168
|
+
const maxPrefixCheck = Math.min(PLACEHOLDER_PREFIX.length - 1, combined.length);
|
|
169
|
+
for (let len = maxPrefixCheck; len >= 1; len--) {
|
|
170
|
+
const tail = combined.slice(-len);
|
|
171
|
+
if (PLACEHOLDER_PREFIX.startsWith(tail)) {
|
|
172
|
+
this.carry = tail;
|
|
173
|
+
return this.restore(combined.slice(0, combined.length - len));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return this.restore(combined);
|
|
177
|
+
}
|
|
178
|
+
flush() {
|
|
179
|
+
if (!this.carry)
|
|
180
|
+
return "";
|
|
181
|
+
const out = this.restore(this.carry);
|
|
182
|
+
this.carry = "";
|
|
183
|
+
return out;
|
|
184
|
+
}
|
|
185
|
+
}
|
package/dist/tools.js
CHANGED
|
@@ -720,7 +720,7 @@ function createRequestApplyTool(config, changes, getConfirmApply) {
|
|
|
720
720
|
},
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
|
-
export function createLocalAgentsExtension(config, changes, project, hub, getConfirmApply) {
|
|
723
|
+
export function createLocalAgentsExtension(config, changes, project, hub, getConfirmApply, proxy) {
|
|
724
724
|
const agents = detectAgents(config);
|
|
725
725
|
// API 成员的工具扩展:只装给它们自己的子对话,总调度看不到
|
|
726
726
|
const memberTools = new Map();
|
|
@@ -729,7 +729,7 @@ export function createLocalAgentsExtension(config, changes, project, hub, getCon
|
|
|
729
729
|
if (a.available && api)
|
|
730
730
|
memberTools.set(a.kind, createMemberTools(a.kind, api, { workspace: config.agents[a.kind].workspace ?? "code", changes }));
|
|
731
731
|
}
|
|
732
|
-
const deps = { config, changes, project, hub, memberTools };
|
|
732
|
+
const deps = { config, changes, project, hub, memberTools, ...(proxy ? { proxy } : {}) };
|
|
733
733
|
const integrationHooks = {};
|
|
734
734
|
const integrations = createIntegrations(deps, integrationHooks);
|
|
735
735
|
deps.integrations = integrations;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lemma-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Lemma: durable local multi-agent coding orchestration with isolated worktrees, blind review, and verified integration",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lemma": "bin/lemma.mjs"
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"test:chaos-durable": "node --no-warnings test/chaos-durable.ts",
|
|
36
36
|
"test:cli-replay": "node --no-warnings test/cli-replay.ts",
|
|
37
37
|
"test:ux": "node --no-warnings test/ux-telemetry.ts",
|
|
38
|
+
"test:proxy": "node --no-warnings test/proxy.ts",
|
|
38
39
|
"test:ood": "node --no-warnings test/ood-benchmark.ts",
|
|
39
40
|
"test:projects": "node --no-warnings test/projects.ts",
|
|
40
41
|
"test:collaboration": "node --no-warnings test/integrations.ts && node --no-warnings test/task-workflow.ts && node --no-warnings test/task-workflow-api.ts && node --no-warnings test/task-workflow-code.ts && node --no-warnings test/task-recovery.ts && node --no-warnings test/context-handoff.ts && node --no-warnings test/collaboration-controls.ts && node --no-warnings test/mcp.ts && node --no-warnings test/collaboration-benchmark.ts && node --no-warnings test/fast-path.ts && node --no-warnings test/coding-benchmark-suite.ts && npm run test:security && npm run test:chaos-durable && npm run test:cli-replay && npm run test:ux && npm run test:ood",
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"test:harness": "node --no-warnings test/sessions.ts && node --no-warnings test/repair.ts && node --no-warnings test/sessions-cli.ts",
|
|
45
46
|
"test:conversations": "node --no-warnings test/conversations-web.ts && node --no-warnings test/admin-rebind.ts && node --no-warnings test/web-controls.ts && node --no-warnings test/git-workbench.ts",
|
|
46
47
|
"test:terminal": "node --no-warnings test/terminal.ts && node --no-warnings test/terminal-state.ts && node --no-warnings test/model-selection.ts && npm run test:metrics && node --no-warnings test/terminal-cli.ts && node --no-warnings test/terminal-child-view.ts && node --no-warnings test/terminal-model-selection.ts",
|
|
47
|
-
"test": "npm run test:business && npm run test:collaboration && npm run test:settings && npm run test:custom-agents && npm run test:results && npm run test:dialogue && npm run test:projects && node --no-warnings test/smoke.ts && node --no-warnings test/crash.ts && node --no-warnings test/isolation.ts && node --no-warnings test/steer.ts && node --no-warnings test/board.ts && node --no-warnings test/jobs.ts && node --no-warnings test/api-member.ts && node --no-warnings test/lead.ts && node --no-warnings test/conventions.ts && node --no-warnings test/web.ts && npm run test:terminal && npm run test:harness && npm run test:conversations",
|
|
48
|
+
"test": "npm run test:business && npm run test:proxy && npm run test:collaboration && npm run test:settings && npm run test:custom-agents && npm run test:results && npm run test:dialogue && npm run test:projects && node --no-warnings test/smoke.ts && node --no-warnings test/crash.ts && node --no-warnings test/isolation.ts && node --no-warnings test/steer.ts && node --no-warnings test/board.ts && node --no-warnings test/jobs.ts && node --no-warnings test/api-member.ts && node --no-warnings test/lead.ts && node --no-warnings test/conventions.ts && node --no-warnings test/web.ts && npm run test:terminal && npm run test:harness && npm run test:conversations",
|
|
48
49
|
"test:business": "node --no-warnings test/business.ts && node --no-warnings test/settlement.ts",
|
|
49
50
|
"test:results": "node --no-warnings test/result-retrieval.ts",
|
|
50
51
|
"test:custom-agents": "node --no-warnings test/custom-agent-config.ts && node --no-warnings test/custom-agents.ts",
|
package/web/js/views.js
CHANGED
|
@@ -1345,6 +1345,45 @@ function usage() {
|
|
|
1345
1345
|
</div>
|
|
1346
1346
|
</div>
|
|
1347
1347
|
</section>`;
|
|
1348
|
+
const ps = state.proxyStatus ?? null;
|
|
1349
|
+
const psTotals = ps?.totals ?? { requests: 0, retries: 0, blocked: 0, redacted: 0 };
|
|
1350
|
+
const psCooled = ps?.pool?.cooledKeys ?? [];
|
|
1351
|
+
const psAccounts = ps?.discoveredAccounts ?? [];
|
|
1352
|
+
const psModels = ps?.models ?? [];
|
|
1353
|
+
const psRedactions = ps?.recentRedactions ?? [];
|
|
1354
|
+
const proxyCardHtml = ps
|
|
1355
|
+
? `
|
|
1356
|
+
<section class="card" data-card="proxy-status">
|
|
1357
|
+
<header class="card-head">
|
|
1358
|
+
<div class="card-heading">
|
|
1359
|
+
<h2 class="card-title">本地代理网关观测(速度 / 缓存 / 脱敏 / 本机账号)</h2>
|
|
1360
|
+
<div class="card-sub">${ps.enabled ? `运行中 · ${esc(ps.mode === "relay" ? "云端托管中转" : "本地多 Key 粘性轮转")}${ps.bridgeEnabled ? " · 已开 Claude↔OpenAI 桥接" : ""}${ps.listenUrl ? ` · ${esc(ps.listenUrl)}` : ""}` : "网关未启用(在 pi-agent.config.json 配置 proxy.enabled=true 开启)"}</div>
|
|
1361
|
+
</div>
|
|
1362
|
+
<span class="card-note">粘性会话 ${ps.pool?.activeStickyCount ?? 0}</span>
|
|
1363
|
+
</header>
|
|
1364
|
+
<div class="card-body">
|
|
1365
|
+
<div class="kpis kpis-4">
|
|
1366
|
+
<div class="kpi"><div class="kpi-top"><span class="kpi-label">网关请求</span></div><strong>${num(psTotals.requests)}</strong><span class="kpi-sub">故障切换 / 重试 ${num(psTotals.retries)} 次</span></div>
|
|
1367
|
+
<div class="kpi"><div class="kpi-top"><span class="kpi-label">隐私脱敏</span></div><strong>${num(psTotals.redacted)}</strong><span class="kpi-sub">敏感拦截 ${num(psTotals.blocked)} 次</span></div>
|
|
1368
|
+
<div class="kpi"><div class="kpi-top"><span class="kpi-label">冷却密钥</span></div><strong>${num(psCooled.length)}</strong><span class="kpi-sub">${psCooled.length ? psCooled.map((k) => `${esc(k.poolId)} (${k.remainingSec}s)`).join(" · ") : "全部 Key 健康"}</span></div>
|
|
1369
|
+
<div class="kpi"><div class="kpi-top"><span class="kpi-label">本机已发现账号</span></div><strong>${num(psAccounts.filter((a) => a.detected).length)} / ${num(psAccounts.length)}</strong><span class="kpi-sub">${psAccounts.length ? psAccounts.map((a) => `${esc(a.provider)}:${a.detected ? esc(a.authMode) : "无"}`).join(" · ") : "已关闭扫描"}</span></div>
|
|
1370
|
+
</div>
|
|
1371
|
+
${
|
|
1372
|
+
psModels.length
|
|
1373
|
+
? `<div class="table-wrap" style="margin-top:12px"><table class="table">
|
|
1374
|
+
<thead><tr><th>网关模型</th><th class="num">请求</th><th class="num">TTFT 中位</th><th class="num">TPS 中位</th><th class="num">缓存命中</th><th class="num hide-sm">输入 / 输出</th><th class="num">估算花费</th></tr></thead>
|
|
1375
|
+
<tbody>${psModels.map((m) => `<tr><td class="mono">${esc(m.model)}</td><td class="num mono">${num(m.requests)}${m.errors ? ` <span class="err-t">(${m.errors}错)</span>` : ""}</td><td class="num mono">${m.medianTtftMs == null ? "—" : `${num(m.medianTtftMs)}ms`}</td><td class="num mono">${m.medianTps == null ? "—" : `${m.medianTps} t/s`}</td><td class="num mono">${m.cacheHitRate == null ? "—" : `${m.cacheHitRate}%`}</td><td class="num mono hide-sm">${num(m.inputTokens)} / ${num(m.outputTokens)}</td><td class="num mono">${m.costUsd ? money(m.costUsd) : "—"}</td></tr>`).join("")}</tbody>
|
|
1376
|
+
</table></div>`
|
|
1377
|
+
: ""
|
|
1378
|
+
}
|
|
1379
|
+
${
|
|
1380
|
+
psRedactions.length
|
|
1381
|
+
? `<p class="footnote" style="margin-top:8px">最近脱敏审计(不含明文):${psRedactions.slice(0, 5).map((r) => `${esc(r.agent)} [${esc(r.action)}] ×${r.count} (${esc(r.kinds.join(","))})`).join(" ; ")}</p>`
|
|
1382
|
+
: ""
|
|
1383
|
+
}
|
|
1384
|
+
</div>
|
|
1385
|
+
</section>`
|
|
1386
|
+
: "";
|
|
1348
1387
|
root.innerHTML = `
|
|
1349
1388
|
<div class="kpis kpis-4">
|
|
1350
1389
|
<div class="kpi"><div class="kpi-top"><span class="kpi-label">总调度 tokens</span></div><strong>${num(input + output)}</strong><span class="kpi-sub">输入 ${num(input)} · 输出 ${num(output)}</span></div>
|
|
@@ -1353,6 +1392,7 @@ function usage() {
|
|
|
1353
1392
|
<div class="kpi"><div class="kpi-top"><span class="kpi-label">成员累计耗时</span></div><strong>${duration(t.durationMs)}</strong><span class="kpi-sub">${t.total} 次派工</span></div>
|
|
1354
1393
|
</div>
|
|
1355
1394
|
${uxCardHtml}
|
|
1395
|
+
${proxyCardHtml}
|
|
1356
1396
|
<section class="card">
|
|
1357
1397
|
<header class="card-head"><div class="card-heading"><h2 class="card-title">派工活动</h2><div class="card-sub"><span><b>${act.total}</b> 次 · ${mode === "day" ? "最近 24 小时,每小时" : "最近 14 天,每天"}</span></div></div>
|
|
1358
1398
|
<div class="act-legend">${KINDS.map((k) => `<span><i style="background:${agentColor(k)}"></i>${esc(AGENT_LABEL[k] ?? k)}</span>`).join("")}</div>
|