Align status command with Codex app

This commit is contained in:
murashit 2026-05-14 22:55:26 +09:00
parent 41be5627c0
commit bf78000b52
3 changed files with 22 additions and 13 deletions

View file

@ -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;

View file

@ -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." },

View file

@ -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.",
);
});
});