lemma-agent 1.1.0 → 1.1.2

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/dist/redact.js CHANGED
@@ -62,9 +62,10 @@ export class Redactor {
62
62
  }
63
63
  redactText(input, outMap) {
64
64
  if (!input || input.length > 512_000)
65
- return { text: input, count: 0 };
65
+ return { text: input, count: 0, kinds: [] };
66
66
  let text = input;
67
67
  let count = 0;
68
+ const kinds = new Set();
68
69
  for (const rule of this.rules) {
69
70
  const re = new RegExp(rule.regex.source, rule.regex.flags.includes("g") ? rule.regex.flags : `${rule.regex.flags}g`);
70
71
  text = text.replace(re, (...args) => {
@@ -76,6 +77,7 @@ export class Redactor {
76
77
  if (!target || this.isExempt(target))
77
78
  return full;
78
79
  count++;
80
+ kinds.add(rule.kind);
79
81
  const ph = this.placeholderFor(rule.kind, target);
80
82
  outMap?.set(ph, target);
81
83
  return `${g1}${ph}${g3}`;
@@ -83,15 +85,17 @@ export class Redactor {
83
85
  if (this.isExempt(full))
84
86
  return full;
85
87
  count++;
88
+ kinds.add(rule.kind);
86
89
  const ph = this.placeholderFor(rule.kind, full);
87
90
  outMap?.set(ph, full);
88
91
  return ph;
89
92
  });
90
93
  }
91
- return { text, count };
94
+ return { text, count, kinds: [...kinds] };
92
95
  }
93
96
  redactJson(value, outMap) {
94
97
  let total = 0;
98
+ const kinds = new Set();
95
99
  const walk = (node, parentKey) => {
96
100
  if (typeof node === "string") {
97
101
  // 跳过图片/文件 base64 大块,避免无谓正则扫描
@@ -99,6 +103,8 @@ export class Redactor {
99
103
  return node;
100
104
  const res = this.redactText(node, outMap);
101
105
  total += res.count;
106
+ for (const k of res.kinds)
107
+ kinds.add(k);
102
108
  return res.text;
103
109
  }
104
110
  if (Array.isArray(node)) {
@@ -129,7 +135,7 @@ export class Redactor {
129
135
  }
130
136
  return node;
131
137
  };
132
- return { value: walk(value), count: total };
138
+ return { value: walk(value), count: total, kinds: [...kinds] };
133
139
  }
134
140
  restoreText(input, localMap) {
135
141
  if (!input || !input.includes(PLACEHOLDER_PREFIX))
package/dist/terminal.js CHANGED
@@ -8,6 +8,7 @@ import { conversationWelcome, terminalLabel, terminalRow } from "./terminal-layo
8
8
  export const TERMINAL_COMMANDS = [
9
9
  ["agents", "成员和模型"],
10
10
  ["agent", "add / edit / show / enable / disable / model / key 成员配置"],
11
+ ["onboarding", "引导初始化模型凭据与本地网关"],
11
12
  ["setup", "引导配置总控模型、接口与凭据"],
12
13
  ["tool", "list / add / edit / key / remove / test 成员业务工具"],
13
14
  ["limits", "查看并发和预算;edit 引导修改限制"],
@@ -207,6 +208,9 @@ export class AgentTerminal {
207
208
  thinkingHidden = false;
208
209
  picker;
209
210
  disposePicker;
211
+ promptDock = new Container();
212
+ dockActive = false;
213
+ disposeDock;
210
214
  size = 0;
211
215
  stopped = false;
212
216
  started = false;
@@ -268,7 +272,8 @@ export class AgentTerminal {
268
272
  visible: ({ height }) => this.tasksVisible && height >= 14,
269
273
  },
270
274
  { component: new Line((width) => this.statusLine(width)), shrink: 0 },
271
- { component: this.editor, maxSize: 9, minSize: 3 },
275
+ { component: this.editor, maxSize: 9, minSize: 3, visible: () => !this.dockActive },
276
+ { component: this.promptDock, maxSize: 18, shrink: 1, visible: () => this.dockActive },
272
277
  {
273
278
  component: new Line((width) => this.helpLine(width)),
274
279
  shrink: 0,
@@ -278,7 +283,7 @@ export class AgentTerminal {
278
283
  this.bind(options);
279
284
  this.tui.setFocus(this.editor);
280
285
  this.tui.addInputListener((data) => {
281
- if (this.picker) {
286
+ if (this.picker || this.dockActive) {
282
287
  if (matchesKey(data, "ctrl+c") || matchesKey(data, "ctrl+k")) {
283
288
  this.closePicker();
284
289
  return { consume: true };
@@ -679,31 +684,28 @@ export class AgentTerminal {
679
684
  question(options) {
680
685
  if (this.stopped)
681
686
  return Promise.reject(new Error("终端已关闭。"));
682
- this.closePicker();
683
687
  return new Promise((resolve, reject) => {
684
688
  const input = new SettingsInput({ placeholder: options.value ? `留空保留:${plain(options.value, 180)}` : "请输入" });
685
689
  input.secret = options.secret === true;
686
690
  const panel = new Container();
687
- panel.addChild(new Text(c.cyan(plain(options.title, 300)), 1, 1));
691
+ panel.addChild(new Text(c.cyan(plain(options.title, 300)), 1, 0));
692
+ for (const line of options.lines ?? [])
693
+ panel.addChild(new Text(plain(line, 260), 1, 0));
688
694
  panel.addChild(input);
689
- panel.addChild(new Text(c.dim("Enter 确认 · Esc / Ctrl+C 取消(不会发送给模型)"), 1, 1));
695
+ panel.addChild(new Text(c.dim("Enter 确认 · Esc / Ctrl+C 取消(不会发送给模型)"), 1, 0));
690
696
  let settled = false;
691
- input.onSubmit = (value) => { settled = true; input.setValue(""); this.closePicker(); resolve(value); };
692
- input.onEscape = () => this.closePicker();
693
- this.picker = this.tui.showOverlay(panel, { width: "88%", maxHeight: "85%", anchor: "center", margin: 1 });
694
- this.disposePicker = () => { input.setValue(""); if (!settled)
695
- reject(new Error("配置已取消,未保存。")); };
696
- this.tui.setFocus(input);
697
- this.tui.requestRender();
697
+ input.onSubmit = (value) => { settled = true; input.setValue(""); this.closeDock(); resolve(value); };
698
+ input.onEscape = () => this.closeDock();
699
+ this.showDock(panel, input, () => { input.setValue(""); if (!settled)
700
+ reject(new Error("配置已取消,未保存。")); });
698
701
  });
699
702
  }
700
- pickSelectOverlay(options) {
703
+ select(options) {
701
704
  if (this.stopped || !options.items.length)
702
705
  return Promise.resolve(undefined);
703
- this.closePicker();
704
706
  return new Promise((resolve) => {
705
707
  const panel = new Container();
706
- panel.addChild(new Text(c.cyan(plain(options.title, 200)), 1, 1));
708
+ panel.addChild(new Text(c.cyan(plain(options.title, 200)), 1, 0));
707
709
  for (const line of options.lines ?? [])
708
710
  panel.addChild(new Text(plain(line, 260), 1, 0));
709
711
  const list = new SelectList(options.items, Math.min(8, options.items.length), selectTheme, { minPrimaryColumnWidth: 24, maxPrimaryColumnWidth: 38 });
@@ -716,17 +718,14 @@ export class AgentTerminal {
716
718
  };
717
719
  list.onSelect = (item) => {
718
720
  settled = true;
719
- this.closePicker();
721
+ this.closeDock();
720
722
  resolve(item.value);
721
723
  };
722
- list.onCancel = () => this.closePicker();
724
+ list.onCancel = () => this.closeDock();
723
725
  list.onSelectionChange = () => this.tui.requestRender();
724
726
  panel.addChild(list);
725
- panel.addChild(new Text(c.dim(options.hint ?? "↑↓ 选择 · Enter 确认 · Esc / Ctrl+C 取消"), 1, 1));
726
- this.picker = this.tui.showOverlay(panel, { width: "90%", maxHeight: "88%", anchor: "center", margin: 1 });
727
- this.disposePicker = () => finish(undefined);
728
- this.tui.setFocus(list);
729
- this.tui.requestRender();
727
+ panel.addChild(new Text(c.dim(options.hint ?? "↑↓ 选择 · Enter 确认 · Esc / Ctrl+C 取消"), 1, 0));
728
+ this.showDock(panel, list, () => finish(undefined));
730
729
  });
731
730
  }
732
731
  async confirmApply(req) {
@@ -748,7 +747,7 @@ export class AgentTerminal {
748
747
  : []),
749
748
  { value: "reject", label: "暂不合并", description: "保留在待合并队列,稍后用 /apply 或网页处理" },
750
749
  ];
751
- const picked = await this.pickSelectOverlay({
750
+ const picked = await this.select({
752
751
  title: "⚑ 请求确认合并改动到工作区",
753
752
  lines,
754
753
  items: choices,
@@ -774,20 +773,42 @@ export class AgentTerminal {
774
773
  description: `${item.filesCount} 文件 +${item.add} −${item.del} · ${plain(item.task, 55)}`,
775
774
  })),
776
775
  ];
777
- return this.pickSelectOverlay({
776
+ return this.select({
778
777
  title: mode === "/apply" ? "选择要合并的改动 (/apply)" : "选择要丢弃的改动 (/drop)",
779
778
  items: choices,
780
779
  });
781
780
  }
782
- closePicker() {
783
- if (!this.picker)
781
+ showDock(panel, focus, dispose) {
782
+ this.closePicker();
783
+ this.dockActive = true;
784
+ this.promptDock.clear();
785
+ this.promptDock.addChild(new Line((width) => c.cyan("─".repeat(Math.max(1, width)))));
786
+ this.promptDock.addChild(panel);
787
+ this.disposeDock = dispose;
788
+ this.tui.setFocus(focus);
789
+ this.tui.requestRender();
790
+ }
791
+ closeDock() {
792
+ if (!this.dockActive)
784
793
  return;
785
- const picker = this.picker, dispose = this.disposePicker;
786
- this.picker = undefined;
787
- this.disposePicker = undefined;
788
- picker.hide();
794
+ const dispose = this.disposeDock;
795
+ this.dockActive = false;
796
+ this.disposeDock = undefined;
797
+ this.promptDock.clear();
789
798
  dispose?.();
790
799
  this.tui.setFocus(this.editor);
800
+ this.tui.requestRender();
801
+ }
802
+ closePicker() {
803
+ if (this.picker) {
804
+ const picker = this.picker, dispose = this.disposePicker;
805
+ this.picker = undefined;
806
+ this.disposePicker = undefined;
807
+ picker.hide();
808
+ dispose?.();
809
+ this.tui.setFocus(this.editor);
810
+ }
811
+ this.closeDock();
791
812
  }
792
813
  stop() {
793
814
  if (this.stopped)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemma-agent",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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"
package/web/js/editors.js CHANGED
@@ -297,6 +297,102 @@ export function openAutonomyEditor(autonomy) {
297
297
  });
298
298
  }
299
299
 
300
+ export function openOnboardingWizard(state) {
301
+ const presets = state?.onboardingPresets ?? [];
302
+ const discovered = state?.proxyStatus?.discoveredAccounts ?? [];
303
+ const curOrch = state?.orchestrator ?? {};
304
+ const curProxy = state?.proxyStatus ?? {};
305
+ const budgetUsd = state?.budget?.perRunUsd ?? 3;
306
+ const accountsLine = discovered.length
307
+ ? discovered.map((a) => `${a.detected ? "●" : "○"} ${esc(a.provider)}:${a.detected ? esc(a.authMode) : "无"}`).join(" · ")
308
+ : "未扫描本机账号";
309
+
310
+ openModal({
311
+ title: "首次配置引导 · 接入模型与本地网关",
312
+ submitText: "保存并启用",
313
+ bodyHtml: `
314
+ <p class="edit-note">本机已检测:${accountsLine}</p>
315
+ <div class="field-grid">
316
+ <label class="field"><span>接入模式</span><select name="mode">
317
+ <option value="byok"${curProxy.mode !== "relay" ? " selected" : ""}>自带 API Key / 多 Key 池 (BYOK)</option>
318
+ <option value="relay"${curProxy.mode === "relay" ? " selected" : ""}>云端托管中转 (Hosted Relay)</option>
319
+ <option value="native">保留本机已有登录态 / 环境变量</option>
320
+ </select></label>
321
+ <label class="field" data-sec="byok"><span>服务商预设</span><select name="preset">
322
+ ${presets.map((p) => `<option value="${esc(p.id)}">${esc(p.label)}</option>`).join("")}
323
+ </select></label>
324
+ </div>
325
+ <div class="field-grid" data-sec="endpoint">
326
+ <label class="field"><span>协议类型</span><select name="type">
327
+ <option value="openai-compatible"${curOrch.type === "openai-compatible" ? " selected" : ""}>openai-compatible</option>
328
+ <option value="anthropic-compatible"${curOrch.type !== "openai-compatible" ? " selected" : ""}>anthropic-compatible</option>
329
+ </select></label>
330
+ <label class="field"><span>默认模型 ID</span><input name="modelId" value="${esc(curOrch.modelId ?? "")}" placeholder="如 deepseek-chat / claude-sonnet-5-5" /></label>
331
+ </div>
332
+ <label class="field" data-sec="byok-url"><span>API Base URL</span><input name="baseUrl" type="url" value="${esc(curOrch.baseUrl ?? presets[0]?.baseUrl ?? "")}" placeholder="https://api.deepseek.com" /></label>
333
+ <label class="field" data-sec="relay-url" hidden><span>云端 Relay 地址</span><input name="relayUrl" type="url" placeholder="https://relay.example.com" /></label>
334
+ <label class="field" data-sec="secret"><span>API Key / 平台 Token(支持逗号或换行填多把 Key,隐藏保存至 credentials.json)</span><textarea name="secret" rows="2" placeholder="sk-...(多把 Key 自动组成防 429 粘性池;留空保留现存凭据)" autocomplete="new-password"></textarea></label>
335
+ <div class="field-grid" data-sec="gateway">
336
+ <label class="field"><span>多渠道/多 Key 路由策略</span><select name="strategy">
337
+ <option value="rotate" selected>rotate(缓存粘性轮转)</option>
338
+ <option value="order">order(主备顺序容灾)</option>
339
+ </select></label>
340
+ <label class="field"><span>出站脱敏策略</span><select name="redactAction">
341
+ <option value="mask" selected>mask(确定性占位符脱敏)</option>
342
+ <option value="warn">warn(仅记录审计告警)</option>
343
+ <option value="block">block(命中敏感密钥拦截)</option>
344
+ </select></label>
345
+ <label class="field"><span>单轮预算上限(美元,留空不限)</span><input name="perRunUsd" type="number" min="0" step="0.1" value="${budgetUsd == null ? "" : esc(budgetUsd)}" /></label>
346
+ </div>
347
+ <label class="check-chip" data-sec="bridge"><input type="checkbox" name="enableBridge" /> 启用 Anthropic↔OpenAI 轻量桥接(用该 API 同步驱动 Claude CLI)</label>
348
+ `,
349
+ onMount(body) {
350
+ const modeEl = body.querySelector('[name="mode"]');
351
+ const presetEl = body.querySelector('[name="preset"]');
352
+ const typeEl = body.querySelector('[name="type"]');
353
+ const modelEl = body.querySelector('[name="modelId"]');
354
+ const baseEl = body.querySelector('[name="baseUrl"]');
355
+ const syncPreset = () => {
356
+ const p = presets.find((x) => x.id === presetEl?.value);
357
+ if (!p || p.id === "custom") return;
358
+ if (typeEl) typeEl.value = p.type;
359
+ if (baseEl) baseEl.value = p.baseUrl;
360
+ if (modelEl) modelEl.value = p.defaultModel;
361
+ };
362
+ const syncMode = () => {
363
+ const m = modeEl?.value;
364
+ body.querySelectorAll('[data-sec="byok"],[data-sec="byok-url"]').forEach((n) => (n.hidden = m !== "byok"));
365
+ body.querySelectorAll('[data-sec="relay-url"]').forEach((n) => (n.hidden = m !== "relay"));
366
+ body.querySelectorAll('[data-sec="endpoint"],[data-sec="secret"]').forEach((n) => (n.hidden = m === "native"));
367
+ body.querySelectorAll('[data-sec="bridge"]').forEach((n) => (n.hidden = m !== "byok"));
368
+ };
369
+ presetEl?.addEventListener("change", syncPreset);
370
+ modeEl?.addEventListener("change", syncMode);
371
+ if (presets[0] && !curOrch.baseUrl) syncPreset();
372
+ syncMode();
373
+ },
374
+ async onSubmit(body) {
375
+ const val = (n) => body.querySelector(`[name="${n}"]`)?.value ?? "";
376
+ const mode = val("mode");
377
+ const res = await post("/api/onboarding", {
378
+ mode,
379
+ preset: val("preset"),
380
+ type: val("type"),
381
+ baseUrl: val("baseUrl").trim(),
382
+ modelId: val("modelId").trim(),
383
+ relayUrl: val("relayUrl").trim(),
384
+ secret: val("secret"),
385
+ strategy: val("strategy"),
386
+ redactAction: val("redactAction"),
387
+ enableBridge: Boolean(body.querySelector('[name="enableBridge"]')?.checked),
388
+ enableProxy: true,
389
+ perRunUsd: val("perRunUsd").trim() === "" ? null : Number(val("perRunUsd")),
390
+ });
391
+ return res?.summary || "初始化配置已保存";
392
+ },
393
+ });
394
+ }
395
+
300
396
  export function openOrchestratorEditor(orch) {
301
397
  openModal({
302
398
  title: "配置总控模型与接口",
package/web/js/views.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // 后台各页面。每个页面:mount(root, params) 渲染,update(kind, payload) 响应数据变化,unmount() 清理。
2
2
  import { openDispatch } from "./drawer.js";
3
3
  import { bindDagPanelEvents, classifyTopology, renderReviewLoopPanel, renderScopeMatrix, renderTaskDag } from "./dag.js";
4
- import { openAutonomyEditor, openCreateIntegrationDialog, openLimitsEditor, openMemberEditor, openOrchestratorEditor, openRecoverDialog, openRepairIntegrationDialog, openResolveOperationDialog, runControlAction } from "./editors.js";
4
+ import { openAutonomyEditor, openCreateIntegrationDialog, openLimitsEditor, openMemberEditor, openOnboardingWizard, openOrchestratorEditor, openRecoverDialog, openRepairIntegrationDialog, openResolveOperationDialog, runControlAction } from "./editors.js";
5
5
  import { createChangesView } from "./gitlens.js";
6
6
  import { METRICS, MODES, RANGES, Sankey } from "./sankey.js";
7
7
  import { buildRuns, callInfo, dispatchRows, isDispatch, loadEarlier, pendingChanges, runningJobs, store } from "./store.js";
@@ -193,7 +193,13 @@ function overview() {
193
193
  const strip = el("div", "ov-strip");
194
194
  strip.dataset.n = "strip";
195
195
  strip.hidden = true;
196
+ const onboardBanner = el("section", "card");
197
+ onboardBanner.dataset.n = "onboard";
198
+ onboardBanner.hidden = true;
199
+ onboardBanner.innerHTML = `<header class="card-head"><div class="card-heading"><h2 class="card-title">首次配置引导 · 接入模型与本地代理网关</h2><div class="card-sub">尚未配置总控模型密钥,可一键导入 DeepSeek/Anthropic/OpenAI 多 Key 轮转池、Cloud Relay 或本机已有方案。</div></div><button type="button" class="primary-btn" data-open-onboard="1">立即向导配置</button></header>`;
200
+ onboardBanner.querySelector("[data-open-onboard]").addEventListener("click", () => openOnboardingWizard(store.state));
196
201
  root.prepend(strip);
202
+ root.prepend(onboardBanner);
197
203
  root.append(routes);
198
204
  const act = el("section", "card act-card");
199
205
  act.innerHTML = `<header class="card-head"><div class="card-heading"><h2 class="card-title">派工活动</h2><div class="card-sub" data-n="actSum"></div></div><div class="act-legend" data-n="actLegend"></div></header><div class="card-body" data-n="act"></div>`;
@@ -219,6 +225,8 @@ function overview() {
219
225
  },
220
226
  update(kind) {
221
227
  const q = (n) => root.querySelector(`[data-n="${n}"]`);
228
+ const onboard = q("onboard");
229
+ if (onboard) onboard.hidden = !(store.state?.needsOnboarding && store.state?.canEditSettings);
222
230
  const strip = q("strip");
223
231
  const wasHidden = strip?.hidden;
224
232
  this.strip(strip);
@@ -1345,6 +1353,45 @@ function usage() {
1345
1353
  </div>
1346
1354
  </div>
1347
1355
  </section>`;
1356
+ const ps = state.proxyStatus ?? null;
1357
+ const psTotals = ps?.totals ?? { requests: 0, retries: 0, blocked: 0, redacted: 0 };
1358
+ const psCooled = ps?.pool?.cooledKeys ?? [];
1359
+ const psAccounts = ps?.discoveredAccounts ?? [];
1360
+ const psModels = ps?.models ?? [];
1361
+ const psRedactions = ps?.recentRedactions ?? [];
1362
+ const proxyCardHtml = ps
1363
+ ? `
1364
+ <section class="card" data-card="proxy-status">
1365
+ <header class="card-head">
1366
+ <div class="card-heading">
1367
+ <h2 class="card-title">本地代理网关观测(速度 / 缓存 / 脱敏 / 本机账号)</h2>
1368
+ <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>
1369
+ </div>
1370
+ <span class="card-note">粘性会话 ${ps.pool?.activeStickyCount ?? 0}</span>
1371
+ </header>
1372
+ <div class="card-body">
1373
+ <div class="kpis kpis-4">
1374
+ <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>
1375
+ <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>
1376
+ <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>
1377
+ <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>
1378
+ </div>
1379
+ ${
1380
+ psModels.length
1381
+ ? `<div class="table-wrap" style="margin-top:12px"><table class="table">
1382
+ <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>
1383
+ <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>
1384
+ </table></div>`
1385
+ : ""
1386
+ }
1387
+ ${
1388
+ psRedactions.length
1389
+ ? `<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>`
1390
+ : ""
1391
+ }
1392
+ </div>
1393
+ </section>`
1394
+ : "";
1348
1395
  root.innerHTML = `
1349
1396
  <div class="kpis kpis-4">
1350
1397
  <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 +1400,7 @@ function usage() {
1353
1400
  <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
1401
  </div>
1355
1402
  ${uxCardHtml}
1403
+ ${proxyCardHtml}
1356
1404
  <section class="card">
1357
1405
  <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
1406
  <div class="act-legend">${KINDS.map((k) => `<span><i style="background:${agentColor(k)}"></i>${esc(AGENT_LABEL[k] ?? k)}</span>`).join("")}</div>
@@ -1418,6 +1466,7 @@ function config() {
1418
1466
  const target = e.target instanceof Element ? e.target : null;
1419
1467
  if (!target || !store.state) return;
1420
1468
  if (target.closest("[data-edit-orch]")) openOrchestratorEditor(store.state.orchestrator);
1469
+ else if (target.closest("[data-open-onboard]")) openOnboardingWizard(store.state);
1421
1470
  else if (target.closest("[data-edit-limits]")) openLimitsEditor(store.state);
1422
1471
  else if (target.closest("[data-edit-autonomy]")) openAutonomyEditor(store.state.autonomy);
1423
1472
  });
@@ -1444,7 +1493,7 @@ function config() {
1444
1493
  ["历史条目", num(s.entries)],
1445
1494
  ["进程", `pid ${s.pid} · 已运行 ${duration(Date.now() - s.startedAt)}`],
1446
1495
  ])}</div></section>
1447
- <section class="card"><header class="card-head"><h2 class="card-title">总调度</h2>${canEdit ? `<button type="button" class="ghost-btn tiny" data-edit-orch="1">编辑总控</button>` : ""}</header>
1496
+ <section class="card"><header class="card-head"><h2 class="card-title">总调度</h2>${canEdit ? `<div style="display:flex;gap:8px"><button type="button" class="ghost-btn tiny" data-open-onboard="1">向导 / 网关一键配置</button><button type="button" class="ghost-btn tiny" data-edit-orch="1">编辑总控</button></div>` : ""}</header>
1448
1497
  <div class="card-body">${dl([
1449
1498
  ["协议", code(o.type)],
1450
1499
  ["模型", code(o.modelId)],