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
4 changes: 2 additions & 2 deletions hermes-plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ def acp_command(raw_args: str = "", *, session_id: str = "") -> Optional[str]:
return panel.strip()
version = _fetch_version(origin)
if version:
return (f"billion-context@{version} — proxy connected, compression armed. "
return (f"billion-context@{version} — proxy connected via {origin}, compression armed. "
"No model request yet; send one, then run /acp again.")
return f"bili: proxy not reachable at {origin} — is the bili proxy still running?"
except Exception as exc:
Expand All @@ -1230,7 +1230,7 @@ def acp_cache_command(raw_args: str = "", *, session_id: str = "") -> Optional[s
if not isinstance(cid, str) or not cid:
version = _fetch_version(origin)
if version:
return (f"billion-context@{version} — proxy connected, compression armed. "
return (f"billion-context@{version} — proxy connected via {origin}, compression armed. "
"No model request yet; send one, then run /acp-cache again.")
return f"bili: proxy not reachable at {origin} — is the bili proxy still running?"
code, payload = http_post_json(
Expand Down
4 changes: 2 additions & 2 deletions src/agent/dsh-acp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function statusOutcome(): Promise<CommandOutcome> {
}
const version = await fetchProxyVersion(base);
if (version) {
return { kind: "success", text: armedIdleNotice(version) };
return { kind: "success", text: armedIdleNotice(version, base) };
}
return {
kind: "error",
Expand Down Expand Up @@ -72,7 +72,7 @@ async function cacheOutcome(): Promise<CommandOutcome> {
version = undefined;
}
if (version) {
return { kind: "success", text: `billion-context@${version} — proxy connected, compression armed. No model request yet; send one, then run /acp-cache again.` };
return { kind: "success", text: `billion-context@${version} — proxy connected via ${base}, compression armed. No model request yet; send one, then run /acp-cache again.` };
}
return {
kind: "error",
Expand Down
6 changes: 3 additions & 3 deletions src/agent/dsh-native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1463,14 +1463,14 @@ async function statusOutcome(ctx: PluginContext, invocation?: CommandInvocation)
const version = await fetchProxyVersion(base);
return {
kind: "success",
text: `${wireNote}billion-context${version ? `@${version}` : ""} — proxy connected, compression armed. Runtime info${typeof ri.source === "string" ? ` (${ri.source})` : ""}: ${parts.join(" ")}. No model request yet; send one, then run /acp again for the full panel.`,
text: `${wireNote}billion-context${version ? `@${version}` : ""} — proxy connected via ${base}, compression armed. Runtime info${typeof ri.source === "string" ? ` (${ri.source})` : ""}: ${parts.join(" ")}. No model request yet; send one, then run /acp again for the full panel.`,
};
}
const version = await fetchProxyVersion(base);
if (version) {
return {
kind: "success",
text: `${wireNote}billion-context@${version} — proxy connected, compression armed. No model request seen yet; send one, then run /acp again.`,
text: `${wireNote}billion-context@${version} — proxy connected via ${base}, compression armed. No model request seen yet; send one, then run /acp again.`,
};
}
return {
Expand Down Expand Up @@ -1518,7 +1518,7 @@ async function cacheOutcome(ctx: PluginContext, invocation?: CommandInvocation):
version = undefined;
}
if (version) {
return { kind: "success", text: `billion-context@${version} — proxy connected, compression armed. No model request seen yet; send one, then run /acp-cache again.` };
return { kind: "success", text: `billion-context@${version} — proxy connected via ${base}, compression armed. No model request seen yet; send one, then run /acp-cache again.` };
}
return {
kind: "error",
Expand Down
2 changes: 1 addition & 1 deletion src/agent/opencode-acp-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function createAcpCommandHooks(getProxyBase: () => string | undefined, ct
} catch {
version = undefined;
}
text = version !== undefined ? armedIdleNotice(version) : noSessionWarning();
text = version !== undefined ? armedIdleNotice(version, proxyBase) : noSessionWarning();
} else {
text = "bili: proxy returned no status panel";
}
Expand Down
4 changes: 2 additions & 2 deletions src/agent/opencode-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,15 @@ export function createOpencodeV2Setup(options: OpencodeV2SetupOptions = {}): (ct
version = undefined;
}
text = version !== undefined
? `billion-context@${version} — proxy connected, no ACP session yet. Send a model request, then run /acp again.`
? `billion-context@${version} — proxy connected via ${base}, no ACP session yet. Send a model request, then run /acp again.`
: "bili: no ACP session yet (send a model request first, then run /acp)";
} else if (!status) {
// fetchStatus soft-fails to undefined both when the proxy 404s an absent or
// never-seen conversation and when the proxy is unreachable. Probe the
// manifest to claim "connected" only when it answers.
const version = await fetchProxyVersion(base).catch(() => undefined);
text = version !== undefined
? `billion-context@${version} — proxy connected, no ACP session yet. Send a model request, then run /acp again.`
? `billion-context@${version} — proxy connected via ${base}, no ACP session yet. Send a model request, then run /acp again.`
: "bili: cannot reach the bili proxy (run `bili start`, then run /acp again)";
} else {
const errText = status?.error;
Expand Down
2 changes: 1 addition & 1 deletion src/agent/pi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ export function createBiliPlugin(agentOverride?: string, opts?: { retryIntervalM
version = undefined;
}
if (version !== undefined) {
notify(armedIdleNotice(version), "info");
notify(armedIdleNotice(version, proxyBase), "info");
} else {
notify(noSessionWarning(), "warning");
}
Expand Down
4 changes: 2 additions & 2 deletions src/agent/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@ export const V2_SYNTHETIC_TEXT = "[bili-acp-status] ACP status panel was display

/** Armed-but-idle /acp notice (proxy live, no model request sent yet). One
* source of truth for pi / dsh / opencode (#883). */
export function armedIdleNotice(version: string): string {
return `billion-context@${version} — proxy connected, compression armed. No model request yet; send one, then run /acp again.`;
export function armedIdleNotice(version: string, base?: string): string {
return `billion-context@${version} — proxy connected${base ? ` via ${base}` : ""}, compression armed. No model request yet; send one, then run /acp again.`;
}

/** Fallback when the version probe also fails — a warning, not an info notice. */
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,7 @@ export function handlePluginStatus(conversationId: string, res: import("node:htt
// same addition so the Session-only derivation (unpruned − sent) still
// isolates pruned originals on one scale.
panel = buildStatusPanel({
version: `billion-context@${PROXY_VERSION}${BUILD_COMMIT && BUILD_COMMIT !== "unknown" ? ` (${BUILD_COMMIT})` : ""} · pack: ${session.meta.activePack ?? "default"}${deps.inlineLane ? " · inline" : ""}`,
version: `billion-context@${PROXY_VERSION}${BUILD_COMMIT && BUILD_COMMIT !== "unknown" ? ` (${BUILD_COMMIT})` : ""} · pack: ${session.meta.activePack ?? "default"}${deps.inlineLane ? " · inline" : ""}${deps.webOrigin ? ` · via ${deps.webOrigin}` : ""}`,
// #2671: effective storage mode — legacy/shadow/full, including
// the encryption-blocked downgrade. Display-only, from the env the
// store actually resolved.
Expand Down
13 changes: 8 additions & 5 deletions src/server/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ export async function handleAdminRoute(req: http.IncomingMessage, res: http.Serv
if (req.method === "GET" && req.url === "/__bili/stats") return sendStats(res);
if (req.method === "GET" && req.url?.startsWith("/__bili/cache-report")) return sendCacheReport(res, req.url);
if (req.method === "GET" && req.url?.startsWith("/__bili/session-report")) return sendSessionReport(res, req.url);
if (req.method === "GET" && req.url === "/__bili/status") return sendStatus(res, opts);
if (req.method === "GET" && req.url === "/__bili/status") return sendStatus(res, opts, typeof req.headers.host === "string" ? req.headers.host : undefined);
if (req.method === "GET" && req.url === "/__bili/resign") return sendResignStatus(res);
if (req.method === "GET" && req.url === "/__bili/overview") return sendOverview(res, opts);
if (req.method === "GET" && req.url === "/__bili/overview") return sendOverview(res, opts, typeof req.headers.host === "string" ? req.headers.host : undefined);
if (req.method === "GET" && (req.url === "/__bili/sessions" || req.url?.startsWith("/__bili/sessions?"))) return sendWebSessions(res, req);
if (req.method === "GET" && req.url?.startsWith("/__bili/logs")) return sendWebLogs(res, req);
if (req.method === "GET" && req.url?.startsWith("/__bili/diagnostics")) return sendDiagnostics(res, req.url);
Expand Down Expand Up @@ -1169,7 +1169,9 @@ function updateReadyPayload(): { kind: "available" | "ready"; version: string; s
return updateBannerPayload(getUpdateVisibility(VERSION));
}

async function sendStatus(res: http.ServerResponse, opts: ProxyOptions): Promise<void> {
// laneHost: the host:port this lane was addressed by (req.headers.host) — surfaces on
// the status/overview wires so multi-lane machines can tell instances apart.
async function sendStatus(res: http.ServerResponse, opts: ProxyOptions, laneHost?: string): Promise<void> {
let diskVersion: string | undefined;
let stale = false;
let lastInstall: Awaited<ReturnType<typeof getLastInstall>>;
Expand All @@ -1190,7 +1192,7 @@ async function sendStatus(res: http.ServerResponse, opts: ProxyOptions): Promise
loggerLog("warn", `split-session canary (#2170): conversation ${w.base} has live traffic under multiple session keys (design persona forks are excluded): ${w.sessions.map((s) => `${s.id} (requests=${s.requests})`).join("; ")}. For a non-persona host this is the #2165 failure shape (stolen anchor / never-compressing split) — investigate if unexpected.`);
}
}
res.end(JSON.stringify({ version: VERSION, commit: BUILD_COMMIT, diskVersion, stale, lastInstall, updateReady: updateReadyPayload(), autoRestartOnUpdate: opts.autoRestartOnUpdate, advisory: currentAdvisoryPayload(), updatePolicy: updatePolicyPayload(), pluginAdvisories: detectCostAdvisories(process.env), inFlight: totalInFlight(), splitSessions: splitWarnings, conflicts: summarizeConflicts(listSessions()), storage: storageStatusWire(), snapshotShadow: snapshotShadowStatusWire(), attribution: attributionStatusWire() }, null, 2));
res.end(JSON.stringify({ version: VERSION, commit: BUILD_COMMIT, origin: laneHost ?? null, diskVersion, stale, lastInstall, updateReady: updateReadyPayload(), autoRestartOnUpdate: opts.autoRestartOnUpdate, advisory: currentAdvisoryPayload(), updatePolicy: updatePolicyPayload(), pluginAdvisories: detectCostAdvisories(process.env), inFlight: totalInFlight(), splitSessions: splitWarnings, conflicts: summarizeConflicts(listSessions()), storage: storageStatusWire(), snapshotShadow: snapshotShadowStatusWire(), attribution: attributionStatusWire() }, null, 2));
}

// #2090 plan A — read-only view backing the web UI's "Signed upstreams" card:
Expand All @@ -1214,7 +1216,7 @@ function sendResignStatus(res: http.ServerResponse): void {
}, null, 2));
}

async function sendOverview(res: http.ServerResponse, opts: ProxyOptions): Promise<void> {
async function sendOverview(res: http.ServerResponse, opts: ProxyOptions, laneHost?: string): Promise<void> {
let diskVersion: string | undefined;
let stale = false;
let lastInstall: Awaited<ReturnType<typeof getLastInstall>>;
Expand All @@ -1238,6 +1240,7 @@ async function sendOverview(res: http.ServerResponse, opts: ProxyOptions): Promi
res.end(JSON.stringify({
overview,
version: VERSION,
origin: laneHost ?? null,
commit: BUILD_COMMIT,
diskVersion,
stale,
Expand Down
1 change: 1 addition & 0 deletions src/web/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ function changelogCatOf(rawLine) {
pb.appendChild(tr);
});
$("sys-version").textContent = d.version ? (d.commit ? d.version + " (" + d.commit + ")" : d.version) : "?";
$("sys-lane").textContent = d.origin || t("common.none");
$("sys-disk-version").textContent = d.diskVersion || t("common.none");
$("sys-inflight").textContent = String(d.inFlight || 0);
const bt = d.blindTunnels || {};
Expand Down
2 changes: 2 additions & 0 deletions src/web/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const MESSAGES: Record<Locale, Record<string, string>> = {
"ov.view_all": "查看全部 →",
"sys.title": "系统状态",
"sys.version": "版本",
"sys.lane": "运行实例",
"sys.disk_version": "磁盘版本",
"sys.inflight": "进行中请求",
"sys.blind_tunnels": "MITM 盲隧道(CONNECT 后无 TLS)",
Expand Down Expand Up @@ -724,6 +725,7 @@ export const MESSAGES: Record<Locale, Record<string, string>> = {
"ov.view_all": "View all →",
"sys.title": "System status",
"sys.version": "Version",
"sys.lane": "Running lane",
"sys.disk_version": "On-disk version",
"sys.inflight": "In-flight requests",
"sys.blind_tunnels": "MITM blind tunnels (CONNECT without TLS)",
Expand Down
1 change: 1 addition & 0 deletions src/web/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function renderPage(origin: string, version: string, embed = false, theme
<div class="card" style="margin-top:16px"><div class="card-h"><span data-i18n="sys.title">${zh("sys.title")}</span></div><div class="card-b"><dl class="kv">
<div class="k" data-i18n="sys.version">${zh("sys.version")}</div><div class="v mono" id="sys-version"></div>
<div class="k" data-i18n="sys.disk_version">${zh("sys.disk_version")}</div><div class="v mono" id="sys-disk-version"></div>
<div class="k" data-i18n="sys.lane">${zh("sys.lane")}</div><div class="v mono" id="sys-lane"></div>
<div class="k" data-i18n="sys.inflight">${zh("sys.inflight")}</div><div class="v mono" id="sys-inflight">0</div>
<div class="k" data-i18n="sys.blind_tunnels">${zh("sys.blind_tunnels")}</div><div class="v mono" id="sys-blind">0</div>
</dl></div></div>
Expand Down
2 changes: 1 addition & 1 deletion tests/dsh-acp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ test("/acp on an armed-but-idle proxy renders the idle notice", async () => {
},
);
assert.equal(outcome.kind, "success");
assert.match(outcome.text, /billion-context@9\.9\.9 — proxy connected, compression armed/);
assert.match(outcome.text, /billion-context@9\.9\.9 — proxy connected via .+, compression armed/);
});

test("/acp when the proxy is unreachable reports an error", async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/hermes-native.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ describe("in-session slash commands (#3697)", () => {
});
assert.ok(out, err);
assert.match(out!.cmd_acp!, /^billion-context@test-1/);
assert.match(out!.cmd_acp!, /proxy connected, compression armed\. No model request yet; send one, then run \/acp again\./);
assert.match(out!.cmd_acp!, /proxy connected via http:\/\/127\.0\.0\.1:\d+, compression armed\. No model request yet; send one, then run \/acp again\./);
assert.equal(
out!.cmd_acp_cache,
"bili: no ACP session yet for this conversation (send a model request first, then run /acp-cache)",
Expand Down
2 changes: 1 addition & 1 deletion tests/opencode-v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ test("v2 setup: first /acp before any model request shows the idle notice (proxy
const acp = fake.addedCommands.find((c) => c.name === "acp")!;
await acp.execute({ sessionID: "ses_acp_idle" });
await until(() => fake.syntheticCalls.length === 1);
assert.match(fake.syntheticCalls[0].description!, /billion-context@9\.9\.9-test \u2014 proxy connected, no ACP session yet/);
assert.match(fake.syntheticCalls[0].description!, /billion-context@9\.9\.9-test \u2014 proxy connected via http:\/\/127\.0\.0\.1:\d+, no ACP session yet/);
assert.match(fake.syntheticCalls[0].text, /not an instruction/);
assert.equal(fake.syntheticCalls[0].resume, false);
} finally {
Expand Down
Loading