Organize chat application and host layers

This commit is contained in:
murashit 2026-06-14 17:29:21 +09:00
parent 870a9a7f54
commit cfa693c8ba
179 changed files with 754 additions and 709 deletions

View file

@ -155,13 +155,13 @@ const chatPreactDomBridgeFiles = [
"src/features/chat/ui/message-stream/viewport.tsx",
"src/features/chat/ui/composer-dom.ts",
"src/features/chat/ui/shell.tsx",
"src/features/chat/turn-diff/render.tsx",
"src/features/chat/ui/turn-diff/render.tsx",
];
const chatImperativeDomBridgeFiles = [...chatExternalDomBridgeFiles, ...chatPreactDomBridgeFiles];
const uiRootBridgeFiles = [
"src/features/chat/ui/shell.tsx",
"src/features/chat/turn-diff/render.tsx",
"src/features/chat/turn-diff/view.ts",
"src/features/chat/ui/turn-diff/render.tsx",
"src/features/chat/ui/turn-diff/view.ts",
"src/features/selection-rewrite/popover.tsx",
"src/features/threads-view/renderer.tsx",
];
@ -677,7 +677,7 @@ export default defineConfig([
rules: restrictedSyntaxRule(sourceSyntaxRestrictionsWithoutUiRoot),
},
{
files: ["src/features/chat/state/**/*.{ts,tsx}"],
files: ["src/features/chat/application/state/**/*.{ts,tsx}"],
rules: {
...restrictedSyntaxRule(pureChatStateSyntaxRestrictions),
"codex-panel/no-imperative-dom": "error",

View file

@ -12,7 +12,7 @@ import {
} from "../../../../domain/server/diagnostics";
import { readRateLimitMetadataProbe } from "../../../../app-server/services/metadata";
import type { SharedServerMetadata } from "../../../../domain/server/metadata";
import { mcpStatusLines as buildMcpStatusLines } from "../diagnostics-display";
import { mcpStatusLines as buildMcpStatusLines } from "../../application/connection/diagnostics-display";
import { cloneServerDiagnostics, type ChatServerActionHost } from "./host";
interface RefreshDiagnosticProbesOptions {

View file

@ -1,6 +1,6 @@
import type { AppServerClient } from "../../../../app-server/connection/client";
import { cloneServerDiagnostics } from "../../../../domain/server/diagnostics";
import type { ChatStateStore } from "../../state/reducer";
import type { ChatStateStore } from "../../application/state/reducer";
export interface ChatServerActionHost {
stateStore: ChatStateStore;

View file

@ -1,11 +1,11 @@
import { listThreads } from "../../../../app-server/services/threads";
import type { Thread } from "../../../../domain/threads/model";
import type { RuntimeSnapshot } from "../../runtime/snapshot";
import { runtimeConfigOrDefault } from "../../runtime/effective";
import { serviceTierRequestForThreadStart } from "../../runtime/thread-settings-update";
import { resumedThreadActionFromAppServerResponse } from "../../threads/resume";
import type { RuntimeSnapshot } from "../../application/runtime/snapshot";
import { runtimeConfigOrDefault } from "../../domain/runtime/effective";
import { serviceTierRequestForThreadStart } from "../../application/runtime/thread-settings-update";
import { resumedThreadActionFromAppServerResponse } from "../../application/threads/resume";
import type { ChatServerActionHost } from "./host";
import type { ChatState } from "../../state/reducer";
import type { ChatState } from "../../application/state/reducer";
interface StartedThreadSummary {
threadId: string;

View file

@ -2,8 +2,8 @@ import type { RequestId, ServerNotification, ServerRequest } from "../../../../a
import type { McpServerStartupStatus } from "../../../../domain/server/diagnostics";
import type { ThreadConversationSummary } from "../../../../domain/threads/transcript";
import { classifyAppServerLog } from "./app-server-logs";
import { activeTurnId, type ChatAction, type ChatState, type ChatStateStore } from "../../state/reducer";
import type { MessageStreamNoticeSection } from "../../domain/message-stream/model/items";
import { activeTurnId, type ChatAction, type ChatState, type ChatStateStore } from "../../application/state/reducer";
import type { MessageStreamNoticeSection } from "../../domain/message-stream/items";
import { createStructuredSystemItem, createSystemItem } from "../../domain/message-stream/factories/system-items";
import type { ApprovalAction, PendingApproval, PendingUserInput } from "../../domain/pending-requests/model";
import { approvalResponse } from "../requests/approval";

View file

@ -1,4 +1,4 @@
import { activeThreadSettingsAppliedAction } from "../../state/actions";
import { activeThreadSettingsAppliedAction } from "../../application/state/actions";
import type { McpServerStartupStatus } from "../../../../domain/server/diagnostics";
import { threadTokenUsageFromRuntimeUsage } from "../../../../domain/runtime/metrics";
import type { FileUpdateChange } from "../../../../app-server/protocol/file-change";
@ -7,15 +7,20 @@ import type { ServerNotification } from "../../../../app-server/connection/rpc-m
import { normalizeExplicitThreadName } from "../../../../domain/threads/model";
import type { ThreadConversationSummary } from "../../../../domain/threads/transcript";
import { jsonPreview } from "../../../../utils";
import { activeTurnId, pendingTurnStart as pendingTurnStartForState, type ChatAction, type ChatState } from "../../state/reducer";
import { completeReasoningItems, upsertMessageStreamItemById } from "../../domain/message-stream/operations/updates";
import {
activeTurnId,
pendingTurnStart as pendingTurnStartForState,
type ChatAction,
type ChatState,
} from "../../application/state/reducer";
import { completeReasoningItems, upsertMessageStreamItemById } from "../../domain/message-stream/updates";
import {
messageStreamItemFromTurnItem,
messageStreamItemsFromTurns,
shouldSuppressLifecycleItem,
} from "../mappers/message-stream/turn-items";
import { taskProgressMessageStreamItem } from "../../domain/message-stream/factories/task-progress";
import type { MessageStreamItem, MessageStreamItemKind, MessageStreamMessageItem } from "../../domain/message-stream/model/items";
import type { MessageStreamItem, MessageStreamItemKind, MessageStreamMessageItem } from "../../domain/message-stream/items";
import { goalChangeItem } from "../../domain/message-stream/factories/goal-items";
import { hookRunMessageStreamItem } from "../mappers/message-stream/hook-run-items";
import { createAutoReviewResultItem, createReviewResultItem } from "../mappers/message-stream/review-result-items";
@ -24,10 +29,10 @@ import {
STREAMED_COMMAND_RUNNING_TEXT,
STREAMED_FILE_CHANGE_IN_PROGRESS_TEXT,
STREAMED_MCP_PROGRESS_LABEL,
streamingFileChangeMessageStreamItem,
} from "../../domain/message-stream/factories/streaming-items";
import { attachHookRunsToTurn } from "../../domain/message-stream/operations/updates";
import { messageStreamItems } from "../../state/message-stream";
import { streamingFileChangeMessageStreamItem } from "../mappers/message-stream/streaming-items";
import { attachHookRunsToTurn } from "../../domain/message-stream/updates";
import { messageStreamItems } from "../../application/state/message-stream";
import {
routeServerNotification,
type DiagnosticStatusNotificationMethod,

View file

@ -1,21 +1,10 @@
import { definedProp } from "../../../../../utils";
import type { AgentMessageStreamItem, AgentStateSummary, ExecutionState } from "../../../domain/message-stream/model/items";
import type { AgentMessageStreamItem, AgentStateSummary, ExecutionState } from "../../../domain/message-stream/items";
import { collabAgentStateExecutionState } from "../../../domain/message-stream/agent-state";
type MessageStreamExecutionState = Exclude<ExecutionState, null>;
type ExecutionStateByStatus = Readonly<Record<string, MessageStreamExecutionState>>;
const AGENT_STATES = {
pendingInit: "running",
running: "running",
inProgress: "running",
completed: "completed",
shutdown: "completed",
interrupted: "failed",
errored: "failed",
notFound: "failed",
failed: "failed",
} as const satisfies ExecutionStateByStatus;
const STANDARD_TOOL_STATES = {
inProgress: "running",
completed: "completed",
@ -82,10 +71,6 @@ function collabAgentExecutionState(tool: string, status: string, receiverThreadI
return null;
}
export function collabAgentStateExecutionState(status: string): ExecutionState {
return executionStateFromStatus(status, AGENT_STATES);
}
function collabAgentToolCallExecutionState(status: string): ExecutionState {
return executionStateFromStatus(status, STANDARD_TOOL_STATES);
}

View file

@ -1,5 +1,5 @@
import { definedProp } from "../../../../../utils";
import type { HookMessageStreamItem } from "../../../domain/message-stream/model/items";
import type { HookMessageStreamItem } from "../../../domain/message-stream/items";
interface MessageStreamHookRun {
id: string;

View file

@ -1,4 +1,4 @@
import type { ExecutionState, MessageStreamAuditFact, MessageStreamItem } from "../../../domain/message-stream/model/items";
import type { ExecutionState, MessageStreamAuditFact, MessageStreamItem } from "../../../domain/message-stream/items";
import { pathsRelativeToRoot } from "../../../domain/message-stream/format/path-labels";
import { permissionRows } from "../../../domain/message-stream/format/permission-rows";

View file

@ -0,0 +1,21 @@
import type { FileUpdateChange } from "../../../../../app-server/protocol/file-change";
import type { MessageStreamItem } from "../../../domain/message-stream/items";
import { normalizeFileChanges } from "./turn-items";
export function streamingFileChangeMessageStreamItem(
itemId: string,
turnId: string,
changes: FileUpdateChange[],
status: string,
): MessageStreamItem {
return {
id: itemId,
kind: "fileChange",
role: "tool",
turnId,
sourceItemId: itemId,
provenance: { source: "appServer", channel: "notification", event: "streamingDelta", sourceItemId: itemId },
status,
changes: normalizeFileChanges(changes),
};
}

View file

@ -5,8 +5,8 @@ import type {
MessageStreamFileMention,
MessageStreamItem,
MessageStreamPrimaryTarget,
} from "../../../domain/message-stream/model/items";
import type { MessageStreamItemProvenance } from "../../../domain/message-stream/model/provenance";
} from "../../../domain/message-stream/items";
import type { MessageStreamItemProvenance } from "../../../domain/message-stream/provenance";
import type { HistoricalTurn } from "../../../../../domain/threads/history";
import type { FileUpdateChange } from "../../../../../app-server/protocol/file-change";
import type { TurnItem } from "../../../../../app-server/protocol/turn";

View file

@ -1,7 +1,7 @@
import type { Thread } from "../../domain/threads/model";
import type { SharedServerMetadata } from "../../domain/server/metadata";
import type { CodexPanelSettings } from "../../settings/model";
import type { ChatTurnDiffViewState } from "./turn-diff/model";
import type { Thread } from "../../../domain/threads/model";
import type { SharedServerMetadata } from "../../../domain/server/metadata";
import type { CodexPanelSettings } from "../../../settings/model";
import type { ChatTurnDiffViewState } from "../domain/turn-diff";
export interface CodexChatHost {
readonly settings: CodexPanelSettings;

View file

@ -1,6 +1,6 @@
import { StaleConnectionError } from "../../../app-server/connection/connection-manager";
import type { AppServerClient } from "../../../app-server/connection/client";
import type { ServerInitialization } from "../../../domain/server/initialization";
import { StaleConnectionError } from "../../../../app-server/connection/connection-manager";
import type { AppServerClient } from "../../../../app-server/connection/client";
import type { ServerInitialization } from "../../../../domain/server/initialization";
import type { ChatConnectionPhase, ChatStateStore } from "../state/reducer";
import type { ChatConnectionWorkTracker, ActiveChatConnection } from "../lifecycle";
import {

View file

@ -1,12 +1,12 @@
import { DIAGNOSTIC_PROBE_METHODS, serverIdentity, serverPlatform } from "../../../domain/server/diagnostics";
import { CLIENT_VERSION } from "../../../constants";
import { DIAGNOSTIC_PROBE_METHODS, serverIdentity, serverPlatform } from "../../../../domain/server/diagnostics";
import { CLIENT_VERSION } from "../../../../constants";
import type {
Diagnostics,
InitializeDiagnostics,
DiagnosticProbeResult,
McpServerDiagnostic,
McpServerStatusSummary,
} from "../../../domain/server/diagnostics";
} from "../../../../domain/server/diagnostics";
interface DiagnosticRow {
label: string;

View file

@ -1,7 +1,7 @@
import type { AppServerClient } from "../../../../app-server/connection/client";
import type { CodexInput } from "../../../../domain/chat/input";
import { submissionStateSnapshot } from "../../state/selectors";
import type { ChatStateStore } from "../../state/reducer";
import { submissionStateSnapshot } from "../state/selectors";
import type { ChatStateStore } from "../state/reducer";
import { parseSlashCommand } from "../composer/suggestions";
import type { SlashCommandExecutionResult } from "./slash-command-execution";
import type { SlashCommandName } from "../composer/slash-commands";

View file

@ -1,12 +1,12 @@
import type { AppServerClient } from "../../../../app-server/connection/client";
import type { CodexInput } from "../../../../domain/chat/input";
import type { ChatServerThreadActions } from "../../connection/server-actions/threads";
import type { ChatReconnectActions } from "../../connection/reconnect-actions";
import type { MessageStreamNoticeSection } from "../../domain/message-stream/model/items";
import type { ChatRuntimeSettingsActions } from "../../runtime/settings-actions";
import type { ChatStateStore } from "../../state/reducer";
import type { ThreadManagementActions } from "../../threads/thread-management-actions";
import type { GoalActions } from "../../threads/goal-actions";
import type { ChatServerThreadActions } from "../../app-server/actions/threads";
import type { ChatReconnectActions } from "../connection/reconnect-actions";
import type { MessageStreamNoticeSection } from "../../domain/message-stream/items";
import type { ChatRuntimeSettingsActions } from "../runtime/settings-actions";
import type { ChatStateStore } from "../state/reducer";
import type { ThreadManagementActions } from "../threads/thread-management-actions";
import type { GoalActions } from "../threads/goal-actions";
import { createComposerSubmitActions, type ComposerSubmitActions } from "./composer-submit-actions";
import { createPlanImplementation, type PlanImplementation } from "./plan-implementation";
import { createSlashCommandHandler } from "./slash-command-handler";

View file

@ -1,9 +1,9 @@
import type { PendingTurnStart } from "../../state/reducer";
import type { MessageStreamFileMention, MessageStreamItem, MessageStreamMessageItem } from "../../domain/message-stream/model/items";
import type { MessageStreamItemProvenance } from "../../domain/message-stream/model/provenance";
import type { PendingTurnStart } from "../state/reducer";
import type { MessageStreamFileMention, MessageStreamItem, MessageStreamMessageItem } from "../../domain/message-stream/items";
import type { MessageStreamItemProvenance } from "../../domain/message-stream/provenance";
import { fileMentionsFromInput } from "../../domain/message-stream/format/file-mentions";
import { userMessageDisplayText } from "../../domain/message-stream/format/user-message-text";
import { attachHookRunsToTurn } from "../../domain/message-stream/operations/updates";
import { attachHookRunsToTurn } from "../../domain/message-stream/updates";
import type { CodexInput } from "../../../../domain/chat/input";
export interface LocalUserMessageParams {

View file

@ -1,7 +1,7 @@
import type { AppServerClient } from "../../../../app-server/connection/client";
import { activeThreadId, canImplementPlan } from "../../state/selectors";
import type { ChatStateStore } from "../../state/reducer";
import type { MessageStreamItem } from "../../domain/message-stream/model/items";
import { activeThreadId, canImplementPlan } from "../state/selectors";
import type { ChatStateStore } from "../state/reducer";
import type { MessageStreamItem } from "../../domain/message-stream/items";
const IMPLEMENT_PLAN_PROMPT = "Please implement this plan.";

View file

@ -12,8 +12,8 @@ import {
type SlashCommandName,
type SlashCommandSubcommandDefinition,
} from "../composer/slash-commands";
import type { MessageStreamAuditFact, MessageStreamNoticeSection } from "../../domain/message-stream/model/items";
import { modelOverrideMessage, reasoningEffortOverrideMessage } from "../../runtime/messages";
import type { MessageStreamAuditFact, MessageStreamNoticeSection } from "../../domain/message-stream/items";
import { modelOverrideMessage, reasoningEffortOverrideMessage } from "../runtime/messages";
import { currentThreadReferenceMessage } from "./messages";
import {
finishBeforeArchivingThreadsMessage,
@ -21,7 +21,7 @@ import {
noActiveThreadToCompactMessage,
noActiveThreadToForkMessage,
noActiveThreadToRollbackMessage,
} from "../../threads/messages";
} from "../threads/messages";
import { parseModelOverride, parseReasoningEffortOverride } from "./runtime-setting-commands";
export interface SlashCommandExecutionContext {

View file

@ -13,10 +13,10 @@ import {
import type { SlashCommandName } from "../composer/slash-commands";
import type { ReasoningEffort } from "../../../../domain/catalog/metadata";
import { findModelMetadataByIdOrName, supportedEffortsForModelMetadata } from "../../../../domain/catalog/metadata";
import { submissionStateSnapshot } from "../../state/selectors";
import type { ChatStateStore } from "../../state/reducer";
import { currentModel, runtimeConfigOrDefault } from "../../runtime/effective";
import { runtimeSnapshotForChatState } from "../../runtime/snapshot";
import { submissionStateSnapshot } from "../state/selectors";
import type { ChatStateStore } from "../state/reducer";
import { currentModel, runtimeConfigOrDefault } from "../../domain/runtime/effective";
import { runtimeSnapshotForChatState } from "../runtime/snapshot";
type DynamicSlashCommandExecutionContext = "activeThreadId" | "busy" | "listedThreads" | "referThread" | "supportedReasoningEfforts";

View file

@ -1,8 +1,8 @@
import type { AppServerClient } from "../../../../app-server/connection/client";
import type { CodexInput } from "../../../../domain/chat/input";
import type { ReferencedThreadMetadata } from "../../../../domain/threads/reference";
import { submissionStateSnapshot } from "../../state/selectors";
import type { ChatStateStore } from "../../state/reducer";
import { submissionStateSnapshot } from "../state/selectors";
import type { ChatStateStore } from "../state/reducer";
import { currentTurnNotSteerableMessage, STATUS_STEERED_CURRENT_TURN, STATUS_TURN_RUNNING } from "./messages";
import {
acknowledgeOptimisticTurnStart,

View file

@ -3,8 +3,7 @@ import {
type ActiveConnectionWork,
type ConnectionWorkLifecycleEvent,
type ConnectionWorkLifecycleState,
} from "../../shared/lifecycle/connection-work";
import { DeferredTask, type DeferredTaskWindow } from "../../shared/lifecycle/deferred-task";
} from "../../../shared/lifecycle/connection-work";
export interface RestoredThreadState {
threadId: string;
@ -41,44 +40,6 @@ export interface ChatViewDeferredTasks {
clearAll(): void;
}
export function createChatViewDeferredTasks(getWindow: () => DeferredTaskWindow): ChatViewDeferredTasks {
const diagnosticsTask = new DeferredTask(getWindow, 1_000);
const restoredThreadHydrationTask = new DeferredTask(getWindow, 1_500);
const appServerWarmupTask = new DeferredTask(getWindow, 0);
return {
scheduleDiagnostics(callback): void {
diagnosticsTask.schedule(callback);
},
clearDiagnostics(): void {
diagnosticsTask.clear();
},
scheduleRestoredThreadHydration(callback): void {
restoredThreadHydrationTask.schedule(callback);
},
clearRestoredThreadHydration(): void {
restoredThreadHydrationTask.clear();
},
scheduleAppServerWarmup(callback): void {
appServerWarmupTask.schedule(callback);
},
clearAppServerWarmup(): void {
appServerWarmupTask.clear();
},
clearAll(): void {
restoredThreadHydrationTask.clear();
appServerWarmupTask.clear();
diagnosticsTask.clear();
},
};
}
export class ChatConnectionWorkTracker {
private state: ChatConnectionLifecycleState = { kind: "idle" };

View file

@ -0,0 +1,18 @@
import type { ApprovalAction, PendingApproval, PendingRequestId, PendingUserInput } from "../../domain/pending-requests/model";
export type { PendingRequestId } from "../../domain/pending-requests/model";
export interface PendingRequestBlockState {
approvals: readonly PendingApproval[];
pendingUserInputs: readonly PendingUserInput[];
userInputDrafts: ReadonlyMap<string, string>;
approvalDetails: ReadonlySet<string>;
}
export interface PendingRequestBlockActions {
resolveApproval: (requestId: PendingRequestId, action: ApprovalAction) => void;
resolveUserInput: (requestId: PendingRequestId) => void;
cancelUserInput: (requestId: PendingRequestId) => void;
setApprovalDetailsExpanded?: (requestId: PendingRequestId, expanded: boolean) => void;
setUserInputDraft: (key: string, value: string) => void;
}

View file

@ -1,14 +1,14 @@
import type { ChatStateStore } from "../../state/reducer";
import type { ChatStateStore } from "../state/reducer";
import type { ChatInboundController } from "../../app-server/inbound/controller";
import { pendingRequestFocusSignature } from "../../domain/pending-requests/signatures";
import { pendingRequestBlockSnapshot, type PendingRequestBlockSnapshot } from "../../presentation/pending-requests/snapshot";
import { pendingRequestBlockState } from "./snapshot";
import {
answersForPendingUserInput,
type ApprovalAction,
type PendingApproval,
type PendingUserInput,
} from "../../domain/pending-requests/model";
import type { PendingRequestBlockActions, PendingRequestId } from "../../presentation/pending-requests/view-model";
import type { PendingRequestBlockActions, PendingRequestBlockState, PendingRequestId } from "./block";
export interface PendingRequestControllerHost {
stateStore: ChatStateStore;
@ -44,8 +44,8 @@ export class PendingRequestController {
constructor(private readonly host: PendingRequestControllerHost) {}
snapshot(): PendingRequestBlockSnapshot {
return pendingRequestBlockSnapshot(this.host.stateStore.getState());
snapshot(): PendingRequestBlockState {
return pendingRequestBlockState(this.host.stateStore.getState());
}
actions(): PendingRequestBlockActions {
@ -64,7 +64,7 @@ export class PendingRequestController {
if (!input) return;
this.host.controller.resolveUserInput(
input,
answersForPendingUserInput(input, pendingRequestBlockSnapshot(this.host.stateStore.getState()).userInputDrafts),
answersForPendingUserInput(input, pendingRequestBlockState(this.host.stateStore.getState()).userInputDrafts),
);
this.commitRequestAction();
}

View file

@ -0,0 +1,11 @@
import type { ChatState } from "../state/reducer";
import type { PendingRequestBlockState } from "./block";
export function pendingRequestBlockState(state: ChatState): PendingRequestBlockState {
return {
approvals: state.requests.approvals,
pendingUserInputs: state.requests.pendingUserInputs,
userInputDrafts: state.requests.userInputDrafts,
approvalDetails: state.ui.disclosures.approvalDetails,
};
}

View file

@ -1,6 +1,6 @@
import type { ReasoningEffort } from "../../../domain/catalog/metadata";
import type { CollaborationMode } from "./pending-settings";
import type { TurnCollaborationModeWarning } from "./thread-settings-update";
import type { ReasoningEffort } from "../../../../domain/catalog/metadata";
import type { CollaborationMode } from "../../domain/runtime/pending-settings";
import type { TurnCollaborationModeWarning } from "../../domain/runtime/warnings";
const COLLABORATION_MODE_WARNING_MESSAGES: Record<TurnCollaborationModeWarning, string> = {
"missing-model": "No effective model is available. Sending without a mode override.",
@ -16,40 +16,6 @@ export function reasoningEffortOverrideMessage(effort: ReasoningEffort | null):
: `Reasoning effort set to ${effort} for subsequent turns.`;
}
export function compactModelLabel(model: string | null): string {
if (!model) return "default";
const match = /^gpt-(.+)$/.exec(model);
return match?.[1] ?? model;
}
export function compactReasoningEffortLabel(effort: ReasoningEffort | null): string {
if (!effort) return "default";
if (effort === "minimal") return "min";
return effort;
}
export function collaborationModeLabel(mode: CollaborationMode): string {
return mode === "plan" ? "Plan" : "Default";
}
export function pendingRuntimeSettingLabel(
setting: { kind: "unchanged" } | { kind: "set"; value: unknown } | { kind: "resetToConfig" },
): string {
if (setting.kind === "set") return String(setting.value);
if (setting.kind === "resetToConfig") return "(reset to config)";
return "(none)";
}
export function serviceTierLabel(value: string | null): string {
return value ?? "(Codex default)";
}
export function fastModeLabel(input: { requestedOff: boolean; active: boolean; serviceTier: string | null }): string {
if (input.requestedOff) return "off";
if (input.active) return "on";
return input.serviceTier ? "off" : "Codex default";
}
export function fastModeToggleMessage(state: "enabled" | "disabled"): string {
return state === "enabled" ? "Fast mode on for subsequent turns." : "Fast mode off for subsequent turns.";
}

View file

@ -1,15 +1,15 @@
import type { AppServerClient } from "../../../app-server/connection/client";
import type { RuntimeConfigSnapshot } from "../../../domain/runtime/config";
import type { ApprovalsReviewer } from "../../../domain/runtime/policy";
import type { RuntimeSettingsPatch } from "../../../domain/runtime/thread-settings";
import type { ReasoningEffort } from "../../../domain/catalog/metadata";
import { autoReviewActive, fastModeActive, runtimeConfigOrDefault } from "./effective";
import type { AppServerClient } from "../../../../app-server/connection/client";
import type { RuntimeConfigSnapshot } from "../../../../domain/runtime/config";
import type { ApprovalsReviewer } from "../../../../domain/runtime/policy";
import type { RuntimeSettingsPatch } from "../../../../domain/runtime/thread-settings";
import type { ReasoningEffort } from "../../../../domain/catalog/metadata";
import { autoReviewActive, fastModeActive, runtimeConfigOrDefault } from "../../domain/runtime/effective";
import {
pendingRuntimeSettingsPatch as buildPendingRuntimeSettingsPatch,
type PendingRuntimeSettingsPatch,
} from "./thread-settings-update";
import type { RuntimeSnapshot } from "./snapshot";
import { nextCollaborationMode, type CollaborationMode, type RequestedServiceTier } from "./pending-settings";
import { nextCollaborationMode, type CollaborationMode, type RequestedServiceTier } from "../../domain/runtime/pending-settings";
import {
autoReviewToggleMessage,
collaborationModeToggleMessage,

View file

@ -1,32 +1,9 @@
import type { ChatState } from "../state/reducer";
import type { RuntimeConfigSnapshot } from "../../../domain/runtime/config";
import type { RateLimitSnapshot, ThreadTokenUsage } from "../../../domain/runtime/metrics";
import type { ActivePermissionProfile, ApprovalPolicy, ApprovalsReviewer, ServiceTier } from "../../../domain/runtime/policy";
import type { ModelMetadata, ReasoningEffort } from "../../../domain/catalog/metadata";
import type { ActiveCollaborationMode, CollaborationMode, PendingRuntimeSetting, RequestedServiceTier } from "./pending-settings";
import type { MessageStreamItem } from "../domain/message-stream/model/items";
import type { MessageStreamItem } from "../../domain/message-stream/items";
import type { RuntimeSnapshot } from "../../domain/runtime/snapshot";
import { messageStreamItems } from "../state/message-stream";
export interface RuntimeSnapshot {
runtimeConfig: RuntimeConfigSnapshot | null;
activeThreadId: string | null;
activeModel: string | null;
activeReasoningEffort: ReasoningEffort | null;
activeCollaborationMode: ActiveCollaborationMode;
activeServiceTier: ServiceTier | null;
activeApprovalPolicy: ApprovalPolicy | null;
activeApprovalsReviewer: ApprovalsReviewer | null;
activePermissionProfile: ActivePermissionProfile | null;
requestedModel: PendingRuntimeSetting<string>;
requestedReasoningEffort: PendingRuntimeSetting<ReasoningEffort>;
requestedApprovalsReviewer: PendingRuntimeSetting<ApprovalsReviewer>;
selectedCollaborationMode: CollaborationMode;
requestedServiceTier: PendingRuntimeSetting<RequestedServiceTier>;
tokenUsage: ThreadTokenUsage | null;
rateLimit: RateLimitSnapshot | null;
hasThreadTurns: boolean;
availableModels: readonly ModelMetadata[];
}
export type { RuntimeSnapshot } from "../../domain/runtime/snapshot";
interface RuntimeSnapshotInput {
runtimeConfig: ChatState["connection"]["runtimeConfig"];

View file

@ -3,13 +3,12 @@ import {
runtimeCollaborationModeSettings,
type RuntimeServiceTierRequest,
type RuntimeSettingsPatch,
} from "../../../domain/runtime/thread-settings";
import { currentModel, currentReasoningEffort, fastRuntimeServiceTierRequestValue } from "./effective";
import type { RuntimeConfigSnapshot } from "../../../domain/runtime/config";
import type { RuntimeSnapshot } from "./snapshot";
import { effectiveCollaborationMode, type PendingRuntimeSetting } from "./pending-settings";
export type TurnCollaborationModeWarning = "missing-model";
} from "../../../../domain/runtime/thread-settings";
import { currentModel, currentReasoningEffort, fastRuntimeServiceTierRequestValue } from "../../domain/runtime/effective";
import type { RuntimeConfigSnapshot } from "../../../../domain/runtime/config";
import type { RuntimeSnapshot } from "../../domain/runtime/snapshot";
import { effectiveCollaborationMode, type PendingRuntimeSetting } from "../../domain/runtime/pending-settings";
import type { TurnCollaborationModeWarning } from "../../domain/runtime/warnings";
export type TurnCollaborationModeSettings =
| {

View file

@ -1,11 +1,11 @@
import type { ServerInitialization } from "../../../domain/server/initialization";
import type { Thread } from "../../../domain/threads/model";
import { parseServiceTier, type ServiceTier } from "../../../domain/runtime/policy";
import { normalizeReasoningEffort, type ReasoningEffort } from "../../../domain/catalog/metadata";
import type { ChatRuntimeState } from "../runtime/state";
import type { CollaborationMode } from "../runtime/pending-settings";
import type { MessageStreamItem } from "../domain/message-stream/model/items";
import type { PendingTurnStart } from "../conversation/turns/turn-state";
import type { ServerInitialization } from "../../../../domain/server/initialization";
import type { Thread } from "../../../../domain/threads/model";
import { parseServiceTier, type ServiceTier } from "../../../../domain/runtime/policy";
import { normalizeReasoningEffort, type ReasoningEffort } from "../../../../domain/catalog/metadata";
import type { ChatRuntimeState } from "../../domain/runtime/state";
import type { CollaborationMode } from "../../domain/runtime/pending-settings";
import type { MessageStreamItem } from "../../domain/message-stream/items";
import type { PendingTurnStart } from "../conversation/turn-state";
export interface ActiveThreadResumedAction {
type: "active-thread/resumed";

View file

@ -1,12 +1,12 @@
import { upsertMessageStreamItemById } from "../domain/message-stream/operations/updates";
import type { MessageStreamItem, MessageStreamMessageItem } from "../domain/message-stream/model/items";
import { normalizeProposedPlanMarkdown } from "../domain/message-stream/format/proposed-plan";
import { messageStreamIsTurnInitiator, messageStreamSemanticClassifications } from "../domain/message-stream/semantics";
import { upsertMessageStreamItemById } from "../../domain/message-stream/updates";
import type { MessageStreamItem, MessageStreamMessageItem } from "../../domain/message-stream/items";
import { normalizeProposedPlanMarkdown } from "../../domain/message-stream/format/proposed-plan";
import { messageStreamIsTurnInitiator, messageStreamSemanticClassifications } from "../../domain/message-stream/semantics";
import {
streamedItemOutputMessageStreamItem,
streamedTextMessageStreamItem,
streamedToolOutputMessageStreamItem,
} from "../domain/message-stream/factories/streaming-items";
} from "../../domain/message-stream/factories/streaming-items";
export interface ChatMessageStreamActiveSegment {
turnId: string | null;

View file

@ -1,15 +1,15 @@
import type { ServerInitialization } from "../../../domain/server/initialization";
import type { ReasoningEffort } from "../../../domain/catalog/metadata";
import type { Thread } from "../../../domain/threads/model";
import type { ModelMetadata, SkillMetadata } from "../../../domain/catalog/metadata";
import type { ThreadGoal } from "../../../domain/threads/goal";
import type { Diagnostics } from "../../../domain/server/diagnostics";
import { createServerDiagnostics } from "../../../domain/server/diagnostics";
import type { RuntimeConfigSnapshot } from "../../../domain/runtime/config";
import type { RateLimitSnapshot, ThreadTokenUsage } from "../../../domain/runtime/metrics";
import type { ApprovalsReviewer } from "../../../domain/runtime/policy";
import type { RuntimeSettingsPatch } from "../../../domain/runtime/thread-settings";
import type { CollaborationMode } from "../runtime/pending-settings";
import type { ServerInitialization } from "../../../../domain/server/initialization";
import type { ReasoningEffort } from "../../../../domain/catalog/metadata";
import type { Thread } from "../../../../domain/threads/model";
import type { ModelMetadata, SkillMetadata } from "../../../../domain/catalog/metadata";
import type { ThreadGoal } from "../../../../domain/threads/goal";
import type { Diagnostics } from "../../../../domain/server/diagnostics";
import { createServerDiagnostics } from "../../../../domain/server/diagnostics";
import type { RuntimeConfigSnapshot } from "../../../../domain/runtime/config";
import type { RateLimitSnapshot, ThreadTokenUsage } from "../../../../domain/runtime/metrics";
import type { ApprovalsReviewer } from "../../../../domain/runtime/policy";
import type { RuntimeSettingsPatch } from "../../../../domain/runtime/thread-settings";
import type { CollaborationMode } from "../../domain/runtime/pending-settings";
import {
commitPendingRuntimeSettingsPatchState,
clearRequestedApprovalsReviewerRuntimeState,
@ -24,11 +24,11 @@ import {
resetReasoningEffortToConfigRuntimeState,
setSelectedCollaborationModeRuntimeState,
type ChatRuntimeState,
} from "../runtime/state";
import type { RequestedServiceTier } from "../runtime/pending-settings";
import type { RequestId } from "../../../app-server/connection/rpc-messages";
import type { ComposerSuggestion } from "../conversation/composer/suggestions";
import type { MessageStreamItem } from "../domain/message-stream/model/items";
} from "../../domain/runtime/state";
import type { RequestedServiceTier } from "../../domain/runtime/pending-settings";
import type { RequestId } from "../../../../app-server/connection/rpc-messages";
import type { ComposerSuggestion } from "../composer/suggestions";
import type { MessageStreamItem } from "../../domain/message-stream/items";
import type {
ActiveThreadResumedAction,
ActiveThreadRestoredPlaceholderAction,
@ -62,14 +62,14 @@ import {
resolveChatRequest,
type ChatRequestState,
type RequestAction,
} from "../application/pending-requests/state";
} from "../pending-requests/state";
import {
initialChatTurnState,
transitionChatTurnLifecycleState,
type ChatTurnState,
type PendingTurnStart,
} from "../conversation/turns/turn-state";
import { STATUS_TURN_RUNNING, turnCompletedStatus } from "../conversation/turns/messages";
} from "../conversation/turn-state";
import { STATUS_TURN_RUNNING, turnCompletedStatus } from "../conversation/messages";
export {
activeTurnId,
@ -79,7 +79,7 @@ export {
type ChatTurnLifecycleState,
type ChatTurnState,
type PendingTurnStart,
} from "../conversation/turns/turn-state";
} from "../conversation/turn-state";
export type { ChatMessageStreamState } from "./message-stream";
export type ChatConnectionPhase =
@ -112,7 +112,7 @@ export interface ChatActiveThreadState {
tokenUsage: ThreadTokenUsage | null;
}
export type { ChatRuntimeState } from "../runtime/state";
export type { ChatRuntimeState } from "../../domain/runtime/state";
interface ChatComposerState {
draft: string;

View file

@ -7,9 +7,9 @@ import type {
ChatTurnState,
PendingTurnStart,
} from "./reducer";
import type { Thread } from "../../../domain/threads/model";
import type { MessageStreamItem } from "../domain/message-stream/model/items";
import { latestImplementablePlanFromItems } from "../domain/message-stream/queries/selectors";
import type { Thread } from "../../../../domain/threads/model";
import type { MessageStreamItem } from "../../domain/message-stream/items";
import { latestImplementablePlanFromItems } from "../../domain/message-stream/selectors";
import { messageStreamItems, messageStreamIsEmpty } from "./message-stream";
export interface SubmissionStateSnapshot {

View file

@ -1,9 +1,9 @@
import type { AppServerClient } from "../../../app-server/connection/client";
import type { Thread } from "../../../domain/threads/model";
import type { ThreadConversationSummary } from "../../../domain/threads/transcript";
import type { CodexPanelSettings } from "../../../settings/model";
import { generateThreadTitleWithCodex } from "../../thread-title/generation";
import { threadTitleContextFromConversationSummary, type ThreadTitleContext } from "../../thread-title/model";
import type { AppServerClient } from "../../../../app-server/connection/client";
import type { Thread } from "../../../../domain/threads/model";
import type { ThreadConversationSummary } from "../../../../domain/threads/transcript";
import type { CodexPanelSettings } from "../../../../settings/model";
import { generateThreadTitleWithCodex } from "../../../thread-title/generation";
import { threadTitleContextFromConversationSummary, type ThreadTitleContext } from "../../../thread-title/model";
import type { ChatAction, ChatState, ChatStateStore } from "../state/reducer";
import { messageStreamItems } from "../state/message-stream";
import { threadTitleContextFromMessageStreamItems } from "./title-context";

View file

@ -1,6 +1,6 @@
import type { ConnectionManager } from "../../../app-server/connection/connection-manager";
import type { AppServerClient } from "../../../app-server/connection/client";
import type { ArchiveExportAdapter } from "../../thread-export/archive-markdown";
import type { ConnectionManager } from "../../../../app-server/connection/connection-manager";
import type { AppServerClient } from "../../../../app-server/connection/client";
import type { ArchiveExportAdapter } from "../../../thread-export/archive-markdown";
import { createGoalActions } from "./goal-actions";
import { createSelectionActions } from "./selection-actions";
import type { ChatResumeWorkTracker, ChatViewDeferredTasks } from "../lifecycle";

View file

@ -1,9 +1,9 @@
import type { AppServerClient } from "../../../app-server/connection/client";
import { readThreadGoal, recordThreadGoalUserMessage, setThreadGoal } from "../../../app-server/services/thread-goals";
import type { ThreadGoal, ThreadGoalStatus, ThreadGoalUpdate } from "../../../domain/threads/goal";
import type { AppServerClient } from "../../../../app-server/connection/client";
import { readThreadGoal, recordThreadGoalUserMessage, setThreadGoal } from "../../../../app-server/services/thread-goals";
import type { ThreadGoal, ThreadGoalStatus, ThreadGoalUpdate } from "../../../../domain/threads/goal";
import type { ChatStateStore } from "../state/reducer";
import type { GoalMessageStreamItem } from "../domain/message-stream/model/items";
import { goalChangeItem } from "../domain/message-stream/factories/goal-items";
import type { GoalMessageStreamItem } from "../../domain/message-stream/items";
import { goalChangeItem } from "../../domain/message-stream/factories/goal-items";
import { emptyGoalObjectiveMessage } from "./messages";
export interface GoalActionsHost {

View file

@ -1,8 +1,8 @@
import type { AppServerClient } from "../../../app-server/connection/client";
import type { TurnItem } from "../../../app-server/protocol/turn";
import type { ThreadTurnsPage } from "../../../domain/threads/history";
import type { AppServerClient } from "../../../../app-server/connection/client";
import type { TurnItem } from "../../../../app-server/protocol/turn";
import type { ThreadTurnsPage } from "../../../../domain/threads/history";
import type { ChatAction, ChatState, ChatStateStore } from "../state/reducer";
import { messageStreamItemsFromTurns } from "../app-server/mappers/message-stream/turn-items";
import { messageStreamItemsFromTurns } from "../../app-server/mappers/message-stream/turn-items";
import { messageStreamItems } from "../state/message-stream";
export interface HistoryControllerHost {

View file

@ -1,5 +1,5 @@
import type { AppServerClient } from "../../../app-server/connection/client";
import { recoverRolloutTokenUsage } from "../../../app-server/services/rollout-token-usage";
import type { AppServerClient } from "../../../../app-server/connection/client";
import { recoverRolloutTokenUsage } from "../../../../app-server/services/rollout-token-usage";
import type { ChatResumeWorkTracker, ChatViewDeferredTasks } from "../lifecycle";
import type { ChatStateStore } from "../state/reducer";
import type { CodexChatHost } from "../chat-host";

View file

@ -1,5 +1,5 @@
import type { ConnectionManager } from "../../../app-server/connection/connection-manager";
import type { AppServerClient } from "../../../app-server/connection/client";
import type { ConnectionManager } from "../../../../app-server/connection/connection-manager";
import type { AppServerClient } from "../../../../app-server/connection/client";
import type { ChatStateStore } from "../state/reducer";
import type { CodexChatHost } from "../chat-host";
import { AutoTitleController } from "./auto-title-controller";

View file

@ -1,10 +1,10 @@
import type { AppServerClient } from "../../../app-server/connection/client";
import { readCompletedConversationSummariesPage } from "../../../app-server/services/threads";
import { getThreadTitle, normalizeExplicitThreadName } from "../../../domain/threads/model";
import type { Thread } from "../../../domain/threads/model";
import type { CodexPanelSettings } from "../../../settings/model";
import { generateThreadTitleWithCodex } from "../../thread-title/generation";
import { findThreadTitleContext, THREAD_TITLE_CONTEXT_UNAVAILABLE_MESSAGE, type ThreadTitleContext } from "../../thread-title/model";
import type { AppServerClient } from "../../../../app-server/connection/client";
import { readCompletedConversationSummariesPage } from "../../../../app-server/services/threads";
import { getThreadTitle, normalizeExplicitThreadName } from "../../../../domain/threads/model";
import type { Thread } from "../../../../domain/threads/model";
import type { CodexPanelSettings } from "../../../../settings/model";
import { generateThreadTitleWithCodex } from "../../../thread-title/generation";
import { findThreadTitleContext, THREAD_TITLE_CONTEXT_UNAVAILABLE_MESSAGE, type ThreadTitleContext } from "../../../thread-title/model";
import {
renameGenerationStillActive,
type ChatAction,

View file

@ -1,5 +1,5 @@
import type { AppServerClient } from "../../../app-server/connection/client";
import type { ThreadTokenUsage } from "../../../domain/runtime/metrics";
import type { AppServerClient } from "../../../../app-server/connection/client";
import type { ThreadTokenUsage } from "../../../../domain/runtime/metrics";
import { activeThreadId, canSwitchToThread, listedThreads, messageStreamItemsEmpty } from "../state/selectors";
import type { ChatStateStore } from "../state/reducer";
import type { RestorationController } from "./restoration-controller";

View file

@ -1,11 +1,11 @@
import { upsertThread } from "../../../domain/threads/model";
import type { Thread } from "../../../domain/threads/model";
import { upsertThread } from "../../../../domain/threads/model";
import type { Thread } from "../../../../domain/threads/model";
import {
threadActivationSnapshotFromAppServerResponse,
type ThreadActivationSnapshot,
} from "../../../app-server/services/thread-activation";
import type { ChatRuntimeState } from "../runtime/state";
import type { MessageStreamItem } from "../domain/message-stream/model/items";
} from "../../../../app-server/services/thread-activation";
import type { ChatRuntimeState } from "../../domain/runtime/state";
import type { MessageStreamItem } from "../../domain/message-stream/items";
import type { ActiveThreadResumedAction } from "../state/actions";
export interface ResumedThreadActionParams {

View file

@ -1,11 +1,11 @@
import { Notice } from "obsidian";
import type { AppServerClient } from "../../../app-server/connection/client";
import { readThreadForArchiveExport, rollbackThread as rollbackThreadOnAppServer } from "../../../app-server/services/threads";
import { inheritedForkThreadName, normalizeExplicitThreadName } from "../../../domain/threads/model";
import type { CodexPanelSettings } from "../../../settings/model";
import type { ArchiveExportAdapter } from "../../thread-export/archive-markdown";
import { exportArchivedThreadMarkdown } from "../../thread-export/archive-markdown";
import type { AppServerClient } from "../../../../app-server/connection/client";
import { readThreadForArchiveExport, rollbackThread as rollbackThreadOnAppServer } from "../../../../app-server/services/threads";
import { inheritedForkThreadName, normalizeExplicitThreadName } from "../../../../domain/threads/model";
import type { CodexPanelSettings } from "../../../../settings/model";
import type { ArchiveExportAdapter } from "../../../thread-export/archive-markdown";
import { exportArchivedThreadMarkdown } from "../../../thread-export/archive-markdown";
import type { CodexChatHost } from "../chat-host";
import {
archivedSourceOpenForkFailedMessage,
@ -22,7 +22,7 @@ import {
STATUS_ROLLBACK_FAILED,
STATUS_ROLLBACK_STARTING,
} from "./messages";
import { messageStreamItemsFromTurns } from "../app-server/mappers/message-stream/turn-items";
import { messageStreamItemsFromTurns } from "../../app-server/mappers/message-stream/turn-items";
import { messageStreamRollbackCandidate, messageStreamTurnsAfterTurnId } from "../state/message-stream";
import { chatTurnBusy, type ChatAction, type ChatState, type ChatStateStore } from "../state/reducer";
import { resumedThreadActionFromActiveRuntime } from "./resume";

View file

@ -1,7 +1,7 @@
import type { ThreadTitleContext } from "../../thread-title/model";
import { truncate } from "../../../utils";
import { isCompletedTurnOutcomeMessage } from "../domain/message-stream/queries/selectors";
import type { MessageStreamItem, MessageStreamMessageItem } from "../domain/message-stream/model/items";
import type { ThreadTitleContext } from "../../../thread-title/model";
import { truncate } from "../../../../utils";
import { isCompletedTurnOutcomeMessage } from "../../domain/message-stream/selectors";
import type { MessageStreamItem, MessageStreamMessageItem } from "../../domain/message-stream/items";
const MAX_CONTEXT_CHARS = 4_000;

View file

@ -1,5 +1,5 @@
import { getThreadTitle, type Thread } from "../../../domain/threads/model";
import { shortThreadId } from "../../../utils";
import { getThreadTitle, type Thread } from "../../../../domain/threads/model";
import { shortThreadId } from "../../../../utils";
export function codexPanelDisplayTitle(activeThreadId: string | null, threads: readonly Thread[], fallbackTitle?: string | null): string {
if (!activeThreadId) return "Codex";

View file

@ -0,0 +1,20 @@
import type { ExecutionState } from "./items";
type MessageStreamExecutionState = Exclude<ExecutionState, null>;
type ExecutionStateByStatus = Readonly<Record<string, MessageStreamExecutionState>>;
const AGENT_STATES: ExecutionStateByStatus = {
pendingInit: "running",
running: "running",
inProgress: "running",
completed: "completed",
shutdown: "completed",
interrupted: "failed",
errored: "failed",
notFound: "failed",
failed: "failed",
};
export function collabAgentStateExecutionState(status: string): ExecutionState {
return AGENT_STATES[status] ?? null;
}

View file

@ -1,6 +1,6 @@
import type { ThreadGoal, ThreadGoalStatus } from "../../../../../domain/threads/goal";
import { truncate } from "../../../../../utils";
import type { GoalMessageStreamItem } from "../model/items";
import type { GoalMessageStreamItem } from "../items";
const GOAL_SUMMARY_LIMIT = 140;

View file

@ -1,6 +1,4 @@
import type { FileUpdateChange } from "../../../../../app-server/protocol/file-change";
import type { MessageStreamItem, MessageStreamItemKind } from "../model/items";
import { normalizeFileChanges } from "../../../app-server/mappers/message-stream/turn-items";
import type { MessageStreamItem, MessageStreamItemKind } from "../items";
export const STREAMED_COMMAND_RUNNING_TEXT = "Command running";
export const STREAMED_FILE_CHANGE_IN_PROGRESS_TEXT = "File change inProgress";
@ -74,21 +72,3 @@ export function streamedItemOutputMessageStreamItem(params: {
}),
} as MessageStreamItem;
}
export function streamingFileChangeMessageStreamItem(
itemId: string,
turnId: string,
changes: FileUpdateChange[],
status: string,
): MessageStreamItem {
return {
id: itemId,
kind: "fileChange",
role: "tool",
turnId,
sourceItemId: itemId,
provenance: { source: "appServer", channel: "notification", event: "streamingDelta", sourceItemId: itemId },
status,
changes: normalizeFileChanges(changes),
};
}

View file

@ -1,4 +1,4 @@
import type { MessageStreamItem, MessageStreamNoticeSection } from "../model/items";
import type { MessageStreamItem, MessageStreamNoticeSection } from "../items";
export function createSystemItem(id: string, text: string): MessageStreamItem {
return {

View file

@ -1,4 +1,4 @@
import type { ExecutionState, MessageStreamItem } from "../model/items";
import type { ExecutionState, MessageStreamItem } from "../items";
type MessageStreamExecutionState = Exclude<ExecutionState, null>;
type ExecutionStateByStatus = Readonly<Record<string, MessageStreamExecutionState>>;

View file

@ -1,5 +1,5 @@
import type { CodexInputItem } from "../../../../../domain/chat/input";
import type { MessageStreamFileMention } from "../model/items";
import type { MessageStreamFileMention } from "../items";
export function fileMentionsFromInput(input: readonly CodexInputItem[]): MessageStreamFileMention[] {
const seen = new Set<string>();

View file

@ -1,4 +1,4 @@
import type { ReferencedThreadMetadata } from "../../../../../domain/threads/reference";
import type { ReferencedThreadMetadata } from "../../../../domain/threads/reference";
import type { MessageStreamItemProvenance } from "./provenance";
export type MessageStreamItemKind =

View file

@ -1,5 +1,5 @@
import type { AssistantAuthoredMessageStreamItem, MessageStreamItem } from "../model/items";
import { messageStreamIsProposedPlan, messageStreamSemanticClassifications } from "../semantics";
import type { AssistantAuthoredMessageStreamItem, MessageStreamItem } from "./items";
import { messageStreamIsProposedPlan, messageStreamSemanticClassifications } from "./semantics";
export interface ForkCandidate {
itemId: string;

View file

@ -1,4 +1,4 @@
import type { MessageStreamItem } from "../model/items";
import type { MessageStreamItem } from "../items";
import type {
MessageStreamLifecycle,
MessageStreamMeaning,

View file

@ -1,5 +1,5 @@
import type { ExecutionState, MessageStreamItem } from "../model/items";
import type { MessageStreamItemProvenance } from "../model/provenance";
import type { ExecutionState, MessageStreamItem } from "../items";
import type { MessageStreamItemProvenance } from "../provenance";
type MessageStreamTurnRole = "initiator" | "steer" | "detail" | "outcome";

View file

@ -1,12 +1,12 @@
import { normalizeProposedPlanMarkdown } from "../format/proposed-plan";
import { isAssistantAuthoredMessage } from "../queries/selectors";
import { messageStreamIsTurnInitiator, messageStreamSemanticClassifications } from "../semantics";
import { normalizeProposedPlanMarkdown } from "./format/proposed-plan";
import { isAssistantAuthoredMessage } from "./selectors";
import { messageStreamIsTurnInitiator, messageStreamSemanticClassifications } from "./semantics";
import {
streamedItemOutputMessageStreamItem,
streamedTextMessageStreamItem,
streamedToolOutputMessageStreamItem,
} from "../factories/streaming-items";
import type { AssistantAuthoredMessageStreamItem, MessageStreamFileChange, MessageStreamItem, MessageStreamItemKind } from "../model/items";
} from "./factories/streaming-items";
import type { AssistantAuthoredMessageStreamItem, MessageStreamFileChange, MessageStreamItem, MessageStreamItemKind } from "./items";
export function upsertMessageStreamItemById(items: readonly MessageStreamItem[], next: MessageStreamItem): MessageStreamItem[] {
const index = items.findIndex((item) => item.id === next.id);

View file

@ -1,6 +1,6 @@
import { approvalActionKind, type ApprovalAction, type PendingApproval, type PendingUserInput } from "./model";
import { approvalDetails, approvalResultSummary, approvalTitle } from "./approval";
import type { MessageStreamItem } from "../message-stream/model/items";
import type { MessageStreamItem } from "../message-stream/items";
import { definedProp } from "../../../../utils";
export function createApprovalResultItem(approval: PendingApproval, action: ApprovalAction): MessageStreamItem {

View file

@ -1,7 +1,7 @@
import { cloneRuntimeConfigSnapshot, emptyRuntimeConfigSnapshot, type RuntimeConfigSnapshot } from "../../../domain/runtime/config";
import { findModelMetadataByIdOrName, type ModelMetadata } from "../../../domain/catalog/metadata";
import type { ApprovalPolicy, ApprovalsReviewer } from "../../../domain/runtime/policy";
import { supportedEffortsForModelMetadata, type ReasoningEffort } from "../../../domain/catalog/metadata";
import { cloneRuntimeConfigSnapshot, emptyRuntimeConfigSnapshot, type RuntimeConfigSnapshot } from "../../../../domain/runtime/config";
import { findModelMetadataByIdOrName, type ModelMetadata } from "../../../../domain/catalog/metadata";
import type { ApprovalPolicy, ApprovalsReviewer } from "../../../../domain/runtime/policy";
import { supportedEffortsForModelMetadata, type ReasoningEffort } from "../../../../domain/catalog/metadata";
import type { RuntimeSnapshot } from "./snapshot";
export function runtimeConfigOrDefault(runtimeConfig: RuntimeConfigSnapshot | null): RuntimeConfigSnapshot {

View file

@ -0,0 +1,26 @@
import type { ModelMetadata, ReasoningEffort } from "../../../../domain/catalog/metadata";
import type { RuntimeConfigSnapshot } from "../../../../domain/runtime/config";
import type { RateLimitSnapshot, ThreadTokenUsage } from "../../../../domain/runtime/metrics";
import type { ActivePermissionProfile, ApprovalPolicy, ApprovalsReviewer, ServiceTier } from "../../../../domain/runtime/policy";
import type { ActiveCollaborationMode, CollaborationMode, PendingRuntimeSetting, RequestedServiceTier } from "./pending-settings";
export interface RuntimeSnapshot {
runtimeConfig: RuntimeConfigSnapshot | null;
activeThreadId: string | null;
activeModel: string | null;
activeReasoningEffort: ReasoningEffort | null;
activeCollaborationMode: ActiveCollaborationMode;
activeServiceTier: ServiceTier | null;
activeApprovalPolicy: ApprovalPolicy | null;
activeApprovalsReviewer: ApprovalsReviewer | null;
activePermissionProfile: ActivePermissionProfile | null;
requestedModel: PendingRuntimeSetting<string>;
requestedReasoningEffort: PendingRuntimeSetting<ReasoningEffort>;
requestedApprovalsReviewer: PendingRuntimeSetting<ApprovalsReviewer>;
selectedCollaborationMode: CollaborationMode;
requestedServiceTier: PendingRuntimeSetting<RequestedServiceTier>;
tokenUsage: ThreadTokenUsage | null;
rateLimit: RateLimitSnapshot | null;
hasThreadTurns: boolean;
availableModels: readonly ModelMetadata[];
}

View file

@ -4,9 +4,9 @@ import {
type ApprovalPolicy,
type ApprovalsReviewer,
type ServiceTier,
} from "../../../domain/runtime/policy";
import type { RuntimeSettingsPatch } from "../../../domain/runtime/thread-settings";
import { normalizeReasoningEffort, type ReasoningEffort } from "../../../domain/catalog/metadata";
} from "../../../../domain/runtime/policy";
import type { RuntimeSettingsPatch } from "../../../../domain/runtime/thread-settings";
import { normalizeReasoningEffort, type ReasoningEffort } from "../../../../domain/catalog/metadata";
import {
resetRuntimeSettingToConfig,
setPendingRuntimeSetting,

View file

@ -0,0 +1 @@
export type TurnCollaborationModeWarning = "missing-model";

View file

@ -1,15 +1,15 @@
import type { App } from "obsidian";
import type { CodexInput } from "../../../../domain/chat/input";
import { MessageStreamScrollBridge } from "../../panel/surface/message-stream-scroll";
import { currentModel, runtimeConfigOrDefault } from "../../runtime/effective";
import { runtimeSnapshotForChatState } from "../../runtime/snapshot";
import { activeTurnId, type ChatStateStore } from "../../state/reducer";
import type { ComposerMetaViewModel } from "../../ui/composer";
import type { ChatPanelComposerShellState } from "../../ui/shell-state";
import type { CodexChatHost } from "../../chat-host";
import type { ChatRuntimeSettingsActions } from "../../runtime/settings-actions";
import { ChatComposerController } from "./controller";
import type { CodexInput } from "../../../domain/chat/input";
import { MessageStreamScrollBridge } from "../panel/surface/message-stream-scroll";
import { currentModel, runtimeConfigOrDefault } from "../domain/runtime/effective";
import { runtimeSnapshotForChatState } from "../application/runtime/snapshot";
import { activeTurnId, type ChatStateStore } from "../application/state/reducer";
import type { ComposerMetaViewModel } from "../ui/composer";
import type { ChatPanelComposerShellState } from "../ui/shell-state";
import type { CodexChatHost } from "../application/chat-host";
import type { ChatRuntimeSettingsActions } from "../application/runtime/settings-actions";
import { ChatComposerController } from "../ui/composer-controller";
export interface ConversationComposerContext {
app: App;

View file

@ -1,22 +1,22 @@
import type { App, Component } from "obsidian";
import type { AppServerClient } from "../../../app-server/connection/client";
import type { ChatServerThreadActions } from "../connection/server-actions/threads";
import { type ChatStateStore } from "../state/reducer";
import type { ChatReconnectActions } from "../connection/reconnect-actions";
import type { ChatServerThreadActions } from "../app-server/actions/threads";
import { type ChatStateStore } from "../application/state/reducer";
import type { ChatReconnectActions } from "../application/connection/reconnect-actions";
import { PendingRequestController } from "../application/pending-requests/controller";
import type { ChatRuntimeSettingsActions } from "../runtime/settings-actions";
import type { ThreadManagementActions } from "../threads/thread-management-actions";
import type { GoalActions } from "../threads/goal-actions";
import type { HistoryController } from "../threads/history-controller";
import type { ChatRuntimeSettingsActions } from "../application/runtime/settings-actions";
import type { ThreadManagementActions } from "../application/threads/thread-management-actions";
import type { GoalActions } from "../application/threads/goal-actions";
import type { HistoryController } from "../application/threads/history-controller";
import type { ChatInboundController } from "../app-server/inbound/controller";
import type { MessageStreamItem, MessageStreamNoticeSection } from "../domain/message-stream/model/items";
import type { MessageStreamItem, MessageStreamNoticeSection } from "../domain/message-stream/items";
import type { ChatMessageScrollIntentState } from "../ui/message-stream/scroll-intent-state";
import type { ComposerMetaViewModel } from "../ui/composer";
import type { ChatPanelComposerShellState } from "../ui/shell-state";
import type { CodexChatHost } from "../chat-host";
import type { CodexChatHost } from "../application/chat-host";
import { MessageStreamPresenter } from "../panel/surface/message-stream-presenter";
import { createConversationComposer } from "./composer/composition";
import { createConversationTurnActions } from "./turns/composition";
import { createConversationComposer } from "./composer";
import { createConversationTurnActions } from "../application/conversation/composition";
interface ConversationPartsContext {
obsidian: {

View file

@ -0,0 +1,40 @@
import { DeferredTask, type DeferredTaskWindow } from "../../../shared/lifecycle/deferred-task";
import type { ChatViewDeferredTasks } from "../application/lifecycle";
export function createChatViewDeferredTasks(getWindow: () => DeferredTaskWindow): ChatViewDeferredTasks {
const diagnosticsTask = new DeferredTask(getWindow, 1_000);
const restoredThreadHydrationTask = new DeferredTask(getWindow, 1_500);
const appServerWarmupTask = new DeferredTask(getWindow, 0);
return {
scheduleDiagnostics(callback): void {
diagnosticsTask.schedule(callback);
},
clearDiagnostics(): void {
diagnosticsTask.clear();
},
scheduleRestoredThreadHydration(callback): void {
restoredThreadHydrationTask.schedule(callback);
},
clearRestoredThreadHydration(): void {
restoredThreadHydrationTask.clear();
},
scheduleAppServerWarmup(callback): void {
appServerWarmupTask.schedule(callback);
},
clearAppServerWarmup(): void {
appServerWarmupTask.clear();
},
clearAll(): void {
restoredThreadHydrationTask.clear();
appServerWarmupTask.clear();
diagnosticsTask.clear();
},
};
}

View file

@ -1,51 +1,51 @@
import { Notice, type App, type Component, type EventRef } from "obsidian";
import { ConnectionManager, type ConnectionManagerHandlers } from "../../app-server/connection/connection-manager";
import type { AppServerClient } from "../../app-server/connection/client";
import type { ModelMetadata } from "../../domain/catalog/metadata";
import type { Thread } from "../../domain/threads/model";
import { getThreadTitle } from "../../domain/threads/model";
import type { SharedServerMetadata } from "../../domain/server/metadata";
import type { OpenCodexPanelSnapshot } from "../../workspace/open-panel-snapshot";
import type { ArchiveExportAdapter } from "../thread-export/archive-markdown";
import type { CodexChatHost } from "./chat-host";
import { scheduleAppServerWarmup } from "./connection/app-server-warmup";
import { ChatConnectionController } from "./connection/connection-controller";
import { createChatReconnectActions } from "./connection/reconnect-actions";
import { createChatServerDiagnosticsActions, type ChatServerDiagnosticsActions } from "./connection/server-actions/diagnostics";
import { createChatServerMetadataActions, type ChatServerMetadataActions } from "./connection/server-actions/metadata";
import { createChatServerThreadActions, type ChatServerThreadActions } from "./connection/server-actions/threads";
import type { ChatComposerController } from "./conversation/composer/controller";
import { createConversationParts } from "./conversation/composition";
import type { ComposerSubmitActions } from "./conversation/turns/composer-submit-actions";
import { codexPanelDisplayTitle } from "./threads/title-display";
import type { MessageStreamItem, MessageStreamNoticeSection } from "./domain/message-stream/model/items";
import { createStructuredSystemItem, createSystemItem } from "./domain/message-stream/factories/system-items";
import { ConnectionManager, type ConnectionManagerHandlers } from "../../../app-server/connection/connection-manager";
import type { AppServerClient } from "../../../app-server/connection/client";
import type { ModelMetadata } from "../../../domain/catalog/metadata";
import type { Thread } from "../../../domain/threads/model";
import { getThreadTitle } from "../../../domain/threads/model";
import type { SharedServerMetadata } from "../../../domain/server/metadata";
import type { OpenCodexPanelSnapshot } from "../../../workspace/open-panel-snapshot";
import type { ArchiveExportAdapter } from "../../thread-export/archive-markdown";
import type { CodexChatHost } from "../application/chat-host";
import { scheduleAppServerWarmup } from "../application/connection/app-server-warmup";
import { ChatConnectionController } from "../application/connection/connection-controller";
import { createChatReconnectActions } from "../application/connection/reconnect-actions";
import { createChatServerDiagnosticsActions, type ChatServerDiagnosticsActions } from "../app-server/actions/diagnostics";
import { createChatServerMetadataActions, type ChatServerMetadataActions } from "../app-server/actions/metadata";
import { createChatServerThreadActions, type ChatServerThreadActions } from "../app-server/actions/threads";
import type { ChatComposerController } from "../ui/composer-controller";
import { createConversationParts } from "./conversation";
import type { ComposerSubmitActions } from "../application/conversation/composer-submit-actions";
import { codexPanelDisplayTitle } from "../application/threads/title-display";
import type { MessageStreamItem, MessageStreamNoticeSection } from "../domain/message-stream/items";
import { createStructuredSystemItem, createSystemItem } from "../domain/message-stream/factories/system-items";
import {
effortStatusLines as buildEffortStatusLines,
modelStatusLines as buildModelStatusLines,
statusSummaryLines as buildStatusSummaryLines,
} from "./runtime/status";
} from "../presentation/runtime/status";
import { createChatViewDeferredTasks } from "./lifecycle";
import {
ChatConnectionWorkTracker,
ChatResumeWorkTracker,
createChatViewDeferredTasks,
type ChatViewDeferredTasks,
type RestoredThreadState,
} from "./lifecycle";
import { applyChatViewState } from "./panel/view-state";
import { closeChatView, openChatView, type ChatViewLifecycleHost } from "./panel/view-lifecycle";
import { createToolbarPanelActions, type ToolbarPanelActions } from "./panel/toolbar-actions";
import { connectionDiagnosticsModel } from "./panel/surface/toolbar";
import { openPanelTurnLifecycle } from "./panel/snapshot";
import { ChatInboundController } from "./app-server/inbound/controller";
import { rejectServerRequest, respondToServerRequest } from "./app-server/requests/responder";
import { collaborationModeLabel as formatCollaborationModeLabel } from "./runtime/messages";
import { createChatRuntimeSettingsActions } from "./runtime/settings-actions";
import { runtimeSnapshotForChatState, type RuntimeSnapshot } from "./runtime/snapshot";
import { chatPanelComposerProjection } from "./panel/surface/composer";
import { createChatMessageScrollIntentState, type ChatMessageScrollIntentState } from "./ui/message-stream/scroll-intent-state";
import { renderChatPanelShell } from "./ui/shell";
} from "../application/lifecycle";
import { applyChatViewState } from "../panel/view-state";
import { closeChatView, openChatView, type ChatViewLifecycleHost } from "../panel/view-lifecycle";
import { createToolbarPanelActions, type ToolbarPanelActions } from "../panel/toolbar-actions";
import { connectionDiagnosticsModel } from "../panel/surface/toolbar";
import { openPanelTurnLifecycle } from "../panel/snapshot";
import { ChatInboundController } from "../app-server/inbound/controller";
import { rejectServerRequest, respondToServerRequest } from "../app-server/requests/responder";
import { collaborationModeLabel as formatCollaborationModeLabel } from "../presentation/runtime/messages";
import { createChatRuntimeSettingsActions } from "../application/runtime/settings-actions";
import { runtimeSnapshotForChatState, type RuntimeSnapshot } from "../application/runtime/snapshot";
import { chatPanelComposerProjection } from "../panel/surface/composer";
import { createChatMessageScrollIntentState, type ChatMessageScrollIntentState } from "../ui/message-stream/scroll-intent-state";
import { renderChatPanelShell } from "../ui/shell";
import {
chatTurnBusy,
createChatStateStore,
@ -53,20 +53,20 @@ import {
type ChatConnectionPhase,
type ChatState,
type ChatStateStore,
} from "./state/reducer";
import type { GoalActions } from "./threads/goal-actions";
import type { AutoTitleController } from "./threads/auto-title-controller";
import type { HistoryController } from "./threads/history-controller";
import type { IdentitySync } from "./threads/identity-sync";
import type { ThreadRenameEditorController } from "./threads/rename-editor-controller";
import type { RestorationController } from "./threads/restoration-controller";
import type { ResumeController } from "./threads/resume-controller";
import type { SelectionActions } from "./threads/selection-actions";
import { createThreadParts, createThreadSelectionActions } from "./threads/composition";
import type { MessageStreamPresenter } from "./panel/surface/message-stream-presenter";
import { pendingRequestsSignature } from "./domain/pending-requests/signatures";
import { createChatPanelSurface } from "./panel/surface/create-surface";
import type { ChatPanelSurface } from "./panel/surface/model";
} from "../application/state/reducer";
import type { GoalActions } from "../application/threads/goal-actions";
import type { AutoTitleController } from "../application/threads/auto-title-controller";
import type { HistoryController } from "../application/threads/history-controller";
import type { IdentitySync } from "../application/threads/identity-sync";
import type { ThreadRenameEditorController } from "../application/threads/rename-editor-controller";
import type { RestorationController } from "../application/threads/restoration-controller";
import type { ResumeController } from "../application/threads/resume-controller";
import type { SelectionActions } from "../application/threads/selection-actions";
import { createThreadParts, createThreadSelectionActions } from "../application/threads/composition";
import type { MessageStreamPresenter } from "../panel/surface/message-stream-presenter";
import { pendingRequestsSignature } from "../domain/pending-requests/signatures";
import { createChatPanelSurface } from "../panel/surface/create-surface";
import type { ChatPanelSurface } from "../panel/surface/model";
export interface ChatPanelEnvironment {
obsidian: {

View file

@ -1,11 +1,11 @@
import { ItemView, type ViewStateResult, type WorkspaceLeaf } from "obsidian";
import { VIEW_TYPE_CODEX_PANEL } from "../../constants";
import type { ModelMetadata } from "../../domain/catalog/metadata";
import type { Thread } from "../../domain/threads/model";
import type { OpenCodexPanelSnapshot } from "../../workspace/open-panel-snapshot";
import type { SharedServerMetadata } from "../../domain/server/metadata";
import type { CodexChatHost } from "./chat-host";
import { VIEW_TYPE_CODEX_PANEL } from "../../../constants";
import type { ModelMetadata } from "../../../domain/catalog/metadata";
import type { Thread } from "../../../domain/threads/model";
import type { OpenCodexPanelSnapshot } from "../../../workspace/open-panel-snapshot";
import type { SharedServerMetadata } from "../../../domain/server/metadata";
import type { CodexChatHost } from "../application/chat-host";
import { ChatPanelSession } from "./session";
export class CodexChatView extends ItemView {

View file

@ -1,8 +1,8 @@
import type { OpenCodexPanelSnapshot } from "../../../workspace/open-panel-snapshot";
import type { ChatState } from "../state/reducer";
import type { MessageStreamItem } from "../domain/message-stream/model/items";
import { latestProposedPlanFromItems } from "../domain/message-stream/queries/selectors";
import type { RestoredThreadState } from "../lifecycle";
import type { ChatState } from "../application/state/reducer";
import type { MessageStreamItem } from "../domain/message-stream/items";
import { latestProposedPlanFromItems } from "../domain/message-stream/selectors";
import type { RestoredThreadState } from "../application/lifecycle";
export function openPanelTurnLifecycle(state: ChatState["turn"]["lifecycle"]): OpenCodexPanelSnapshot["turnLifecycle"] {
if (state.kind === "running") return { kind: "running", turnId: state.turnId };

View file

@ -8,13 +8,13 @@ import {
fastModeActive,
runtimeConfigOrDefault,
supportedReasoningEfforts,
} from "../../runtime/effective";
import { contextSummary } from "../../runtime/status";
import { compactReasoningEffortLabel } from "../../runtime/messages";
} from "../../domain/runtime/effective";
import { contextSummary } from "../../presentation/runtime/status";
import { compactReasoningEffortLabel } from "../../presentation/runtime/messages";
import { sortedModelMetadata } from "../../../../domain/catalog/metadata";
import type { ReasoningEffort } from "../../../../domain/catalog/metadata";
import type { RuntimeSnapshot } from "../../runtime/snapshot";
import type { ChatState } from "../../state/reducer";
import type { RuntimeSnapshot } from "../../application/runtime/snapshot";
import type { ChatState } from "../../application/state/reducer";
import type {
ComposerContextMeterCellViewModel,
ComposerContextMeterViewModel,

View file

@ -1,16 +1,16 @@
import type { CodexPanelSettings } from "../../../../settings/model";
import type { ConnectionManager } from "../../../../app-server/connection/connection-manager";
import type { ChatStateStore } from "../../state/reducer";
import type { ChatConnectionController } from "../../connection/connection-controller";
import type { ChatReconnectActions } from "../../connection/reconnect-actions";
import type { ChatStateStore } from "../../application/state/reducer";
import type { ChatConnectionController } from "../../application/connection/connection-controller";
import type { ChatReconnectActions } from "../../application/connection/reconnect-actions";
import type { ChatInboundController } from "../../app-server/inbound/controller";
import type { ChatServerThreadActions } from "../../connection/server-actions/threads";
import type { ThreadManagementActions } from "../../threads/thread-management-actions";
import type { ChatServerThreadActions } from "../../app-server/actions/threads";
import type { ThreadManagementActions } from "../../application/threads/thread-management-actions";
import type { ToolbarPanelActions } from "../toolbar-actions";
import type { ThreadRenameEditorController } from "../../threads/rename-editor-controller";
import type { SelectionActions } from "../../threads/selection-actions";
import type { ChatRuntimeSettingsActions } from "../../runtime/settings-actions";
import type { GoalActions } from "../../threads/goal-actions";
import type { ThreadRenameEditorController } from "../../application/threads/rename-editor-controller";
import type { SelectionActions } from "../../application/threads/selection-actions";
import type { ChatRuntimeSettingsActions } from "../../application/runtime/settings-actions";
import type { GoalActions } from "../../application/threads/goal-actions";
import type { RestoredThreadTitleSnapshot, ChatPanelSurface } from "./model";
import { createChatPanelGoalSurface } from "./goal-surface";
import { createChatPanelToolbarSurface } from "./toolbar-surface";

View file

@ -1,9 +1,9 @@
import type { CodexPanelSettings } from "../../../../settings/model";
import type { ChatConnectionController } from "../../connection/connection-controller";
import type { ChatConnectionController } from "../../application/connection/connection-controller";
import type { ChatInboundController } from "../../app-server/inbound/controller";
import type { ChatServerThreadActions } from "../../connection/server-actions/threads";
import type { GoalActions } from "../../threads/goal-actions";
import type { ChatAction, ChatState, ChatStateStore } from "../../state/reducer";
import type { ChatServerThreadActions } from "../../app-server/actions/threads";
import type { GoalActions } from "../../application/threads/goal-actions";
import type { ChatAction, ChatState, ChatStateStore } from "../../application/state/reducer";
import type { ChatPanelGoalSurface } from "./model";
export interface ChatPanelGoalSurfaceHost {

View file

@ -2,16 +2,15 @@ import type { ComponentChild as UiNode } from "preact";
import { h } from "preact";
import type { App, Component } from "obsidian";
import { copyTextWithNotice } from "../../../../shared/ui/clipboard";
import type { ChatAction, ChatStateStore } from "../../state/reducer";
import type { ChatAction, ChatStateStore } from "../../application/state/reducer";
import type { MessageStreamScrollIntent, MessageStreamVirtualizerHandle } from "../../ui/message-stream/virtualizer";
import { MarkdownMessageRenderer } from "../../ui/message-stream/markdown-renderer";
import { MessageStreamViewport, type MessageStreamViewportState } from "../../ui/message-stream/viewport";
import type { MessageStreamItem } from "../../domain/message-stream/model/items";
import type { MessageStreamItem } from "../../domain/message-stream/items";
import { messageStreamBlocks } from "../../ui/message-stream/stream-blocks";
import { messageStreamStateFromShellState, useChatPanelShellState, type ChatPanelMessageStreamShellState } from "../../ui/shell-state";
import type { PendingRequestBlockSnapshot } from "../../presentation/pending-requests/snapshot";
import type { PendingRequestBlockActions } from "../../presentation/pending-requests/view-model";
import type { ChatTurnDiffViewState } from "../../turn-diff/model";
import type { PendingRequestBlockActions, PendingRequestBlockState } from "../../application/pending-requests/block";
import type { ChatTurnDiffViewState } from "../../domain/turn-diff";
import {
createMessageStreamSurfaceContext,
messageStreamSurfaceProjectionFromState,
@ -39,7 +38,7 @@ interface ChatMessageStreamActions {
interface ChatMessageStreamRequests {
pendingSignature: () => string;
pendingSnapshot: () => PendingRequestBlockSnapshot;
pendingSnapshot: () => PendingRequestBlockState;
pendingActions: () => PendingRequestBlockActions;
consumePendingAutoFocus: () => boolean;
}

View file

@ -1,25 +1,31 @@
import { activeTurnId, chatTurnBusy, type ChatAction, type ChatDisclosureBucket, type ChatDisclosureUiState } from "../../state/reducer";
import type { MessageStreamItem } from "../../domain/message-stream/model/items";
import {
activeTurnId,
chatTurnBusy,
type ChatAction,
type ChatDisclosureBucket,
type ChatDisclosureUiState,
} from "../../application/state/reducer";
import type { MessageStreamItem } from "../../domain/message-stream/items";
import { messageStreamViewBlocks, type MessageStreamViewBlock } from "../../presentation/message-stream/view-model";
import { implementPlanCandidateFromState } from "../../state/selectors";
import { implementPlanCandidateFromState } from "../../application/state/selectors";
import {
type ForkCandidate,
forkCandidatesFromItems,
isForkCandidateItem,
isRollbackCandidateItem,
} from "../../domain/message-stream/queries/selectors";
} from "../../domain/message-stream/selectors";
import {
messageStreamActiveItems,
messageStreamItems,
messageStreamRollbackCandidate,
messageStreamStableItems,
type MessageStreamRollbackCandidate,
} from "../../state/message-stream";
} from "../../application/state/message-stream";
import type { MessageStreamContext } from "../../ui/message-stream/context";
import type { ChatPanelMessageStreamShellState } from "../../ui/shell-state";
import type { PendingRequestBlockSnapshot } from "../../presentation/pending-requests/snapshot";
import type { PendingRequestBlockActions } from "../../presentation/pending-requests/view-model";
import type { ChatTurnDiffViewState } from "../../turn-diff/model";
import { pendingRequestBlockSnapshotFromState } from "../../presentation/pending-requests/snapshot";
import type { PendingRequestBlockActions, PendingRequestBlockState } from "../../application/pending-requests/block";
import type { ChatTurnDiffViewState } from "../../domain/turn-diff";
interface ChatMessageStreamActions {
rollbackThread: (threadId: string) => void;
@ -30,7 +36,7 @@ interface ChatMessageStreamActions {
interface ChatMessageStreamRequests {
pendingSignature: () => string;
pendingSnapshot: () => PendingRequestBlockSnapshot;
pendingSnapshot: () => PendingRequestBlockState;
pendingActions: () => PendingRequestBlockActions;
consumePendingAutoFocus: () => boolean;
}
@ -149,7 +155,7 @@ function messageStreamContextFromProjection(
},
pendingRequests: {
signature: context.requests.pendingSignature(),
snapshot: context.requests.pendingSnapshot,
snapshot: () => pendingRequestBlockSnapshotFromState(context.requests.pendingSnapshot()),
actions: context.requests.pendingActions,
consumeAutoFocus: context.requests.consumePendingAutoFocus,
},

View file

@ -1,4 +1,4 @@
import type { ComposerBoundaryScrollAction } from "../../conversation/composer/boundary-scroll";
import type { ComposerBoundaryScrollAction } from "../../application/composer/boundary-scroll";
import type { MessageStreamVirtualizerHandle } from "../../ui/message-stream/virtualizer";
export class MessageStreamScrollBridge {

View file

@ -1,7 +1,7 @@
import { messageStreamItems } from "../../state/message-stream";
import type { ChatState } from "../../state/reducer";
import type { RuntimeSnapshot } from "../../runtime/snapshot";
import { runtimeSnapshotForChatSlices } from "../../runtime/snapshot";
import { messageStreamItems } from "../../application/state/message-stream";
import type { ChatState } from "../../application/state/reducer";
import type { RuntimeSnapshot } from "../../application/runtime/snapshot";
import { runtimeSnapshotForChatSlices } from "../../application/runtime/snapshot";
export function runtimeSnapshotForShellState(
state: Pick<ChatState, "connection" | "activeThread" | "runtime" | "messageStream">,

View file

@ -1,14 +1,14 @@
import type { CodexPanelSettings } from "../../../../settings/model";
import type { ConnectionManager } from "../../../../app-server/connection/connection-manager";
import type { ChatConnectionController } from "../../connection/connection-controller";
import type { ChatReconnectActions } from "../../connection/reconnect-actions";
import type { ChatConnectionController } from "../../application/connection/connection-controller";
import type { ChatReconnectActions } from "../../application/connection/reconnect-actions";
import type { ChatInboundController } from "../../app-server/inbound/controller";
import type { ThreadManagementActions } from "../../threads/thread-management-actions";
import type { ThreadManagementActions } from "../../application/threads/thread-management-actions";
import type { ToolbarPanelActions } from "../toolbar-actions";
import type { ThreadRenameEditorController } from "../../threads/rename-editor-controller";
import type { SelectionActions } from "../../threads/selection-actions";
import type { ChatStateStore } from "../../state/reducer";
import { noActiveThreadToCompactMessage } from "../../threads/messages";
import type { ThreadRenameEditorController } from "../../application/threads/rename-editor-controller";
import type { SelectionActions } from "../../application/threads/selection-actions";
import type { ChatStateStore } from "../../application/state/reducer";
import { noActiveThreadToCompactMessage } from "../../application/threads/messages";
import type { ChatPanelToolbarSurface } from "./model";
export interface ChatPanelToolbarSurfaceHost {

View file

@ -3,10 +3,10 @@ import { h } from "preact";
import type { Thread } from "../../../../domain/threads/model";
import { getThreadTitle } from "../../../../domain/threads/model";
import { runtimeConfigSections, rateLimitSummary } from "../../runtime/status";
import { connectionDiagnosticSections } from "../../connection/diagnostics-display";
import type { RuntimeSnapshot } from "../../runtime/snapshot";
import { chatTurnBusy, type ChatState } from "../../state/reducer";
import { runtimeConfigSections, rateLimitSummary } from "../../presentation/runtime/status";
import { connectionDiagnosticSections } from "../../application/connection/diagnostics-display";
import type { RuntimeSnapshot } from "../../application/runtime/snapshot";
import { chatTurnBusy, type ChatState } from "../../application/state/reducer";
import { toolbarStateFromShellState, useChatPanelShellState, type ChatPanelToolbarShellState } from "../../ui/shell-state";
import { Toolbar, type ToolbarThreadRow, type ToolbarViewModel } from "../../ui/toolbar";
import type { ChatPanelToolbarSurface } from "./model";

View file

@ -1,5 +1,5 @@
import type { ThreadManagementActions } from "../threads/thread-management-actions";
import type { ChatAction, ChatState, ChatStateStore } from "../state/reducer";
import type { ThreadManagementActions } from "../application/threads/thread-management-actions";
import type { ChatAction, ChatState, ChatStateStore } from "../application/state/reducer";
export interface ToolbarPanelActionsHost {
stateStore: ChatStateStore;

View file

@ -1,5 +1,5 @@
import { parseRestoredThreadState } from "./snapshot";
import type { RestoredThreadState } from "../lifecycle";
import type { RestoredThreadState } from "../application/lifecycle";
export interface ChatViewStateHost {
invalidateResumeWork: () => void;

View file

@ -1,6 +1,6 @@
import { truncate } from "../../../../utils";
import { collabAgentStateExecutionState } from "../../app-server/mappers/message-stream/agent-items";
import type { AgentRunSummary, AgentRunSummaryAgent, AgentStateSummary, MessageStreamItem } from "../../domain/message-stream/model/items";
import { collabAgentStateExecutionState } from "../../domain/message-stream/agent-state";
import type { AgentRunSummary, AgentRunSummaryAgent, AgentStateSummary, MessageStreamItem } from "../../domain/message-stream/items";
const ACTIVE_AGENT_PREVIEW_LIMIT = 96;
type AgentRunState = "running" | "completed" | "failed";

View file

@ -1,5 +1,5 @@
import { activeAgentRunSummary } from "./agent-summary";
import type { AgentRunSummary, MessageStreamItem, TaskProgressMessageStreamItem } from "../../domain/message-stream/model/items";
import type { AgentRunSummary, MessageStreamItem, TaskProgressMessageStreamItem } from "../../domain/message-stream/items";
import {
messageStreamIsCoordinationProgress,
messageStreamIsTaskProgress,

View file

@ -1,4 +1,4 @@
import type { MessageStreamItem } from "../../domain/message-stream/model/items";
import type { MessageStreamItem } from "../../domain/message-stream/items";
import { pathRelativeToRoot } from "../../domain/message-stream/format/path-labels";
import {
messageStreamIsApprovalResult,

Some files were not shown because too many files have changed in this diff Show more