Move chat runtime modules into chat feature

This commit is contained in:
murashit 2026-06-09 17:48:48 +09:00
parent 7507e03d2f
commit 4542e251d8
24 changed files with 79 additions and 75 deletions

View file

@ -1,6 +1,6 @@
import { panelThreadsFromAppServerThreads } from "../../../app-server/thread-model";
import type { PanelThread } from "../../../domain/threads/model";
import { requestedOrConfiguredServiceTier, type RuntimeSnapshot } from "../../../runtime/effective-settings";
import { requestedOrConfiguredServiceTier, type RuntimeSnapshot } from "../runtime/effective-settings";
import { resumedThreadActionFromAppServerResponse } from "../threads/thread-resume";
import type { ChatAppServerBaseHost } from "./shared";

View file

@ -2,7 +2,7 @@ import type { InitializeResponse } from "../../generated/app-server/InitializeRe
import type { PanelThread } from "../../domain/threads/model";
import type { ThreadTokenUsage } from "../../generated/app-server/v2/ThreadTokenUsage";
import type { ReasoningEffort } from "../../runtime/models";
import type { ChatRuntimeState } from "../../runtime/chat-runtime-state";
import type { ChatRuntimeState } from "./runtime/state";
import type { PanelCollaborationMode } from "../../runtime/collaboration";
import { parseServiceTier, type ServiceTier } from "../../runtime/service-tier";
import type { ChatAction, PendingTurnStart } from "./chat-state";

View file

