Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/web/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ export const WEB_CLIENT = `(function () {
const whatParts = [];
if (confirmedTpN > 0) whatParts.push(t("conflict.what_plugin"));
if (suspectedN > 0) whatParts.push(t("conflict.what_suspected"));
if (siblingN > 0) whatParts.push(t("conflict.what_sibling"));
// #2430: siblings are family, never a warning — they no longer appear in the
// "what" enumeration even in mixed ledgers (pure-sibling banners are hidden outright).
if (nativeN > 0) whatParts.push(t("conflict.what_native"));
const active = typeof c.active === "number" ? c.active : c.events;
const hasConfirmed = confirmedTpN > 0 || nativeN > 0;
Expand All @@ -102,7 +103,10 @@ export const WEB_CLIENT = `(function () {
onKey = "conflict.on"; onText = t("conflict.on");
riskKey = "conflict.risk_sibling"; riskText = t("conflict.risk_sibling");
}
return { onKey: onKey, riskKey: riskKey, onText: onText, riskText: riskText, hasConfirmed: hasConfirmed, what: whatParts.join(t("conflict.what_join")), active: active };
// #2430: a ledger that is ONLY bili's own siblings stands down completely — they are
// compatible family, not conflicts; the web banner must stay hidden for them.
const siblingOnly = !hasConfirmed && suspectedN === 0 && siblingN > 0;
return { onKey: onKey, riskKey: riskKey, onText: onText, riskText: riskText, hasConfirmed: hasConfirmed, siblingOnly: siblingOnly, what: whatParts.join(t("conflict.what_join")), active: active };
}
window.bili_conflictLine = bili_conflictLine;
window.bili_conflictSeverity = bili_conflictSeverity;
Expand Down Expand Up @@ -289,7 +293,7 @@ export const WEB_CLIENT = `(function () {
function refreshDirtyFlag() {
const el = $("cfg-file-edit");
const dirty = Boolean(el && cfgSavedSnap !== null && canonCfgText(el.value) !== canonCfgText(cfgSavedSnap));
["card-quick", "card-file"].forEach((id) => { const c = $(id); if (c) c.style.borderColor = dirty ? "#bf8700" : ""; });
["card-quick", "card-file", "summary-settings"].forEach((id) => { const c = $(id); if (c) c.style.borderColor = dirty ? "#bf8700" : ""; });
document.querySelectorAll(".cfg-dirty-note").forEach((n) => { n.hidden = !dirty; });
}

Expand Down Expand Up @@ -457,7 +461,11 @@ export const WEB_CLIENT = `(function () {
const cb = $("conflicts-banner");
if (cb) {
const c = d.conflicts;
if (c && c.events > 0) {
// #2430: siblings-only ledgers stand down — bili's own family (billion-context-pi /
// opencode-acp) is compatible, so a pure-sibling ledger is not a warning. The events
// stay recorded (acp_status keeps the calm #2261 footer); only the banner goes quiet.
const sev0 = c && c.events > 0 ? bili_conflictSeverity(c) : null;
if (c && c.events > 0 && !(sev0 && sev0.siblingOnly)) {
cb.hidden = false;
cb.classList.add("show");
// #2102: attribute per kind family present; split active from historical
Expand Down
8 changes: 2 additions & 6 deletions src/web/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const LOCALES: readonly Locale[] = ["zh-CN", "en"];

export const MESSAGES: Record<Locale, Record<string, string>> = {
"zh-CN": {
"summary.title": "统一摘要服务",
"summary.title": "统一摘要服务(实验性功能)",
"summary.enabled": "启用",
"summary.add": "添加目标",
"summary.ref": "目标(provider/model)",
Expand Down Expand Up @@ -110,8 +110,6 @@ export const MESSAGES: Record<Locale, Record<string, string>> = {
// client-native rewrites must not read as "third-party plugin" evidence.
"conflict.found": ":发现",
"conflict.what_plugin": "与 bili 并存的第三方压缩插件",
// #2261: bili's own siblings are first-party — never label them third-party.
"conflict.what_sibling": "与 bili 并存的 bili 自家兄弟扩展(billion-context-pi / opencode-acp)",
"conflict.what_native": "客户端原生自动压缩改写会话历史",
"conflict.what_join": "、",
"conflict.risk_active": "的痕迹。两个压缩器作用于同一会话会双压缩、破坏消息引用,可能导致上下文错乱——请只保留一个压缩器。",
Expand Down Expand Up @@ -421,7 +419,7 @@ export const MESSAGES: Record<Locale, Record<string, string>> = {
"toast.failed": "操作失败:{msg}",
},
en: {
"summary.title": "Shared summary service",
"summary.title": "Shared summary service (experimental)",
"summary.enabled": "Enabled",
"summary.add": "Add target",
"summary.ref": "Target (provider/model)",
Expand Down Expand Up @@ -526,8 +524,6 @@ export const MESSAGES: Record<Locale, Record<string, string>> = {
// #2102: composed per kind family present — see the zh entry above.
"conflict.found": ": traces of ",
"conflict.what_plugin": "a third-party compression plugin co-resident with bili",
// #2261: see the zh entry above — siblings are first-party.
"conflict.what_sibling": "a bili sibling extension (billion-context-pi / opencode-acp) co-resident with bili",
"conflict.what_native": "client-native auto-compaction rewriting conversation history",
"conflict.what_join": " and ",
"conflict.risk_active": " were found. Two compressors on one conversation double-compress and corrupt message refs, which can scramble context — keep exactly one compressor.",
Expand Down
5 changes: 2 additions & 3 deletions src/web/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ export function renderPage(origin: string, version: string): string {
<div class="cfg-dirty-note small" style="margin-top:10px;color:#9a6700" hidden><span data-i18n="cfg.unsaved">${zh("cfg.unsaved")}</span></div>
<div style="margin-top:14px"><button id="save-quick" class="btn"><span data-i18n="cfg.save">${zh("cfg.save")}</span></button></div>
</div></div>
<section id="summary-settings" class="summary-settings">
<h2 data-i18n="summary.title">${zh("summary.title")}</h2>
<div class="card" id="summary-settings"><div class="card-h"><span data-i18n="summary.title">${zh("summary.title")}</span></div><div class="card-b">
<div id="summary-fields"></div>
<div class="cfg-dirty-note small" hidden><span data-i18n="cfg.unsaved">${zh("cfg.unsaved")}</span></div>
<button id="save-summary" class="btn"><span data-i18n="cfg.save">${zh("cfg.save")}</span></button>
</section>
</div></div>
<div class="card" id="card-file"><div class="card-h"><span data-i18n="cfg.file">${zh("cfg.file")}</span></div><div class="card-b">
<p class="dim small" style="margin:0 0 8px" data-i18n="cfg.file_desc">${zh("cfg.file_desc")}</p>
<dl class="kv"><div class="k" data-i18n="dt.config_file">${zh("dt.config_file")}</div><div class="v" style="display:flex;gap:8px;align-items:center;flex-wrap:wrap"><span id="cfg-path" class="mono dim small"></span><button id="copy-cfg-file" class="btn sm copy-btn" data-copy=""><span data-i18n="common.copy">${zh("common.copy")}</span></button></div></dl>
Expand Down
6 changes: 5 additions & 1 deletion src/web/sessions-data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { orderedRefPair } from "acp-kernel";
import { listSessions, displayContextBest, type ContextBest, type Session } from "../session.js";
import { conflictClientOf, conflictEventsOf } from "../conflict-watch.js";
import { isSiblingConflictDetail } from "../thirdparty-scan.js";
import { SessionStore, fileNameMatchesId, isValidRecord, relPathFor } from "../persist.js";
import { flatFileNameFor } from "acp-kernel/persist";
import { renderHandoff } from "../export.js";
Expand Down Expand Up @@ -819,7 +820,10 @@ function renderDetail(session: Session, live: boolean): WebSessionDetail {
const pluginAgent = typeof session.metadata["pluginAgent"] === "string" ? session.metadata["pluginAgent"] : undefined;
const clientHint = pluginAgent ?? (typeof session.metadata["clientHint"] === "string" ? session.metadata["clientHint"] : undefined);
const sysPrompt = typeof session.metadata["systemPromptTokens"] === "number" ? session.metadata["systemPromptTokens"] : 0;
const conflicts = conflictEventsOf(session);
// #2430: bili's own siblings (billion-context-pi / opencode-acp) are compatible family,
// not conflicts — keep them out of the session evidence card so a siblings-only session
// renders no conflict block at all. Recording (acp_status #2261 calm footer) is unchanged.
const conflicts = conflictEventsOf(session).filter((e) => !(e.kind === "third-party-plugin" && isSiblingConflictDetail(e.detail)));
const conflictClient = conflicts.length > 0 ? conflictClientOf(session) : undefined;

return {
Expand Down
5 changes: 2 additions & 3 deletions src/web/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,12 @@ pre.tool-args, pre.tool-out { margin: 6px 0 0; padding: 8px; background: var(--b
/* Log view rows (filtered mode): actual hits vs context / time-window lines. */
.lm-ctx { opacity: 0.55; }
.lm-hit { background: rgba(94, 164, 255, 0.14); border-radius: 3px; }
.summary-settings { margin: 20px 0; padding: 18px 0; border-top: 1px solid var(--border); }
.summary-settings h2 { font-size: 18px; margin: 0 0 14px; }
#summary-settings { margin-top: 16px; }
.summary-target { min-width: 0; margin: 14px 0; padding: 12px; border: 1px solid var(--border); border-radius: 4px; }
.summary-target legend { max-width: 100%; overflow-wrap: anywhere; font-size: 13px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin-bottom: 12px; }
.summary-grid label { display: grid; gap: 5px; min-width: 0; font-size: 12px; }
.summary-settings .field-input { width: 100%; min-width: 0; box-sizing: border-box; }
#summary-settings .field-input { width: 100%; min-width: 0; box-sizing: border-box; }
.summary-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.summary-creds { margin: 14px 0; }
.summary-creds h4 { margin: 0 0 8px; font-size: 13px; }
Expand Down
5 changes: 4 additions & 1 deletion tests/web-conflict-banner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const END_MARK = "window.bili_conflictLine = bili_conflictLine;";
type LatestEntry = { kind: string; detail?: string; at?: number; sessionId?: string };
type BannerInput = { events?: number; sessions?: number; active?: number; historical?: number; kinds?: Record<string, number>; latest?: LatestEntry[] };
type SeverityInput = BannerInput & { sibling?: number; suspected?: number };
interface Severity { onKey: string; riskKey: string; hasConfirmed: boolean; what: string; active: number }
interface Severity { onKey: string; riskKey: string; hasConfirmed: boolean; siblingOnly?: boolean; what: string; active: number }

// Both helpers share the same extracted slice (they sit together in WEB_CLIENT);
// the slice ends at the first window.* export so no `window` reference runs under Node.
Expand Down Expand Up @@ -150,6 +150,7 @@ test("#2324 suspected-only ledger -> soft 'verify first' framing, no confirmed-c
assert.strictEqual(r.onKey, "conflict.on_suspected");
assert.strictEqual(r.riskKey, "conflict.risk_suspected");
assert.strictEqual(r.active, 96);
assert.ok(!r.siblingOnly, "#2430: non-sibling ledgers must never set siblingOnly");
});

test("#2324 confirmed third-party plugin keeps the double-compression warning (active)", () => {
Expand All @@ -173,6 +174,8 @@ test("#2324 sibling-only -> stands-down framing, not a confirmed conflict (#2261
assert.strictEqual(r.hasConfirmed, false);
assert.strictEqual(r.onKey, "conflict.on");
assert.strictEqual(r.riskKey, "conflict.risk_sibling");
// #2430: pure-sibling ledgers stand down completely — the banner hides on this flag.
assert.strictEqual(r.siblingOnly, true);
});

test("#2324 mixed suspected+confirmed -> strong warning retained while naming both families", () => {
Expand Down
Loading