diff --git a/src/main.ts b/src/main.ts index c18fcd91..e6b6219f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -29,13 +29,12 @@ import { } from "./panel/collaboration-mode"; import { PanelController } from "./panel/controller"; import { connectionDiagnosticLines, connectionDiagnosticRows } from "./panel/diagnostics"; -import { contextSummary, effectiveConfigSections, rateLimitSummary } from "./panel/runtime-view"; +import { contextSummary, effectiveConfigSections, rateLimitSummary, type RateLimitSummary } from "./panel/runtime-view"; import { configRecord, currentModel, currentReasoningEffort, currentServiceTier, - fastModeLabel, commitRuntimeOverride, resetRuntimeOverride, requestedOrConfiguredServiceTier, @@ -924,18 +923,12 @@ class CodexPanelView extends ItemView { private statusSummaryLines(): string[] { const snapshot = this.runtimeSnapshot(); const context = contextSummary(snapshot); - const config = configRecord(this.state.effectiveConfig); - const model = currentModel(snapshot, config) ?? "(from default)"; - const effort = currentReasoningEffort(snapshot, config); + const limit = rateLimitSummary(snapshot); return [ "Session status", - `Status: ${this.state.status}`, - `Thread: ${this.state.activeThreadId ?? "(none)"}`, - `Turn: ${this.state.activeTurnId ?? "(none)"}`, - `Mode: ${this.collaborationModeLabel()}`, - `Runtime: ${model}${effort ? ` ${effort}` : ""}, fast ${fastModeLabel(snapshot, config)}`, - `Connection: ${this.connection.isConnected() ? "connected" : "offline"}`, + `Session: ${this.state.activeThreadId ?? "(none)"}`, context ? context.title : "Context: not available", + ...(limit ? usageLimitStatusLines(limit) : ["Usage limits: not available"]), ]; } @@ -1420,6 +1413,13 @@ function upsertThread(threads: Thread[], thread: Thread): Thread[] { return threads.map((item, itemIndex) => (itemIndex === index ? { ...item, ...thread } : item)); } +function usageLimitStatusLines(limit: RateLimitSummary): string[] { + return [ + `Usage limits: ${limit.title}`, + ...limit.rows.map((row) => `- ${row.label}: ${row.value}${row.resetLabel ? ` (${row.resetLabel})` : ""}`), + ]; +} + function jsonPreview(value: unknown, fallback: string): string { try { return JSON.stringify(value) ?? fallback; diff --git a/src/panel/slash-commands.ts b/src/panel/slash-commands.ts index e406c757..da8f9dbd 100644 --- a/src/panel/slash-commands.ts +++ b/src/panel/slash-commands.ts @@ -10,8 +10,8 @@ export const SLASH_COMMANDS = [ { command: "/compact", detail: "Compact the current conversation context." }, { command: "/fast", detail: "Toggle fast service tier for subsequent turns." }, { command: "/plan", detail: "Toggle Plan mode, optionally sending a message." }, - { command: "/status", detail: "Show current session and runtime status." }, - { command: "/doctor", detail: "Show Codex CLI and app-server diagnostics." }, + { command: "/status", detail: "Show current session, context, and usage limits." }, + { command: "/doctor", detail: "Show Codex CLI and app-server connection diagnostics." }, { command: "/model", detail: "Show or set the model for subsequent turns." }, { command: "/effort", detail: "Show or set reasoning effort for subsequent turns." }, { command: "/help", detail: "Show available Codex slash commands." }, diff --git a/tests/slash-commands.test.ts b/tests/slash-commands.test.ts index bd7c1cfe..42e4a0f8 100644 --- a/tests/slash-commands.test.ts +++ b/tests/slash-commands.test.ts @@ -148,4 +148,13 @@ describe("slash commands", () => { "/plan - Toggle Plan mode, optionally sending a message.", ); }); + + it("documents status and doctor as separate commands", () => { + expect(slashCommandHelpLines().find((line) => line.startsWith("/status"))).toBe( + "/status - Show current session, context, and usage limits.", + ); + expect(slashCommandHelpLines().find((line) => line.startsWith("/doctor"))).toBe( + "/doctor - Show Codex CLI and app-server connection diagnostics.", + ); + }); });