@ -22,7 +22,7 @@ import {
setRequestedServiceTierRuntimeState,
setSelectedCollaborationModeRuntimeState,
type ChatRuntimeState,
} from "../../runtime/chat-runtime-state";
} from "./runtime/state";
import type { PendingApproval } from "./requests/approval";
import type { ComposerSuggestion } from "./composer/suggestions";
import { upsertDisplayItem } from "./display/stream-updates";
@ -71,7 +71,7 @@ export interface ChatActiveThreadState {
tokenUsage: ThreadTokenUsage | null;
}
export type { ChatRuntimeState } from "../../runtime/chat-runtime-state";
export type { ChatRuntimeState } from "./runtime/state";
interface ChatComposerState {
draft: string;

View file

@ -2,7 +2,7 @@ import type { App, Component, EventRef, WorkspaceLeaf } from "obsidian";
import type { AppServerClient } from "../../../app-server/client";
import type { ArchiveExportAdapter } from "../../../domain/threads/export";
import type { RuntimeSnapshot } from "../../../runtime/effective-settings";
import type { RuntimeSnapshot } from "../runtime/effective-settings";
import type { ChatState, ChatStateStore } from "../chat-state";
import type { CodexChatHost } from "../chat-host";
import type { ChatMessageScrollIntentController } from "../panel/message-scroll-intent-controller";

View file

@ -1,7 +1,7 @@
import { readRuntimeConfig } from "../../../../runtime/config";
import { autoReviewActive, currentModel, currentReasoningEffort, fastModeActive } from "../../../../runtime/effective-settings";
import { compactReasoningEffortLabel } from "../../../../runtime/override-commands";
import { contextSummary } from "../../../../runtime/status-summary";
import { readRuntimeConfig } from "../../runtime/config";
import { autoReviewActive, currentModel, currentReasoningEffort, fastModeActive } from "../../runtime/effective-settings";
import { compactReasoningEffortLabel } from "../../runtime/override-commands";
import { contextSummary } from "../../runtime/status-summary";
import type { ChatState } from "../../chat-state";
import type { ComposerContextMeterCellViewModel, ComposerContextMeterViewModel, ComposerMetaViewModel } from "./types";
import type { runtimeSnapshotForChatSlices } from "./runtime";

View file

@ -1,13 +1,13 @@
import { readRuntimeConfig } from "../../../../runtime/config";
import { readRuntimeConfig } from "../../runtime/config";
import {
currentModel,
currentReasoningEffort,
pendingRuntimeSettingLabel,
serviceTierLabel,
supportedReasoningEfforts,
} from "../../../../runtime/effective-settings";
} from "../../runtime/effective-settings";
import { sortedModelOptions } from "../../../../runtime/models";
import { contextSummary, rateLimitSummary, type RateLimitSummary } from "../../../../runtime/status-summary";
import { contextSummary, rateLimitSummary, type RateLimitSummary } from "../../runtime/status-summary";
import type {
EffortStatusLinesInput,
ModelStatusLinesInput,

View file

@ -1,6 +1,6 @@
import type { PanelThread } from "../../../../domain/threads/model";
import { getThreadTitle } from "../../../../domain/threads/model";
import { effectiveConfigSections, rateLimitSummary } from "../../../../runtime/status-summary";
import { effectiveConfigSections, rateLimitSummary } from "../../runtime/status-summary";
import { connectionDiagnosticSections } from "../../diagnostics";
import type { ConnectionDiagnosticsModelInput, ToolbarThreadRow, ToolbarViewModel, ToolbarViewModelInput } from "./types";

View file

@ -1,6 +1,6 @@
import type { ReasoningEffort } from "../../../../runtime/models";
import type { RuntimeSnapshot } from "../../../../runtime/effective-settings";
import type { EffectiveConfigSection, RateLimitSummary } from "../../../../runtime/status-summary";
import type { RuntimeSnapshot } from "../../runtime/effective-settings";
import type { EffectiveConfigSection, RateLimitSummary } from "../../runtime/status-summary";
import type { ChatState } from "../../chat-state";
export interface RuntimeSnapshotInput {

View file

@ -1,5 +1,5 @@
import type { ReasoningEffort } from "../../../../runtime/models";
import type { RuntimeSnapshot } from "../../../../runtime/effective-settings";
import type { RuntimeSnapshot } from "../../runtime/effective-settings";
import type { SendShortcut } from "../../../../shared/ui/keyboard";
import type { ChatState } from "../../chat-state";
import type { ToolbarThreadRow } from "../model/types";

View file

@ -1,7 +1,7 @@
import type { PanelThread } from "../../../domain/threads/model";
import type { OpenCodexPanelSnapshot } from "../../../workspace/open-panel-snapshot";
import { readRuntimeConfig } from "../../../runtime/config";
import { currentModel } from "../../../runtime/effective-settings";
import { readRuntimeConfig } from "../runtime/config";
import { currentModel } from "../runtime/effective-settings";
import { activeTurnId, chatTurnBusy, type ChatState } from "../chat-state";
import type { DisplayItem } from "../display/types";
import type { RestoredThreadState } from "./lifecycle";

View file

@ -1,16 +1,16 @@
import type { ReasoningSummary } from "../generated/app-server/ReasoningSummary";
import type { Verbosity } from "../generated/app-server/Verbosity";
import type { WebSearchMode } from "../generated/app-server/WebSearchMode";
import type { ConfigReadResponse } from "../generated/app-server/v2/ConfigReadResponse";
import type { AppsConfig } from "../generated/app-server/v2/AppsConfig";
import type { AskForApproval } from "../generated/app-server/v2/AskForApproval";
import type { Config } from "../generated/app-server/v2/Config";
import type { SandboxMode } from "../generated/app-server/v2/SandboxMode";
import type { SandboxWorkspaceWrite } from "../generated/app-server/v2/SandboxWorkspaceWrite";
import type { ToolsV2 } from "../generated/app-server/v2/ToolsV2";
import { parseServiceTier, type ServiceTier } from "./service-tier";
import { isReasoningEffort, type ReasoningEffort } from "./models";
import { approvalsReviewerOrNull, type ApprovalsReviewer } from "./approvals";
import type { ReasoningSummary } from "../../../generated/app-server/ReasoningSummary";
import type { Verbosity } from "../../../generated/app-server/Verbosity";
import type { WebSearchMode } from "../../../generated/app-server/WebSearchMode";
import type { ConfigReadResponse } from "../../../generated/app-server/v2/ConfigReadResponse";
import type { AppsConfig } from "../../../generated/app-server/v2/AppsConfig";
import type { AskForApproval } from "../../../generated/app-server/v2/AskForApproval";
import type { Config } from "../../../generated/app-server/v2/Config";
import type { SandboxMode } from "../../../generated/app-server/v2/SandboxMode";
import type { SandboxWorkspaceWrite } from "../../../generated/app-server/v2/SandboxWorkspaceWrite";
import type { ToolsV2 } from "../../../generated/app-server/v2/ToolsV2";
import { parseServiceTier, type ServiceTier } from "../../../runtime/service-tier";
import { isReasoningEffort, type ReasoningEffort } from "../../../runtime/models";
import { approvalsReviewerOrNull, type ApprovalsReviewer } from "../../../runtime/approvals";
export interface RuntimeConfigProjection {
profile: string | null;

View file

@ -1,9 +1,9 @@
import type { ActivePermissionProfile } from "../generated/app-server/v2/ActivePermissionProfile";
import type { AskForApproval } from "../generated/app-server/v2/AskForApproval";
import type { ConfigReadResponse } from "../generated/app-server/v2/ConfigReadResponse";
import type { RateLimitSnapshot } from "../generated/app-server/v2/RateLimitSnapshot";
import type { ThreadTokenUsage } from "../generated/app-server/v2/ThreadTokenUsage";
import type { PanelModelOption } from "../domain/catalog/model";
import type { ActivePermissionProfile } from "../../../generated/app-server/v2/ActivePermissionProfile";
import type { AskForApproval } from "../../../generated/app-server/v2/AskForApproval";
import type { ConfigReadResponse } from "../../../generated/app-server/v2/ConfigReadResponse";
import type { RateLimitSnapshot } from "../../../generated/app-server/v2/RateLimitSnapshot";
import type { ThreadTokenUsage } from "../../../generated/app-server/v2/ThreadTokenUsage";
import type { PanelModelOption } from "../../../domain/catalog/model";
import {
configuredServiceTierRequestValue,
isFastServiceTier,
@ -11,11 +11,11 @@ import {
type RequestedServiceTier,
type ServiceTier,
type ServiceTierRequest,
} from "./service-tier";
import { findModelOptionByIdOrName, supportedEffortsForModelOption, type ReasoningEffort } from "./models";
} from "../../../runtime/service-tier";
import { findModelOptionByIdOrName, supportedEffortsForModelOption, type ReasoningEffort } from "../../../runtime/models";
import { readRuntimeConfig, type RuntimeConfigProjection } from "./config";
import type { PanelCollaborationMode } from "./collaboration";
import { isAutoReviewReviewer, type ApprovalsReviewer } from "./approvals";
import type { PanelCollaborationMode } from "../../../runtime/collaboration";
import { isAutoReviewReviewer, type ApprovalsReviewer } from "../../../runtime/approvals";
export type PendingRuntimeSetting<T> = { kind: "unchanged" } | { kind: "set"; value: T } | { kind: "resetToConfig" };

View file

@ -1,5 +1,5 @@
import { isReasoningEffort, type ReasoningEffort } from "./models";
export { collaborationModeLabel, collaborationModeToggleMessage, nextCollaborationMode } from "./collaboration";
import { isReasoningEffort, type ReasoningEffort } from "../../../runtime/models";
export { collaborationModeLabel, collaborationModeToggleMessage, nextCollaborationMode } from "../../../runtime/collaboration";
const DEFAULT_ALIASES = new Set(["default", "reset", "clear", "off"]);

View file

@ -2,16 +2,16 @@ import type { AppServerClient } from "../../../app-server/client";
import type { ReasoningEffort } from "../../../runtime/models";
import { autoReviewReviewerForState, autoReviewToggleMessage, nextAutoReviewState } from "../../../runtime/approvals";
import type { PanelCollaborationMode } from "../../../runtime/collaboration";
import { collaborationModeToggleMessage, nextCollaborationMode } from "../../../runtime/override-commands";
import { readRuntimeConfig } from "../../../runtime/config";
import { autoReviewActive, fastModeActive, type RuntimeSnapshot } from "../../../runtime/effective-settings";
import { collaborationModeToggleMessage, nextCollaborationMode } from "./override-commands";
import { readRuntimeConfig } from "./config";
import { autoReviewActive, fastModeActive, type RuntimeSnapshot } from "./effective-settings";
import {
pendingThreadSettingsUpdate as buildPendingThreadSettingsUpdate,
type ThreadSettingsUpdate,
type TurnCollaborationModeWarning,
} from "../../../runtime/turn-settings";
} from "./turn-settings";
import type { RequestedServiceTier } from "../../../runtime/service-tier";
import { modelOverrideMessage, reasoningEffortOverrideMessage } from "../../../runtime/override-commands";
import { modelOverrideMessage, reasoningEffortOverrideMessage } from "./override-commands";
import type { ChatAction, ChatState, ChatStateStore } from "../chat-state";
const COLLABORATION_MODE_WARNING_MESSAGES: Record<TurnCollaborationModeWarning, string> = {

View file

@ -1,10 +1,10 @@
import type { ActivePermissionProfile } from "../generated/app-server/v2/ActivePermissionProfile";
import type { AskForApproval } from "../generated/app-server/v2/AskForApproval";
import type { ThreadSettingsUpdateParams } from "../generated/app-server/v2/ThreadSettingsUpdateParams";
import { parseServiceTier, type RequestedServiceTier, type ServiceTier } from "./service-tier";
import type { PanelCollaborationMode } from "./collaboration";
import type { ReasoningEffort } from "./models";
import type { ApprovalsReviewer } from "./approvals";
import type { ActivePermissionProfile } from "../../../generated/app-server/v2/ActivePermissionProfile";
import type { AskForApproval } from "../../../generated/app-server/v2/AskForApproval";
import type { ThreadSettingsUpdateParams } from "../../../generated/app-server/v2/ThreadSettingsUpdateParams";
import { parseServiceTier, type RequestedServiceTier, type ServiceTier } from "../../../runtime/service-tier";
import type { PanelCollaborationMode } from "../../../runtime/collaboration";
import type { ReasoningEffort } from "../../../runtime/models";
import type { ApprovalsReviewer } from "../../../runtime/approvals";
import {
resetRuntimeSettingToConfig,
setPendingRuntimeSetting,

View file

@ -1,8 +1,8 @@
import type { RateLimitWindow } from "../generated/app-server/v2/RateLimitWindow";
import type { SpendControlLimitSnapshot } from "../generated/app-server/v2/SpendControlLimitSnapshot";
import type { ThreadTokenUsage } from "../generated/app-server/v2/ThreadTokenUsage";
import { jsonPreview } from "../utils";
import { defaultEffortForModelOption, sortedModelOptions } from "./models";
import type { RateLimitWindow } from "../../../generated/app-server/v2/RateLimitWindow";
import type { SpendControlLimitSnapshot } from "../../../generated/app-server/v2/SpendControlLimitSnapshot";
import type { ThreadTokenUsage } from "../../../generated/app-server/v2/ThreadTokenUsage";
import { jsonPreview } from "../../../utils";
import { defaultEffortForModelOption, sortedModelOptions } from "../../../runtime/models";
import { readRuntimeConfig, type RuntimeConfigProjection } from "./config";
import {
currentApprovalsReviewer,

View file

@ -1,5 +1,5 @@
import type { CollaborationMode } from "../generated/app-server/CollaborationMode";
import type { ThreadSettingsUpdateParams } from "../generated/app-server/v2/ThreadSettingsUpdateParams";
import type { CollaborationMode } from "../../../generated/app-server/CollaborationMode";
import type { ThreadSettingsUpdateParams } from "../../../generated/app-server/v2/ThreadSettingsUpdateParams";
import { readRuntimeConfig, type RuntimeConfigProjection } from "./config";
import {
currentModel,
@ -8,7 +8,7 @@ import {
pendingRuntimeSettingPayload,
type RuntimeSnapshot,
} from "./effective-settings";
import { requestedServiceTierRequestValue } from "./service-tier";
import { requestedServiceTierRequestValue } from "../../../runtime/service-tier";
export type ThreadSettingsUpdate = Omit<ThreadSettingsUpdateParams, "threadId">;
export type TurnCollaborationModeWarning = "missing-model";

View file

@ -6,7 +6,7 @@ import type { AskForApproval } from "../../../generated/app-server/v2/AskForAppr
import type { PanelThread } from "../../../domain/threads/model";
import type { ThreadStartResponse } from "../../../generated/app-server/v2/ThreadStartResponse";
import type { ThreadResumeResponse } from "../../../generated/app-server/v2/ThreadResumeResponse";
import type { ChatRuntimeState } from "../../../runtime/chat-runtime-state";
import type { ChatRuntimeState } from "../runtime/state";
import type { DisplayItem } from "../display/types";
import type { ActiveThreadResumedAction } from "../chat-state-actions";

View file

@ -13,7 +13,7 @@ import type { ChatThreadGoalActions } from "../threads/thread-goal-actions";
import type { ThreadHistoryController } from "../threads/thread-history-controller";
import type { ThreadRenameController } from "../threads/thread-rename-controller";
import type { ChatInboundController } from "../inbound/controller";
import { currentModel } from "../../../runtime/effective-settings";
import { currentModel } from "../runtime/effective-settings";
import { ChatMessageRenderer } from "../ui/message-stream";
import type { ChatPanelContext } from "../panel/context";

View file

@ -19,7 +19,7 @@ import {
parseModelOverride,
parseReasoningEffortOverride,
reasoningEffortOverrideMessage,
} from "../../../runtime/override-commands";
} from "../runtime/override-commands";
export interface SlashCommandExecutionContext {
activeThreadId: string | null;

View file

@ -1,7 +1,7 @@
import type { ButtonHTMLAttributes, ComponentChild as UiNode, TargetedKeyboardEvent } from "preact";
import { useLayoutEffect, useRef } from "preact/hooks";
import type { EffectiveConfigSection, RateLimitSummary } from "../../../runtime/status-summary";
import type { EffectiveConfigSection, RateLimitSummary } from "../runtime/status-summary";
import { IconButton } from "../../../shared/ui/components";
import { renderUiRoot } from "../../../shared/ui/ui-root";
import type { ToolbarDiagnosticSection, ToolbarThreadRow, ToolbarViewModel } from "../panel/model/types";

View file

@ -6,8 +6,8 @@ import type { DisplayDetailSection, DisplayItem } from "./display/types";
import type { ReasoningEffort } from "../../runtime/models";
import type { PanelModelOption } from "../../domain/catalog/model";
import type { PanelThread } from "../../domain/threads/model";
import { collaborationModeLabel as formatCollaborationModeLabel } from "../../runtime/override-commands";
import type { RuntimeSnapshot } from "../../runtime/effective-settings";
import { collaborationModeLabel as formatCollaborationModeLabel } from "./runtime/override-commands";
import type { RuntimeSnapshot } from "./runtime/effective-settings";
import { chatTurnBusy, createChatStateStore, type ChatState, type ChatAction } from "./chat-state";
import type { OpenCodexPanelSnapshot } from "../../workspace/open-panel-snapshot";
import type { SharedAppServerMetadata } from "../../app-server/shared-cache-state";

View file

@ -1,6 +1,10 @@
import { describe, expect, it } from "vitest";
import { collaborationModeLabel, collaborationModeToggleMessage, nextCollaborationMode } from "../../src/runtime/override-commands";
import {
collaborationModeLabel,
collaborationModeToggleMessage,
nextCollaborationMode,
} from "../../src/features/chat/runtime/override-commands";
describe("runtime override commands", () => {
it("toggles between Default and Plan mode", () => {

View file

@ -9,7 +9,7 @@ import {
parseModelOverride,
parseReasoningEffortOverride,
reasoningEffortOverrideMessage,
} from "../../src/runtime/override-commands";
} from "../../src/features/chat/runtime/override-commands";
import {
autoReviewActive,
currentApprovalsReviewer,
@ -25,10 +25,10 @@ import {
setPendingRuntimeSetting,
serviceTierLabel,
type RuntimeSnapshot,
} from "../../src/runtime/effective-settings";
import { requestedTurnCollaborationModeSettings } from "../../src/runtime/turn-settings";
import { readRuntimeConfig } from "../../src/runtime/config";
import { contextSummary, effectiveConfigSections, rateLimitSummary } from "../../src/runtime/status-summary";
} from "../../src/features/chat/runtime/effective-settings";
import { requestedTurnCollaborationModeSettings } from "../../src/features/chat/runtime/turn-settings";
import { readRuntimeConfig } from "../../src/features/chat/runtime/config";
import { contextSummary, effectiveConfigSections, rateLimitSummary } from "../../src/features/chat/runtime/status-summary";
describe("runtime settings", () => {
it("parses model overrides", () => {