mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 06:57:10 +00:00
Decouple runtime and open panel state
This commit is contained in:
parent
27be1adc8a
commit
fdc62d47e2
8 changed files with 9 additions and 10 deletions
|
|
@ -72,7 +72,7 @@ import { renderPendingRequestMessage } from "./ui/pending-request-message";
|
|||
import { renderToolbar, toolbarSignature, type ToolbarChoice, type ToolbarViewModel } from "./ui/toolbar";
|
||||
import type { ChatTurnDiffViewState } from "./ui/turn-diff";
|
||||
import { ChatMessageRenderer, type ChatMessageScrollIntent } from "./chat-message-renderer";
|
||||
import type { OpenCodexPanelSnapshot } from "./panel-snapshot";
|
||||
import type { OpenCodexPanelSnapshot } from "../../runtime/open-panel-snapshot";
|
||||
import type { SharedSessionMetadata } from "../../runtime/shared-app-server-state";
|
||||
|
||||
export interface CodexChatHost {
|
||||
|
|
@ -1486,7 +1486,7 @@ export class CodexChatView extends ItemView {
|
|||
requestedServiceTier: this.state.requestedServiceTier,
|
||||
tokenUsage: this.state.tokenUsage,
|
||||
rateLimit: this.state.rateLimit,
|
||||
displayItems: this.state.displayItems,
|
||||
hasThreadTurns: this.state.displayItems.some((item) => item.turnId),
|
||||
availableModels: this.state.availableModels,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { OpenCodexPanelSnapshot } from "../chat/panel-snapshot";
|
||||
import type { OpenCodexPanelSnapshot } from "../../runtime/open-panel-snapshot";
|
||||
import type { Thread } from "../../generated/app-server/v2/Thread";
|
||||
import { getThreadTitle } from "../../domain/threads/model";
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { VIEW_TYPE_CODEX_THREADS } from "../../constants";
|
|||
import type { Thread } from "../../generated/app-server/v2/Thread";
|
||||
import type { CodexPanelSettings } from "../../settings/model";
|
||||
import { exportArchivedThreadMarkdown } from "../../domain/threads/export";
|
||||
import type { OpenCodexPanelSnapshot } from "../chat/panel-snapshot";
|
||||
import type { OpenCodexPanelSnapshot } from "../../runtime/open-panel-snapshot";
|
||||
import { findThreadNamingContext, generateThreadTitleWithCodex, THREAD_NAMING_CONTEXT_UNAVAILABLE_MESSAGE } from "../chat/thread-naming";
|
||||
import { renderThreadsView } from "./renderer";
|
||||
import { threadRows } from "./state";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { VIEW_TYPE_CODEX_PANEL, VIEW_TYPE_CODEX_THREADS, VIEW_TYPE_CODEX_TURN_DI
|
|||
import { registerSelectionRewriteCommand } from "./features/selection-rewrite/command";
|
||||
import { CodexChatView } from "./features/chat/view";
|
||||
import { CodexChatTurnDiffView } from "./features/chat/chat-turn-diff-view";
|
||||
import type { OpenCodexPanelSnapshot } from "./features/chat/panel-snapshot";
|
||||
import type { OpenCodexPanelSnapshot } from "./runtime/open-panel-snapshot";
|
||||
import { CodexThreadsView } from "./features/threads-view/view";
|
||||
import type { Thread } from "./generated/app-server/v2/Thread";
|
||||
import type { Model } from "./generated/app-server/v2/Model";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import type { ConfigReadResponse } from "../generated/app-server/v2/ConfigReadRe
|
|||
import type { Model } from "../generated/app-server/v2/Model";
|
||||
import type { RateLimitSnapshot } from "../generated/app-server/v2/RateLimitSnapshot";
|
||||
import type { ThreadTokenUsage } from "../generated/app-server/v2/ThreadTokenUsage";
|
||||
import type { DisplayItem } from "../features/chat/display/types";
|
||||
import { serviceTierRequestValue, type ReportedServiceTier, type ServiceTier, type ServiceTierRequest } from "../app-server/service-tier";
|
||||
import { defaultCollaborationMode, planCollaborationMode } from "./collaboration-mode";
|
||||
import { findModelByIdOrName, supportedEffortsForModel } from "./model";
|
||||
|
|
@ -30,7 +29,7 @@ export interface RuntimeSnapshot {
|
|||
requestedServiceTier: ServiceTier | null;
|
||||
tokenUsage: ThreadTokenUsage | null;
|
||||
rateLimit: RateLimitSnapshot | null;
|
||||
displayItems: DisplayItem[];
|
||||
hasThreadTurns: boolean;
|
||||
availableModels: Model[];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export function contextSummary(snapshot: RuntimeSnapshot): ContextSummary | null
|
|||
const contextWindow = usage?.modelContextWindow ?? config.modelContextWindow;
|
||||
if (!usage) {
|
||||
if (!snapshot.activeThreadId) return null;
|
||||
if (!snapshot.displayItems.some((item) => item.turnId)) {
|
||||
if (!snapshot.hasThreadTurns) {
|
||||
return {
|
||||
label: "Context 0%",
|
||||
title: contextWindow
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ describe("runtime settings", () => {
|
|||
contextSummary(
|
||||
runtimeSnapshot({
|
||||
activeThreadId: "thread",
|
||||
displayItems: [{ id: "u1", kind: "message", role: "user", text: "hi", turnId: "t1" }],
|
||||
hasThreadTurns: true,
|
||||
}),
|
||||
),
|
||||
).toMatchObject({
|
||||
|
|
@ -536,7 +536,7 @@ function runtimeSnapshot(overrides: Partial<RuntimeSnapshot> = {}): RuntimeSnaps
|
|||
requestedServiceTier: null,
|
||||
tokenUsage: null,
|
||||
rateLimit: null,
|
||||
displayItems: [],
|
||||
hasThreadTurns: false,
|
||||
availableModels: [],
|
||||
...overrides,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue