Skip to content

Commit d6174fc

Browse files
committed
Make execution options extend base options
- CompactExecutionOptions now extends CompactOptions - ForkOptions (execution) now extends UserForkOptions (base) - Moved UserForkOptions definition to workspaceFork.ts (source of truth) - Pass options object directly to formatCompactCommand (no reconstruction) - Eliminates field duplication and ensures type consistency
1 parent 6c8855b commit d6174fc

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

src/utils/chatCommands.ts

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,16 @@ export function formatNewCommand(
105105
// ============================================================================
106106

107107
export { forkWorkspace, type ForkResult } from "./workspaceFork";
108-
// Re-export internal type with different name to avoid confusion
109-
export type { ForkOptions as ForkExecutionOptions } from "./workspaceFork";
110-
111-
/**
112-
* User-facing fork options (modal/command inputs)
113-
*/
114-
export interface ForkOptions {
115-
newName: string;
116-
startMessage?: string;
117-
}
108+
export type {
109+
ForkOptions as ForkExecutionOptions,
110+
UserForkOptions as ForkOptions,
111+
} from "./workspaceFork";
112+
import type { UserForkOptions } from "./workspaceFork";
118113

119114
/**
120115
* Format /fork command string for display
121116
*/
122-
export function formatForkCommand(options: ForkOptions): string {
117+
export function formatForkCommand(options: UserForkOptions): string {
123118
let cmd = `/fork ${options.newName}`;
124119
if (options.startMessage) {
125120
cmd += `\n${options.startMessage}`;
@@ -143,11 +138,8 @@ export interface CompactOptions {
143138
/**
144139
* Internal execution options (includes workspace context)
145140
*/
146-
export interface CompactExecutionOptions {
141+
export interface CompactExecutionOptions extends CompactOptions {
147142
workspaceId: string;
148-
maxOutputTokens?: number;
149-
continueMessage?: string;
150-
model?: string;
151143
sendMessageOptions: SendMessageOptions;
152144
editMessageId?: string;
153145
}
@@ -187,11 +179,7 @@ export function prepareCompactionMessage(options: CompactExecutionOptions): {
187179

188180
const metadata: CmuxFrontendMetadata = {
189181
type: "compaction-request",
190-
rawCommand: formatCompactCommand({
191-
maxOutputTokens: options.maxOutputTokens,
192-
model: options.model,
193-
continueMessage: options.continueMessage,
194-
}),
182+
rawCommand: formatCompactCommand(options),
195183
parsed: compactData,
196184
};
197185

src/utils/workspaceFork.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@ import type { FrontendWorkspaceMetadata } from "@/types/workspace";
88
import { CUSTOM_EVENTS } from "@/constants/events";
99
import { copyWorkspaceStorage } from "@/constants/storage";
1010

11-
export interface ForkOptions {
12-
sourceWorkspaceId: string;
11+
/**
12+
* User-facing fork options (modal/command inputs)
13+
*/
14+
export interface UserForkOptions {
1315
newName: string;
1416
startMessage?: string;
17+
}
18+
19+
/**
20+
* Internal execution options (includes workspace context)
21+
*/
22+
export interface ForkOptions extends UserForkOptions {
23+
sourceWorkspaceId: string;
1524
sendMessageOptions?: SendMessageOptions;
1625
}
1726

0 commit comments

Comments
 (0)