mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 06:57:10 +00:00
Refine copied debug details
This commit is contained in:
parent
c9d5ff46a5
commit
f4f99af890
4 changed files with 38 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import type { ComponentChild as UiNode } from "preact";
|
||||
import { h } from "preact";
|
||||
|
||||
import { CLIENT_VERSION } from "../../../../constants";
|
||||
import type { Thread } from "../../../../domain/threads/model";
|
||||
import { threadRowCoreProjection } from "../../../threads/row-projection";
|
||||
import { rateLimitSummary } from "../../presentation/runtime/status";
|
||||
|
|
@ -70,7 +71,7 @@ function chatPanelToolbarProjection(input: ToolbarViewModelInput): ToolbarViewMo
|
|||
historyOpen: projection.historyOpen,
|
||||
statusPanelOpen: projection.statusPanelOpen,
|
||||
rateLimit: limit,
|
||||
debugDetails: runtimeDebugDetails(input),
|
||||
debugDetails: () => runtimeDebugDetails(input),
|
||||
openPanel: projection.openPanel,
|
||||
threads: projection.threads,
|
||||
connectLabel: input.connected ? "Reconnect" : "Connect",
|
||||
|
|
@ -84,13 +85,27 @@ function chatPanelToolbarProjection(input: ToolbarViewModelInput): ToolbarViewMo
|
|||
}
|
||||
|
||||
function runtimeDebugDetails(input: ToolbarViewModelInput): string {
|
||||
const connection = input.state.connection;
|
||||
return JSON.stringify(
|
||||
{
|
||||
clientVersion: CLIENT_VERSION,
|
||||
vaultPath: input.vaultPath,
|
||||
configuredCommand: input.configuredCommand,
|
||||
runtimeConfig: input.state.connection.runtimeConfig,
|
||||
activeThreadId: input.state.activeThreadId,
|
||||
connection: {
|
||||
connected: input.connected,
|
||||
phase: connection.phase,
|
||||
statusText: connection.statusText,
|
||||
initializeResponse: connection.initializeResponse,
|
||||
rateLimit: connection.rateLimit,
|
||||
serverDiagnostics: {
|
||||
probes: connection.serverDiagnostics.probes,
|
||||
mcpServers: connection.serverDiagnostics.mcpServers,
|
||||
},
|
||||
},
|
||||
runtimeConfig: connection.runtimeConfig,
|
||||
runtime: input.state.runtime,
|
||||
availableModels: input.state.connection.availableModels,
|
||||
availableModels: connection.availableModels,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export interface ToolbarViewModel {
|
|||
historyOpen: boolean;
|
||||
statusPanelOpen: boolean;
|
||||
rateLimit: RateLimitSummary | null;
|
||||
debugDetails: string;
|
||||
debugDetails: () => string;
|
||||
openPanel: "history" | "chat-actions" | "status" | null;
|
||||
threads: ToolbarThreadRow[];
|
||||
connectLabel: string;
|
||||
|
|
@ -167,7 +167,7 @@ function StatusPanel({ model, actions }: { model: ToolbarViewModel; actions: Too
|
|||
<ToolbarPanelItem
|
||||
label="Copy debug details"
|
||||
onClick={() => {
|
||||
actions.copyDebugDetails(model.debugDetails);
|
||||
actions.copyDebugDetails(model.debugDetails());
|
||||
}}
|
||||
className="codex-panel__status-panel-item"
|
||||
role="menuitem"
|
||||
|
|
|
|||
|
|
@ -81,6 +81,22 @@ describe("chat panel surface projections", () => {
|
|||
|
||||
expect(debugDetails["vaultPath"]).toBe("/vault");
|
||||
expect(debugDetails["configuredCommand"]).toBe("codex");
|
||||
expect(debugDetails["clientVersion"]).toEqual(expect.any(String));
|
||||
expect(debugDetails["activeThreadId"]).toBeNull();
|
||||
expect(debugDetails["connection"]).toMatchObject({
|
||||
connected: true,
|
||||
phase: { kind: "idle" },
|
||||
statusText: "Idle",
|
||||
initializeResponse: null,
|
||||
rateLimit: null,
|
||||
serverDiagnostics: {
|
||||
probes: expect.any(Object),
|
||||
mcpServers: [],
|
||||
},
|
||||
});
|
||||
expect(
|
||||
(debugDetails["connection"] as { serverDiagnostics?: Record<string, unknown> }).serverDiagnostics?.["toolInventory"],
|
||||
).toBeUndefined();
|
||||
expect(debugDetails["runtimeConfig"]).toMatchObject({ model: "gpt-debug" });
|
||||
expect(debugDetails["runtime"]).toMatchObject({ pending: { model: { kind: "set", value: "gpt-debug" } } });
|
||||
expect(debugDetails["runtimeLayers"]).toBeUndefined();
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ describe("Toolbar decisions", () => {
|
|||
toolbarModel({
|
||||
statusPanelOpen: true,
|
||||
openPanel: "status",
|
||||
debugDetails,
|
||||
debugDetails: () => debugDetails,
|
||||
}),
|
||||
toolbarActions({ copyDebugDetails }),
|
||||
);
|
||||
|
|
@ -360,7 +360,7 @@ function toolbarModel(overrides: Partial<ToolbarViewModel> = {}): ToolbarViewMod
|
|||
historyOpen: false,
|
||||
statusPanelOpen: false,
|
||||
rateLimit: null,
|
||||
debugDetails: "{}",
|
||||
debugDetails: () => "{}",
|
||||
openPanel: null,
|
||||
threads: [{ title: "Thread", threadId: "thread", selected: true, disabled: false, canArchive: true, rename: null }],
|
||||
connectLabel: "Reconnect",
|
||||
|
|
|
|||
Loading…
Reference in a new issue