fix(ui): restore native web /status
This commit is contained in:
@@ -10,7 +10,6 @@ import {
|
||||
normalizeVerboseLevel,
|
||||
resolveThinkingDefaultForModel,
|
||||
} from "../../../../src/auto-reply/thinking.js";
|
||||
import type { HealthSummary } from "../../../../src/commands/health.js";
|
||||
import {
|
||||
DEFAULT_AGENT_ID,
|
||||
DEFAULT_MAIN_KEY,
|
||||
@@ -45,8 +44,6 @@ export async function executeSlashCommand(
|
||||
switch (commandName) {
|
||||
case "help":
|
||||
return executeHelp();
|
||||
case "status":
|
||||
return await executeStatus(client);
|
||||
case "new":
|
||||
return { content: "Starting new session...", action: "new-session" };
|
||||
case "reset":
|
||||
@@ -101,27 +98,6 @@ function executeHelp(): SlashCommandResult {
|
||||
return { content: lines.join("\n") };
|
||||
}
|
||||
|
||||
async function executeStatus(client: GatewayBrowserClient): Promise<SlashCommandResult> {
|
||||
try {
|
||||
const health = await client.request<HealthSummary>("health", {});
|
||||
const status = health.ok ? "Healthy" : "Degraded";
|
||||
const agentCount = health.agents?.length ?? 0;
|
||||
const sessionCount = health.sessions?.count ?? 0;
|
||||
const lines = [
|
||||
`**System Status:** ${status}`,
|
||||
`**Agents:** ${agentCount}`,
|
||||
`**Sessions:** ${sessionCount}`,
|
||||
`**Default Agent:** ${health.defaultAgentId || "none"}`,
|
||||
];
|
||||
if (health.durationMs) {
|
||||
lines.push(`**Response:** ${health.durationMs}ms`);
|
||||
}
|
||||
return { content: lines.join("\n") };
|
||||
} catch (err) {
|
||||
return { content: `Failed to fetch status: ${String(err)}` };
|
||||
}
|
||||
}
|
||||
|
||||
async function executeCompact(
|
||||
client: GatewayBrowserClient,
|
||||
sessionKey: string,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseSlashCommand } from "./slash-commands.ts";
|
||||
import { parseSlashCommand, SLASH_COMMANDS } from "./slash-commands.ts";
|
||||
|
||||
describe("parseSlashCommand", () => {
|
||||
it("parses commands with an optional colon separator", () => {
|
||||
@@ -30,4 +30,13 @@ describe("parseSlashCommand", () => {
|
||||
args: "on",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps /status on the agent path", () => {
|
||||
const status = SLASH_COMMANDS.find((entry) => entry.name === "status");
|
||||
expect(status?.executeLocal).not.toBe(true);
|
||||
expect(parseSlashCommand("/status")).toMatchObject({
|
||||
command: { name: "status" },
|
||||
args: "",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -108,10 +108,9 @@ export const SLASH_COMMANDS: SlashCommandDef[] = [
|
||||
},
|
||||
{
|
||||
name: "status",
|
||||
description: "Show system status",
|
||||
description: "Show session status",
|
||||
icon: "barChart",
|
||||
category: "tools",
|
||||
executeLocal: true,
|
||||
},
|
||||
{
|
||||
name: "export",
|
||||
|
||||
Reference in New Issue
Block a user