* feat(app): create empty workspace from new-workspace composer Pressing Create with an empty composer (no text, no attachments) on the new-workspace screen now creates the workspace without an agent and lands the user on the empty-state, where they can open a terminal or start an agent on their own. Dispatching submit handler routes to a named runCreateEmptyWorkspace sibling of runCreateChatAgent so empty creation is a first-class action, not a hidden branch in the chat path. * refactor(app): extract empty-workspace helpers into own module Gives the empty-workspace dispatch a real home, shrinks the test mock graph from ~20 modules to one. * test(app): type prompt in new-workspace e2e to exercise chat path Empty-submission now creates a bare workspace (no agent), so tests that assert agent-tab/optimistic-draft behavior must type a prompt to take the chat path.
29 lines
1016 B
TypeScript
29 lines
1016 B
TypeScript
import { navigateToWorkspace } from "@/hooks/use-workspace-navigation";
|
|
import type { normalizeWorkspaceDescriptor } from "@/stores/session-store";
|
|
import type { MessagePayload } from "@/components/message-input";
|
|
import type { AgentAttachment } from "@server/shared/messages";
|
|
|
|
export function isEmptyWorkspaceSubmission(payload: MessagePayload): boolean {
|
|
return !payload.text.trim() && payload.attachments.length === 0;
|
|
}
|
|
|
|
export interface CreateEmptyWorkspaceInput {
|
|
payload: MessagePayload;
|
|
ensureWorkspace: (input: {
|
|
cwd: string;
|
|
prompt: string;
|
|
attachments: AgentAttachment[];
|
|
}) => Promise<ReturnType<typeof normalizeWorkspaceDescriptor>>;
|
|
serverId: string;
|
|
}
|
|
|
|
export async function runCreateEmptyWorkspace(input: CreateEmptyWorkspaceInput): Promise<void> {
|
|
const { payload, ensureWorkspace, serverId } = input;
|
|
const ensuredWorkspace = await ensureWorkspace({
|
|
cwd: payload.cwd,
|
|
prompt: "",
|
|
attachments: [],
|
|
});
|
|
navigateToWorkspace(serverId, ensuredWorkspace.id);
|
|
}
|